From de099bd3b50b8ea52b212b8d322626582c2648be Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 22 Apr 2018 13:35:22 +0300 Subject: Implemented new TangoIOC container & TangoMessenger. Got rid of MVVMLite libs ! Got rid of IShutdownRequestBlocker, IShutdownListener, IModuleRequestListener. Implemented IStudioViewModel & StudioViewModel. --- .../Tango.MachineStudio.MachineDesigner.csproj | 14 +------- .../ViewModelLocator.cs | 9 ++--- .../ViewModels/MainViewVM.cs | 28 ++++++--------- .../Tango.MachineStudio.MachineDesigner/app.config | 40 ++++++++++++++++++++++ .../packages.config | 2 +- 5 files changed, 55 insertions(+), 38 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj index c329685c6..b0d43c6df 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj @@ -34,15 +34,6 @@ ..\..\..\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll - - ..\..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.dll - - - ..\..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Extras.dll - - - ..\..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Platform.dll - ..\..\..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll @@ -52,16 +43,13 @@ ..\..\..\packages\MaterialDesignThemes.2.3.1.953\lib\net45\MaterialDesignThemes.Wpf.dll - - ..\..\..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll - ..\..\..\packages\SimpleValidator.0.6.1.0\lib\net40\SimpleValidator.dll - ..\..\..\packages\MahApps.Metro.1.5.0\lib\net45\System.Windows.Interactivity.dll + ..\..\..\packages\Expression.Blend.Sdk.1.0.2\lib\net45\System.Windows.Interactivity.dll diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModelLocator.cs index 66018e09c..f1f4d9d89 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModelLocator.cs @@ -1,6 +1,4 @@ -using GalaSoft.MvvmLight; -using GalaSoft.MvvmLight.Ioc; -using Microsoft.Practices.ServiceLocation; +using Tango.Core.DI; using Tango.MachineStudio.MachineDesigner.ViewModels; namespace Tango.MachineStudio.MachineDesigner @@ -16,15 +14,14 @@ namespace Tango.MachineStudio.MachineDesigner /// static ViewModelLocator() { - ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default); - SimpleIoc.Default.Register(); + TangoIOC.Default.Register(); } public static MainViewVM MainViewVM { get { - return ServiceLocator.Current.GetInstance(); + return TangoIOC.Default.GetInstance(); } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs index e8e7170b1..6a3b232d5 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs @@ -19,11 +19,11 @@ using Tango.BL; namespace Tango.MachineStudio.MachineDesigner.ViewModels { - public class MainViewVM : ViewModel, IModuleRequestListener + public class MainViewVM : StudioViewModel { private bool _isSaving; private INotificationProvider _notification; - + #region Properties @@ -156,8 +156,8 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels SaveCommand = new RelayCommand(Save, (x) => !_isSaving); AddIdsCommand = new RelayCommand(AddIds, (x) => !_isSaving && Configuration.IdsPacks.Count < 8); RemoveIdsCommand = new RelayCommand(RemoveIds, (x) => !_isSaving && SelectedIds != null); - SetVersionConfigurationCommand = new RelayCommand(SetVersionConfiguration,(x) => !_isSaving); - SetAsDefaultCommand = new RelayCommand(SetAsDefaultConfiguration,(x) => !_isSaving); + SetVersionConfigurationCommand = new RelayCommand(SetVersionConfiguration, (x) => !_isSaving); + SetAsDefaultCommand = new RelayCommand(SetAsDefaultConfiguration, (x) => !_isSaving); } #endregion @@ -615,7 +615,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels /// private void SetAsDefaultConfiguration() { - _notification.ShowModalDialog(async (vm) => + _notification.ShowModalDialog(async (vm) => { try { @@ -644,7 +644,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels _notification.ShowError(ex.Message); } - }, () => + }, () => { }); @@ -652,20 +652,12 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels #endregion - #region IModuleRequestListener + #region IStudioModuleVM - /// - /// Called when the request has been made. - /// - /// The module instance. - /// The arguments. - public void OnRequestModule(IStudioModule module, object args) + public override void OnModuleRequest(params object[] args) { - if (module is MachineDesignerModule) - { - SelectedMachine = Adapter.Machines.SingleOrDefault(x => x.Guid == (args as Machine).Guid); - } - } + SelectedMachine = Adapter.Machines.SingleOrDefault(x => x.Guid == (args[0] as Machine).Guid); + } #endregion } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/app.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/app.config index cacd4cd77..5d794b958 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/app.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/app.config @@ -6,6 +6,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/packages.config index aada4ebd7..59e34e36f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/packages.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/packages.config @@ -1,10 +1,10 @@  + - \ No newline at end of file -- cgit v1.3.1