diff --git a/src/CSharp/EasyMicroservices.UI.Cores.Mvvm/BaseViewModel.cs b/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/BaseViewModel.cs similarity index 100% rename from src/CSharp/EasyMicroservices.UI.Cores.Mvvm/BaseViewModel.cs rename to src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/BaseViewModel.cs diff --git a/src/CSharp/EasyMicroservices.UI.Cores.Mvvm/Commands/BaseCommand.cs b/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Commands/BaseCommand.cs similarity index 100% rename from src/CSharp/EasyMicroservices.UI.Cores.Mvvm/Commands/BaseCommand.cs rename to src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Commands/BaseCommand.cs diff --git a/src/CSharp/EasyMicroservices.UI.Cores.Mvvm/Commands/RelayCommand.cs b/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Commands/RelayCommand.cs similarity index 100% rename from src/CSharp/EasyMicroservices.UI.Cores.Mvvm/Commands/RelayCommand.cs rename to src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Commands/RelayCommand.cs diff --git a/src/CSharp/EasyMicroservices.UI.Cores.Mvvm/Commands/TaskBaseCommand.cs b/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Commands/TaskBaseCommand.cs similarity index 87% rename from src/CSharp/EasyMicroservices.UI.Cores.Mvvm/Commands/TaskBaseCommand.cs rename to src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Commands/TaskBaseCommand.cs index 462a348..7a182c7 100644 --- a/src/CSharp/EasyMicroservices.UI.Cores.Mvvm/Commands/TaskBaseCommand.cs +++ b/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Commands/TaskBaseCommand.cs @@ -2,14 +2,13 @@ using EasyMicroservices.UI.Cores.Interfaces; using System; using System.Threading.Tasks; -using System.Windows.Input; namespace EasyMicroservices.UI.Cores.Commands { /// /// /// - public class TaskBaseCommand : ICommand + public class TaskBaseCommand : ICommandAsync { /// /// @@ -76,11 +75,7 @@ public virtual bool CanExecute(object parameter = null) /// public virtual void Execute(object parameter) { - if (_busyViewModel != null) - { - _busyViewModel.Busy(); - CanExecuteChanged?.Invoke(this, new EventArgs()); - } + InternalExecuteInit(); _ = InternalExecute(parameter); } @@ -107,5 +102,25 @@ async Task InternalExecute(object parameter) } } } + + void InternalExecuteInit() + { + if (_busyViewModel != null) + { + _busyViewModel.Busy(); + CanExecuteChanged?.Invoke(this, new EventArgs()); + } + } + + /// + /// + /// + /// + /// + public async Task ExecuteAsync(object parameter) + { + InternalExecuteInit(); + await InternalExecute(parameter); + } } } \ No newline at end of file diff --git a/src/CSharp/EasyMicroservices.UI.Cores.Mvvm/Commands/TaskRelayCommand.cs b/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Commands/TaskRelayCommand.cs similarity index 100% rename from src/CSharp/EasyMicroservices.UI.Cores.Mvvm/Commands/TaskRelayCommand.cs rename to src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Commands/TaskRelayCommand.cs diff --git a/src/CSharp/EasyMicroservices.UI.Cores.Mvvm/EasyMicroservices.UI.Cores.Mvvm.csproj b/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/EasyMicroservices.UI.Cores.Mvvm.csproj similarity index 94% rename from src/CSharp/EasyMicroservices.UI.Cores.Mvvm/EasyMicroservices.UI.Cores.Mvvm.csproj rename to src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/EasyMicroservices.UI.Cores.Mvvm.csproj index c18e972..56ebbef 100644 --- a/src/CSharp/EasyMicroservices.UI.Cores.Mvvm/EasyMicroservices.UI.Cores.Mvvm.csproj +++ b/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/EasyMicroservices.UI.Cores.Mvvm.csproj @@ -5,7 +5,7 @@ AnyCPU;x64;x86 EasyMicroservices true - 0.0.0.6 + 0.0.0.7 Model View View Model EasyMicroservices@gmail.com mvvm,mvpvm,modelview,modelviewviewmodel @@ -17,7 +17,7 @@ - + diff --git a/src/CSharp/EasyMicroservices.UI.Cores.Mvvm/Interfaces/IBusyViewModel.cs b/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Interfaces/IBusyViewModel.cs similarity index 100% rename from src/CSharp/EasyMicroservices.UI.Cores.Mvvm/Interfaces/IBusyViewModel.cs rename to src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Interfaces/IBusyViewModel.cs diff --git a/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Interfaces/ICommandAsync.cs b/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Interfaces/ICommandAsync.cs new file mode 100644 index 0000000..206aa6d --- /dev/null +++ b/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Interfaces/ICommandAsync.cs @@ -0,0 +1,18 @@ +using System.Threading.Tasks; +using System.Windows.Input; + +namespace EasyMicroservices.UI.Cores.Interfaces +{ + /// + /// + /// + public interface ICommandAsync : ICommand + { + /// + /// + /// + /// + /// + Task ExecuteAsync(object parameter); + } +} diff --git a/src/CSharp/EasyMicroservices.UI.Cores.sln b/src/CSharp/Cores/EasyMicroservices.UI.Cores.sln similarity index 53% rename from src/CSharp/EasyMicroservices.UI.Cores.sln rename to src/CSharp/Cores/EasyMicroservices.UI.Cores.sln index 4fe1f2e..840be97 100644 --- a/src/CSharp/EasyMicroservices.UI.Cores.sln +++ b/src/CSharp/Cores/EasyMicroservices.UI.Cores.sln @@ -5,24 +5,38 @@ VisualStudioVersion = 17.7.34018.315 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyMicroservices.UI.Cores.Mvvm", "EasyMicroservices.UI.Cores.Mvvm\EasyMicroservices.UI.Cores.Mvvm.csproj", "{301DB27A-4A96-4891-89BA-15FF9D6091B5}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "App", "App", "{0B34338E-D1A6-44EC-94AE-3D7A305E77E7}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BusinessLogic-Layer", "BusinessLogic-Layer", "{0042F7CD-62D1-4CCE-9BCC-1C7793C844EC}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UserInterface-Layer", "UserInterface-Layer", "{27B243BB-7AEF-43B1-8C5D-55698CFEBC3A}" 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 {301DB27A-4A96-4891-89BA-15FF9D6091B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {301DB27A-4A96-4891-89BA-15FF9D6091B5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {301DB27A-4A96-4891-89BA-15FF9D6091B5}.Debug|x64.ActiveCfg = Debug|x64 + {301DB27A-4A96-4891-89BA-15FF9D6091B5}.Debug|x64.Build.0 = Debug|x64 + {301DB27A-4A96-4891-89BA-15FF9D6091B5}.Debug|x86.ActiveCfg = Debug|x86 + {301DB27A-4A96-4891-89BA-15FF9D6091B5}.Debug|x86.Build.0 = Debug|x86 {301DB27A-4A96-4891-89BA-15FF9D6091B5}.Release|Any CPU.ActiveCfg = Release|Any CPU {301DB27A-4A96-4891-89BA-15FF9D6091B5}.Release|Any CPU.Build.0 = Release|Any CPU + {301DB27A-4A96-4891-89BA-15FF9D6091B5}.Release|x64.ActiveCfg = Release|x64 + {301DB27A-4A96-4891-89BA-15FF9D6091B5}.Release|x64.Build.0 = Release|x64 + {301DB27A-4A96-4891-89BA-15FF9D6091B5}.Release|x86.ActiveCfg = Release|x86 + {301DB27A-4A96-4891-89BA-15FF9D6091B5}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {301DB27A-4A96-4891-89BA-15FF9D6091B5} = {0B34338E-D1A6-44EC-94AE-3D7A305E77E7} + {301DB27A-4A96-4891-89BA-15FF9D6091B5} = {0042F7CD-62D1-4CCE-9BCC-1C7793C844EC} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {77EBEEBB-EB05-4329-BA01-C8E0B8EA5A08}