diff --git a/.editorconfig b/.editorconfig
index 2e7f584..949cd61 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,62 +1,127 @@
-# EditorConfig is awesome:http://EditorConfig.org
-
-# top-most EditorConfig file
root = true
-# Don't use tabs for indentation.
[*]
indent_style = space
-end_of_line = crlf
-
-# Dotnet code style settings:
-[*.{cs,vb}]
-# Sort using and Import directives with System.* appearing first
-dotnet_sort_system_directives_first = true
-# Avoid "this." and "Me." if not necessary
-dotnet_style_qualification_for_field = false : warning
-dotnet_style_qualification_for_property = false : warning
-dotnet_style_qualification_for_method = false : warning
-dotnet_style_qualification_for_event = false : warning
-
-# Use language keywords instead of framework type names for type references
-dotnet_style_predefined_type_for_locals_parameters_members = true : suggestion
-dotnet_style_predefined_type_for_member_access = true : suggestion
-
-# Suggest more modern language features when available
-dotnet_style_object_initializer = true : suggestion
-dotnet_style_collection_initializer = true : suggestion
-dotnet_style_coalesce_expression = true : suggestion
-dotnet_style_null_propagation = true : suggestion
-dotnet_style_explicit_tuple_names = true : suggestion
-
-# CSharp code style settings:
+indent_size = 4
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+
[*.cs]
-# Prefer "var" everywhere
-csharp_style_var_for_built_in_types = true : warning
-csharp_style_var_when_type_is_apparent = true : warning
-csharp_style_var_elsewhere = true : suggestion
-
-# Prefer method-like constructs to have a block body
-csharp_style_expression_bodied_methods = false : suggestion
-csharp_style_expression_bodied_constructors = false : suggestion
-csharp_style_expression_bodied_operators = false : suggestion
-
-# Prefer property-like constructs to have an expression-body
-csharp_style_expression_bodied_properties = true : none
-csharp_style_expression_bodied_indexers = false : suggestion
-csharp_style_expression_bodied_accessors = false : suggestion
-
-# Suggest more modern language features when available
-csharp_style_pattern_matching_over_is_with_cast_check = true : suggestion
-csharp_style_pattern_matching_over_as_with_null_check = true : suggestion
-csharp_style_inlined_variable_declaration = true : suggestion
-csharp_style_throw_expression = true : suggestion
-csharp_style_conditional_delegate_call = true : suggestion
-
-# Newline settings
-csharp_new_line_before_open_brace = all
-csharp_new_line_before_else = true
-csharp_new_line_before_catch = true
-csharp_new_line_before_finally = true
+
+csharp_prefer_braces = true:silent
+dotnet_style_prefer_auto_properties = true:silent
+
+dotnet_style_explicit_tuple_names = true:error
+dotnet_style_prefer_inferred_anonymous_type_member_names = false:suggestion
+
+# naming
+
+dotnet_naming_rule.public_members_must_be_capitalized.symbols = public_symbols
+dotnet_naming_symbols.public_symbols.applicable_kinds = property,method,field,event,delegate
+dotnet_naming_symbols.public_symbols.applicable_accessibilities = public
+dotnet_naming_symbols.public_symbols.required_modifiers = readonly
+
+dotnet_naming_rule.public_members_must_be_capitalized.style = first_word_upper_case_style
+dotnet_naming_style.first_word_upper_case_style.capitalization = first_word_upper
+
+dotnet_naming_rule.public_members_must_be_capitalized.severity = warning
+
+# this
+
+dotnet_style_qualification_for_field = false:error
+dotnet_style_qualification_for_property = false:error
+dotnet_style_qualification_for_method = false:error
+dotnet_style_qualification_for_event = false:error
+
+dotnet_style_predefined_type_for_locals_parameters_members = true:error
+dotnet_style_predefined_type_for_member_access = true:error
+
+# access modifiers
+csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:silent
+dotnet_style_require_accessibility_modifiers = always:error
+dotnet_style_readonly_field = true:warning
+
+# brackets for operators
+
+dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:suggestion
+dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggestion
+dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion
+dotnet_style_parentheses_in_other_operators = never_if_unnecessary:warning
+
+# object initializers
+
+dotnet_style_object_initializer = true:warning
+dotnet_style_collection_initializer = true:warning
+
+# conditionals
+
+dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
+dotnet_style_prefer_conditional_expression_over_return = false:suggestion
+
+# null checks
+
+dotnet_style_coalesce_expression = true:silent
+dotnet_style_null_propagation = true:silent
+dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent
+
+# var vs explicit type
+
+csharp_style_var_for_built_in_types = true:error
+csharp_style_var_when_type_is_apparent = true:error
+csharp_style_var_elsewhere = true:suggestion
+
+# expressions
+
+csharp_style_expression_bodied_methods = false:suggestion
+csharp_style_expression_bodied_constructors = false:suggestion
+csharp_style_expression_bodied_operators = false:suggestion
+csharp_style_expression_bodied_properties = true:suggestion
+csharp_style_expression_bodied_indexers = when_on_single_line:silent
+csharp_style_expression_bodied_accessors = false:warning
+
+csharp_style_pattern_matching_over_is_with_cast_check = true:silent
+csharp_style_pattern_matching_over_as_with_null_check = true:silent
+csharp_style_inlined_variable_declaration = true:silent
+
+csharp_prefer_simple_default_expression = true:silent
+csharp_style_deconstructed_variable_declaration = true:silent
+csharp_style_pattern_local_over_anonymous_function = true:warning
+csharp_style_throw_expression = true:silent
+csharp_style_conditional_delegate_call = true:silent
+
+# whitespace
+
+csharp_new_line_before_open_brace = all
+csharp_new_line_before_else = true
+csharp_new_line_before_catch = true
+csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
-csharp_new_line_before_members_in_anonymous_types = true
\ No newline at end of file
+csharp_new_line_before_members_in_anonymous_types = true
+csharp_new_line_between_query_expression_clauses = true
+
+# indents
+
+csharp_indent_case_contents = true
+csharp_indent_switch_labels = true
+csharp_indent_labels= flush_left
+
+# spaces
+
+csharp_space_after_cast = false
+csharp_space_after_keywords_in_control_flow_statements = true
+csharp_space_between_method_declaration_parameter_list_parentheses = false
+csharp_space_between_method_call_parameter_list_parentheses = false
+csharp_space_between_parentheses =false
+csharp_space_before_colon_in_inheritance_clause = true
+csharp_space_after_colon_in_inheritance_clause = true
+csharp_space_around_binary_operators = before_and_after
+csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
+csharp_space_between_method_call_name_and_opening_parenthesis = false
+csharp_space_between_method_call_empty_parameter_list_parentheses = false
+
+# wrapping
+
+csharp_preserve_single_line_statements = false
+csharp_preserve_single_line_blocks = true
diff --git a/.gitignore b/.gitignore
index 4458e3f..4d97422 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,8 +22,9 @@ bld/
[Bb]in/
[Oo]bj/
-# Visual Studio 2015 cache/options directory
+# Visual Studio/ -Code cache/options directory
.vs/
+.vscode/
# MSTest test Results
[Tt]est[Rr]esult*/
@@ -226,3 +227,5 @@ ModelManifest.xml
# Merge
*.orig
+
+!Maple.Log
\ No newline at end of file
diff --git a/src/Maple.Localization/Properties/Resources.en.Designer.cs b/.gitmodules
similarity index 100%
rename from src/Maple.Localization/Properties/Resources.en.Designer.cs
rename to .gitmodules
diff --git a/.nuget/NuGet.config b/.nuget/NuGet.config
new file mode 100644
index 0000000..d39766b
--- /dev/null
+++ b/.nuget/NuGet.config
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.vsconfig b/.vsconfig
new file mode 100644
index 0000000..a447280
--- /dev/null
+++ b/.vsconfig
@@ -0,0 +1,26 @@
+{
+ "version": "1.0",
+ "components": [
+ "Microsoft.VisualStudio.Component.CoreEditor",
+ "Microsoft.VisualStudio.Workload.CoreEditor",
+ "Microsoft.NetCore.Component.Runtime.3.1",
+ "Microsoft.NetCore.Component.SDK",
+ "Microsoft.VisualStudio.Component.NuGet",
+ "Microsoft.VisualStudio.Component.Roslyn.Compiler",
+ "Microsoft.VisualStudio.Component.Roslyn.LanguageServices",
+ "Microsoft.VisualStudio.Component.FSharp",
+ "Microsoft.NetCore.Component.DevelopmentTools",
+ "Microsoft.Net.ComponentGroup.DevelopmentPrerequisites",
+ "Microsoft.Component.MSBuild",
+ "Microsoft.VisualStudio.Component.TextTemplating",
+ "Microsoft.VisualStudio.Component.SQL.CLR",
+ "Microsoft.VisualStudio.Component.ManagedDesktop.Core",
+ "Microsoft.VisualStudio.Component.IntelliCode",
+ "Microsoft.Net.ComponentGroup.TargetingPacks.Common",
+ "Microsoft.VisualStudio.Component.DiagnosticTools",
+ "Microsoft.VisualStudio.Component.ManagedDesktop.Prerequisites",
+ "Microsoft.VisualStudio.Component.Debugger.JustInTime",
+ "Microsoft.VisualStudio.Workload.ManagedDesktop",
+ "Microsoft.VisualStudio.Component.Git",
+ ]
+}
diff --git a/Maple.ruleset b/Maple.ruleset
new file mode 100644
index 0000000..0c325fe
--- /dev/null
+++ b/Maple.ruleset
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Maple.sln b/Maple.sln
index a9926ba..5dc6789 100644
--- a/Maple.sln
+++ b/Maple.sln
@@ -1,28 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.27130.2010
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.28803.352
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D65C950A-327A-496D-A49C-B45E8F97C610}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
+ .vsconfig = .vsconfig
.XamlStyler = .XamlStyler
src\Resources\Art_Of_Escapism_-_Universe_Words.mp3 = src\Resources\Art_Of_Escapism_-_Universe_Words.mp3
src\Resources\client_secret.json = src\Resources\client_secret.json
src\Resources\SharedAssemblyInfo.cs = src\Resources\SharedAssemblyInfo.cs
EndProjectSection
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Maple", "src\Maple\Maple.csproj", "{FBD5595B-6859-4E8E-BDFA-C3169EF34985}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Maple", "src\Maple\Maple.csproj", "{FBD5595B-6859-4E8E-BDFA-C3169EF34985}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Maple.Core", "src\Maple.Core\Maple.Core.csproj", "{21FA5854-0692-42E2-924E-A38CF3C7FF71}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Maple.Data", "src\Maple.Data\Maple.Data.csproj", "{B3CD46BE-3C08-4BAE-AE60-A6D84A62400C}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Maple.Localization", "src\Maple.Localization\Maple.Localization.csproj", "{A073FC92-90E3-4541-8B52-6F7293187871}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Maple.Youtube", "src\Maple.Youtube\Maple.Youtube.csproj", "{B5BE546F-8D9F-4FB9-B235-AF05FD553F9E}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Maple.Test", "src\Maple.Test\Maple.Test.csproj", "{60F95B05-E714-4E0F-BA97-44711EC74210}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Maple.Youtube", "src\Maple.Youtube\Maple.Youtube.csproj", "{B5BE546F-8D9F-4FB9-B235-AF05FD553F9E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Cake", "Cake", "{E463B2A9-3556-4651-8EEA-0239E20B5393}"
ProjectSection(SolutionItems) = preProject
@@ -31,42 +24,54 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Cake", "Cake", "{E463B2A9-3
Cake\tools\packages.config = Cake\tools\packages.config
EndProjectSection
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Maple.Domain", "src\Maple.Domain\Maple.Domain.csproj", "{9D7D05A6-8271-4836-A7BB-5B2ABECCBD81}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Maple.Domain", "src\Maple.Domain\Maple.Domain.csproj", "{9D7D05A6-8271-4836-A7BB-5B2ABECCBD81}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FBD5595B-6859-4E8E-BDFA-C3169EF34985}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FBD5595B-6859-4E8E-BDFA-C3169EF34985}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FBD5595B-6859-4E8E-BDFA-C3169EF34985}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {FBD5595B-6859-4E8E-BDFA-C3169EF34985}.Debug|x64.Build.0 = Debug|Any CPU
+ {FBD5595B-6859-4E8E-BDFA-C3169EF34985}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {FBD5595B-6859-4E8E-BDFA-C3169EF34985}.Debug|x86.Build.0 = Debug|Any CPU
{FBD5595B-6859-4E8E-BDFA-C3169EF34985}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FBD5595B-6859-4E8E-BDFA-C3169EF34985}.Release|Any CPU.Build.0 = Release|Any CPU
- {21FA5854-0692-42E2-924E-A38CF3C7FF71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {21FA5854-0692-42E2-924E-A38CF3C7FF71}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {21FA5854-0692-42E2-924E-A38CF3C7FF71}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {21FA5854-0692-42E2-924E-A38CF3C7FF71}.Release|Any CPU.Build.0 = Release|Any CPU
- {B3CD46BE-3C08-4BAE-AE60-A6D84A62400C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {B3CD46BE-3C08-4BAE-AE60-A6D84A62400C}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {B3CD46BE-3C08-4BAE-AE60-A6D84A62400C}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {B3CD46BE-3C08-4BAE-AE60-A6D84A62400C}.Release|Any CPU.Build.0 = Release|Any CPU
- {A073FC92-90E3-4541-8B52-6F7293187871}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {A073FC92-90E3-4541-8B52-6F7293187871}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A073FC92-90E3-4541-8B52-6F7293187871}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A073FC92-90E3-4541-8B52-6F7293187871}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FBD5595B-6859-4E8E-BDFA-C3169EF34985}.Release|x64.ActiveCfg = Release|Any CPU
+ {FBD5595B-6859-4E8E-BDFA-C3169EF34985}.Release|x64.Build.0 = Release|Any CPU
+ {FBD5595B-6859-4E8E-BDFA-C3169EF34985}.Release|x86.ActiveCfg = Release|Any CPU
+ {FBD5595B-6859-4E8E-BDFA-C3169EF34985}.Release|x86.Build.0 = Release|Any CPU
{B5BE546F-8D9F-4FB9-B235-AF05FD553F9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B5BE546F-8D9F-4FB9-B235-AF05FD553F9E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B5BE546F-8D9F-4FB9-B235-AF05FD553F9E}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {B5BE546F-8D9F-4FB9-B235-AF05FD553F9E}.Debug|x64.Build.0 = Debug|Any CPU
+ {B5BE546F-8D9F-4FB9-B235-AF05FD553F9E}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {B5BE546F-8D9F-4FB9-B235-AF05FD553F9E}.Debug|x86.Build.0 = Debug|Any CPU
{B5BE546F-8D9F-4FB9-B235-AF05FD553F9E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B5BE546F-8D9F-4FB9-B235-AF05FD553F9E}.Release|Any CPU.Build.0 = Release|Any CPU
- {60F95B05-E714-4E0F-BA97-44711EC74210}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {60F95B05-E714-4E0F-BA97-44711EC74210}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {60F95B05-E714-4E0F-BA97-44711EC74210}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {60F95B05-E714-4E0F-BA97-44711EC74210}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B5BE546F-8D9F-4FB9-B235-AF05FD553F9E}.Release|x64.ActiveCfg = Release|Any CPU
+ {B5BE546F-8D9F-4FB9-B235-AF05FD553F9E}.Release|x64.Build.0 = Release|Any CPU
+ {B5BE546F-8D9F-4FB9-B235-AF05FD553F9E}.Release|x86.ActiveCfg = Release|Any CPU
+ {B5BE546F-8D9F-4FB9-B235-AF05FD553F9E}.Release|x86.Build.0 = Release|Any CPU
{9D7D05A6-8271-4836-A7BB-5B2ABECCBD81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9D7D05A6-8271-4836-A7BB-5B2ABECCBD81}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9D7D05A6-8271-4836-A7BB-5B2ABECCBD81}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {9D7D05A6-8271-4836-A7BB-5B2ABECCBD81}.Debug|x64.Build.0 = Debug|Any CPU
+ {9D7D05A6-8271-4836-A7BB-5B2ABECCBD81}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {9D7D05A6-8271-4836-A7BB-5B2ABECCBD81}.Debug|x86.Build.0 = Debug|Any CPU
{9D7D05A6-8271-4836-A7BB-5B2ABECCBD81}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9D7D05A6-8271-4836-A7BB-5B2ABECCBD81}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9D7D05A6-8271-4836-A7BB-5B2ABECCBD81}.Release|x64.ActiveCfg = Release|Any CPU
+ {9D7D05A6-8271-4836-A7BB-5B2ABECCBD81}.Release|x64.Build.0 = Release|Any CPU
+ {9D7D05A6-8271-4836-A7BB-5B2ABECCBD81}.Release|x86.ActiveCfg = Release|Any CPU
+ {9D7D05A6-8271-4836-A7BB-5B2ABECCBD81}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/license.md b/license.md
index 8864d4a..15bc72f 100644
--- a/license.md
+++ b/license.md
@@ -1,6 +1,6 @@
MIT License
-Copyright (c) 2017
+Copyright (c) 2019
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/src/Maple.Core/Commands/AsyncCommand.cs b/src/Maple.Core/Commands/AsyncCommand.cs
deleted file mode 100644
index da88d30..0000000
--- a/src/Maple.Core/Commands/AsyncCommand.cs
+++ /dev/null
@@ -1,155 +0,0 @@
-using System;
-using System.ComponentModel;
-using System.Runtime.CompilerServices;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Windows.Input;
-
-namespace Maple.Core
-{
- // source: https://msdn.microsoft.com/en-us/magazine/dn630647.aspx?f=255&MSPPError=-2147217396
- // Async Programming : Patterns for Asynchronous MVVM Applications: Commands by Stephen Cleary
- public class AsyncCommand : AsyncCommandBase, INotifyPropertyChanged
- {
- private readonly Func> _command;
- private readonly CancelAsyncCommand _cancelCommand;
- private readonly Func _canExecute = null;
-
- private NotifyTaskCompletion _execution;
-
- public event PropertyChangedEventHandler PropertyChanged;
-
- public ICommand CancelCommand => _cancelCommand;
-
- public NotifyTaskCompletion Execution
- {
- get { return _execution; }
- private set
- {
- _execution = value;
- OnPropertyChanged();
- }
- }
-
- public AsyncCommand(Func> command)
- {
- _command = command ?? throw new ArgumentNullException(nameof(command));
- _cancelCommand = new CancelAsyncCommand();
- }
-
- public AsyncCommand(Func> command, Func canExecuteEvaluator)
- : this(command)
- {
- _canExecute = canExecuteEvaluator ?? throw new ArgumentNullException(nameof(canExecuteEvaluator));
- }
-
- public override bool CanExecute(object parameter)
- {
- return (Execution == null || Execution.IsCompleted)
- && (_canExecute?.Invoke() ?? true);
- }
-
- public override async Task ExecuteAsync(object parameter)
- {
- _cancelCommand.NotifyCommandStarting();
-
- Execution = new NotifyTaskCompletion(_command(_cancelCommand.Token));
- RaiseCanExecuteChanged();
-
- await Execution.TaskCompletion.ConfigureAwait(true);
- _cancelCommand.NotifyCommandFinished();
- RaiseCanExecuteChanged();
- }
-
- protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
- }
-
- private sealed class CancelAsyncCommand : ICommand
- {
- private CancellationTokenSource _cts = new CancellationTokenSource();
- private bool _commandExecuting;
-
- public CancellationToken Token { get { return _cts.Token; } }
-
- public void NotifyCommandStarting()
- {
- _commandExecuting = true;
- if (!_cts.IsCancellationRequested)
- return;
-
- _cts = new CancellationTokenSource();
- RaiseCanExecuteChanged();
- }
-
- public void NotifyCommandFinished()
- {
- _commandExecuting = false;
- RaiseCanExecuteChanged();
- }
-
- bool ICommand.CanExecute(object parameter)
- {
- return _commandExecuting && !_cts.IsCancellationRequested;
- }
-
- void ICommand.Execute(object parameter)
- {
- _cts.Cancel();
- RaiseCanExecuteChanged();
- }
-
- public event EventHandler CanExecuteChanged
- {
- add { CommandManager.RequerySuggested += value; }
- remove { CommandManager.RequerySuggested -= value; }
- }
-
- private void RaiseCanExecuteChanged()
- {
- CommandManager.InvalidateRequerySuggested();
- }
- }
- }
-
- public static class AsyncCommand
- {
- public static AsyncCommand