This commit is contained in:
JeffBrand 2022-04-18 09:17:04 -05:00
Родитель 74a6fbf530
Коммит bc5a4b5b7a
3 изменённых файлов: 65 добавлений и 11 удалений

Просмотреть файл

@ -140,7 +140,7 @@
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.13</Version>
</PackageReference>
<PackageReference Include="MvvmLight">
<PackageReference Include="MvvmLightLibs">
<Version>5.4.1.1</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
@ -159,6 +159,30 @@
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\ARM64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<NoStdLib>true</NoStdLib>
<DebugType>full</DebugType>
<PlatformTarget>ARM64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<LangVersion>8.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM64'">
<OutputPath>bin\ARM64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<NoStdLib>true</NoStdLib>
<DebugType>pdbonly</DebugType>
<PlatformTarget>ARM64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<LangVersion>8.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

Просмотреть файл

@ -30,7 +30,11 @@ namespace AMP.Services
{
static bool _isEnabled = true;
#if DEBUG
static bool _emitToConsole = true;
#else
static bool _emitToConsole = false;
#endif
public bool IsEnabled { get { return _isEnabled; } set { _isEnabled = value; } }
public bool EmitToConsole { get { return _emitToConsole; } set { _emitToConsole = value; } }
@ -46,7 +50,7 @@ namespace AMP.Services
{
LogUtil.Information(message);
if (EmitToConsole)
System.Diagnostics.Debug.WriteLine($"");
System.Diagnostics.Debug.WriteLine($"{message}");
}
@ -56,7 +60,7 @@ namespace AMP.Services
if (IsEnabled)
LogUtil.Debug(message);
if (EmitToConsole)
System.Diagnostics.Debug.WriteLine($"");
System.Diagnostics.Debug.WriteLine($"{message}");
}
@ -65,7 +69,7 @@ namespace AMP.Services
if (IsEnabled)
LogUtil.Warning(message);
if (EmitToConsole)
System.Diagnostics.Debug.WriteLine($"");
System.Diagnostics.Debug.WriteLine($"{message}");
}
public void Error(string message)
@ -73,15 +77,16 @@ namespace AMP.Services
if (IsEnabled)
LogUtil.Error(message);
if (EmitToConsole)
System.Diagnostics.Debug.WriteLine($"");
System.Diagnostics.Debug.WriteLine($"{message}");
}
public void Fatal(string message)
{
if (IsEnabled)
LogUtil.Error(message);
if (EmitToConsole)
System.Diagnostics.Debug.WriteLine($"");
System.Diagnostics.Debug.WriteLine($"{message}");
}
@ -99,8 +104,12 @@ namespace AMP.Services
static LogUtil()
{
var logFilePath = Path.Combine(ApplicationData.Current.LocalFolder.Path, $"{LOG_BASE_NAME}.txt");
#if DEBUG
Log.Logger = new LoggerConfiguration().MinimumLevel.Verbose().WriteTo.File(logFilePath, rollingInterval: RollingInterval.Day).CreateLogger();
#else
Log.Logger = new LoggerConfiguration().MinimumLevel.Information().WriteTo.File(logFilePath, rollingInterval: RollingInterval.Day).CreateLogger();
#endif
}
public static void Debug(string message)

Просмотреть файл

@ -47,11 +47,32 @@ namespace AMP.Views.Commands
var control = d as ListViewBase;
if (control != null)
control.ItemClick += OnItemClick;
else
{
var click = d as UIElement;
if (click != null)
click.Tapped += Click_Tapped;
}
}
private static void Click_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
{
Type castType;
var control = sender as UIElement;
var command = GetCommand(control);
var param = GetCommandParameter(control);
if (command != null)
if (param is null && command.CanExecute(null))
command.Execute(null);
else if (param != null && command.CanExecute(param))
command.Execute(param);
}
// Using a DependencyProperty as the backing store for CommandParameter. This enables animation, styling, binding, etc...
public static readonly DependencyProperty CommandParameterProperty =
DependencyProperty.Register("CommandParameter", typeof(object), typeof(ItemClickCommand), new PropertyMetadata(null));
@ -76,9 +97,9 @@ namespace AMP.Views.Commands
var command = GetCommand(control);
var param = GetCommandParameter(control);
var generics = command.GetType().GetGenericArguments();
if (generics.Length > 0)
castType = generics[0];
//var generics = command.GetType().GetGenericArguments();
//if (generics.Length > 0)
// castType = generics[0];
if (command != null)
if (param is null && command.CanExecute(e.ClickedItem))