diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-04-22 13:35:22 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-04-22 13:35:22 +0300 |
| commit | de099bd3b50b8ea52b212b8d322626582c2648be (patch) | |
| tree | eea98a7f7b073d6cf8ded47bddc3b3f3f5e7c430 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI | |
| parent | 8edd1a95962a5c1c2e73d15f209a9fb362ff884a (diff) | |
| download | Tango-de099bd3b50b8ea52b212b8d322626582c2648be.tar.gz Tango-de099bd3b50b8ea52b212b8d322626582c2648be.zip | |
Implemented new TangoIOC container & TangoMessenger.
Got rid of MVVMLite libs !
Got rid of IShutdownRequestBlocker, IShutdownListener, IModuleRequestListener.
Implemented IStudioViewModel & StudioViewModel.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI')
10 files changed, 81 insertions, 105 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs index 1334a349d..d9c64b9e3 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs @@ -12,9 +12,9 @@ using Tango.BL.Entities; using Tango.Logging; using Tango.MachineStudio.UI.Windows; using Tango.Settings; -using Microsoft.Practices.ServiceLocation; using Tango.MachineStudio.Common.EventLogging; using Tango.BL.Enumerations; +using Tango.Core.DI; namespace Tango.MachineStudio.UI { @@ -72,7 +72,7 @@ namespace Tango.MachineStudio.UI try { - var eventLogger = ServiceLocator.Current.GetInstance<IEventLogger>(); + var eventLogger = TangoIOC.Default.GetInstance<IEventLogger>(); if (eventLogger != null) { eventLogger.Log(e.Exception, "Application Crashed!"); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs index 8461a5d93..9901d3b80 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs @@ -1,5 +1,4 @@ using MahApps.Metro.Controls; -using Microsoft.Practices.ServiceLocation; using System; using System.Collections.Generic; using System.Linq; @@ -16,6 +15,7 @@ using System.Windows.Media.Animation; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using Tango.Core.DI; using Tango.Core.Helpers; using Tango.Logging; using Tango.MachineStudio.Common.StudioApplication; @@ -90,7 +90,7 @@ namespace Tango.MachineStudio.UI private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) { e.Cancel = true; - ServiceLocator.Current.GetInstance<IStudioApplicationManager>().ShutDown(); + TangoIOC.Default.GetInstance<IStudioApplicationManager>().ShutDown(); } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs index d7035b57b..4afddae69 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs @@ -1,5 +1,4 @@ -using GalaSoft.MvvmLight.Ioc; -using System; +using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs index 52602e6de..0bbcfd313 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -1,5 +1,4 @@ -using Microsoft.Practices.ServiceLocation; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -8,7 +7,6 @@ using System.Threading.Tasks; using Tango.Core.Helpers; using Tango.MachineStudio.Common.StudioApplication; using Tango.MachineStudio.Common.Navigation; -using GalaSoft.MvvmLight.Ioc; using System.Reflection; using System.Collections; using Tango.Core; @@ -20,6 +18,7 @@ using System.Windows; using Tango.Integration.Services; using Tango.MachineStudio.Common.EventLogging; using Tango.BL.Enumerations; +using Tango.Core.DI; namespace Tango.MachineStudio.UI.StudioApplication { @@ -136,7 +135,7 @@ namespace Tango.MachineStudio.UI.StudioApplication await Task.Factory.StartNew(async () => { //Do Shutdown Procedures... - foreach (var vm in ServiceLocator.Current.GetAllInstancesByBase<IShutdownRequestBlocker>()) + foreach (var vm in TangoIOC.Default.GetAllInstancesByBase<IStudioViewModel>()) { try { @@ -153,7 +152,7 @@ namespace Tango.MachineStudio.UI.StudioApplication } } - foreach (var vm in ServiceLocator.Current.GetAllInstancesByBase<IShutdownListener>()) + foreach (var vm in TangoIOC.Default.GetAllInstancesByBase<IStudioViewModel>()) { vm.OnShuttingDown(); } @@ -191,7 +190,7 @@ namespace Tango.MachineStudio.UI.StudioApplication LogManager.Log(ex, "Error disconnecting from machine."); } - var eventLogger = ServiceLocator.Current.GetInstance<IEventLogger>(); + var eventLogger = TangoIOC.Default.GetInstance<IEventLogger>(); if (eventLogger != null) { eventLogger.Log(EventTypes.ApplicationTerminated, "Application Terminated!"); @@ -210,18 +209,18 @@ namespace Tango.MachineStudio.UI.StudioApplication /// </summary> /// <param name="moduleName">Name of the module.</param> /// <param name="args">The arguments.</param> - public void RequestModule(string moduleName, object args) + public void RequestModule(string moduleName, params object[] args) { IStudioModule module = _moduleLoader.UserModules.SingleOrDefault(x => x.Name == moduleName); if (module != null) { - ServiceLocator.Current.GetInstance<ViewModels.MainViewVM>().StartModule(module); + TangoIOC.Default.GetInstance<ViewModels.MainViewVM>().StartModule(module); //Notify request listeners. - foreach (var vm in ServiceLocator.Current.GetAllInstancesByBase<IModuleRequestListener>()) + foreach (var vm in TangoIOC.Default.GetAllInstancesByBase<IStudioViewModel>()) { - vm.OnRequestModule(module, args); + vm.OnModuleRequest(module, args); } } else diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj index eb4139936..722d37d77 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj @@ -54,15 +54,6 @@ <Reference Include="FontAwesome.WPF, Version=4.7.0.37774, Culture=neutral, PublicKeyToken=0758b07a11a4f466, processorArchitecture=MSIL"> <HintPath>..\..\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll</HintPath> </Reference> - <Reference Include="GalaSoft.MvvmLight, Version=5.3.0.19026, Culture=neutral, PublicKeyToken=e7570ab207bcb616, processorArchitecture=MSIL"> - <HintPath>..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.dll</HintPath> - </Reference> - <Reference Include="GalaSoft.MvvmLight.Extras, Version=5.3.0.19032, Culture=neutral, PublicKeyToken=669f0b5e8f868abf, processorArchitecture=MSIL"> - <HintPath>..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Extras.dll</HintPath> - </Reference> - <Reference Include="GalaSoft.MvvmLight.Platform, Version=5.3.0.19032, Culture=neutral, PublicKeyToken=5f873c45e98af8a1, processorArchitecture=MSIL"> - <HintPath>..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Platform.dll</HintPath> - </Reference> <Reference Include="Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> <HintPath>..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll</HintPath> </Reference> @@ -78,9 +69,6 @@ <Reference Include="MaterialDesignThemes.Wpf, Version=2.3.1.953, Culture=neutral, processorArchitecture=MSIL"> <HintPath>..\..\packages\MaterialDesignThemes.2.3.1.953\lib\net45\MaterialDesignThemes.Wpf.dll</HintPath> </Reference> - <Reference Include="Microsoft.Practices.ServiceLocation, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> - <HintPath>..\..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll</HintPath> - </Reference> <Reference Include="SimpleValidator, Version=0.6.1.0, Culture=neutral, processorArchitecture=MSIL"> <HintPath>..\..\packages\SimpleValidator.0.6.1.0\lib\net40\SimpleValidator.dll</HintPath> </Reference> @@ -123,7 +111,7 @@ <Reference Include="System.Windows" /> <Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> - <HintPath>..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\System.Windows.Interactivity.dll</HintPath> + <HintPath>..\..\packages\Expression.Blend.Sdk.1.0.2\lib\net45\System.Windows.Interactivity.dll</HintPath> </Reference> <Reference Include="System.Xml" /> <Reference Include="Microsoft.CSharp" /> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs index fa3a38c5c..c4b8a1a59 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs @@ -1,7 +1,5 @@ -using GalaSoft.MvvmLight; -using GalaSoft.MvvmLight.Ioc; -using Microsoft.Practices.ServiceLocation; using System; +using Tango.Core.DI; using Tango.Integration.Services; using Tango.Logging; using Tango.MachineStudio.Common.Authentication; @@ -40,66 +38,63 @@ namespace Tango.MachineStudio.UI /// </summary> public ViewModelLocator() { - ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default); - ////if (ViewModelBase.IsInDesignModeStatic) ////{ //// // Create design time view services and models - //// SimpleIoc.Default.Register<IDataService, DesignDataService>(); + //// TangoIOC.Default.Register<IDataService, DesignDataService>(); ////} ////else ////{ //// // Create run time view services and models - //// SimpleIoc.Default.Register<IDataService, DataService>(); + //// TangoIOC.Default.Register<IDataService, DataService>(); ////} - SimpleIoc.Default.Unregister<INotificationProvider>(); - SimpleIoc.Default.Unregister<IAuthenticationProvider>(); - SimpleIoc.Default.Unregister<INavigationManager>(); - SimpleIoc.Default.Unregister<IStudioModuleLoader>(); - SimpleIoc.Default.Unregister<IStudioApplicationManager>(); - SimpleIoc.Default.Unregister<ExternalBridgeScanner>(); - SimpleIoc.Default.Unregister<IVideoCaptureProvider>(); - SimpleIoc.Default.Unregister<IDiagnosticsFrameProvider>(); - SimpleIoc.Default.Unregister<IEventLogger>(); - SimpleIoc.Default.Unregister<ISpeechProvider>(); - SimpleIoc.Default.Unregister<IHtmlPresenter>(); + TangoIOC.Default.Unregister<INotificationProvider>(); + TangoIOC.Default.Unregister<IAuthenticationProvider>(); + TangoIOC.Default.Unregister<INavigationManager>(); + TangoIOC.Default.Unregister<IStudioModuleLoader>(); + TangoIOC.Default.Unregister<IStudioApplicationManager>(); + TangoIOC.Default.Unregister<ExternalBridgeScanner>(); + TangoIOC.Default.Unregister<IVideoCaptureProvider>(); + TangoIOC.Default.Unregister<IDiagnosticsFrameProvider>(); + TangoIOC.Default.Unregister<IEventLogger>(); + TangoIOC.Default.Unregister<ISpeechProvider>(); + TangoIOC.Default.Unregister<IHtmlPresenter>(); - SimpleIoc.Default.Register<INotificationProvider, DefaultNotificationProvider>(); - SimpleIoc.Default.Register<IAuthenticationProvider, DefaultAuthenticationProvider>(); - SimpleIoc.Default.Register<INavigationManager, DefaultNavigationManager>(); - SimpleIoc.Default.Register<IStudioModuleLoader, DefaultStudioModuleLoader>(); - SimpleIoc.Default.Register<IStudioApplicationManager, DefaultStudioApplicationManager>(); - SimpleIoc.Default.Register<ExternalBridgeScanner, ExternalBridgeScanner>(); - SimpleIoc.Default.Register<ExternalBridgeScanner, ExternalBridgeScanner>(); - SimpleIoc.Default.Register<IVideoCaptureProvider, DefaultVideoCaptureProvider>(); - SimpleIoc.Default.Register<IDiagnosticsFrameProvider, DefaultDiagnosticsFrameProvider>(); - SimpleIoc.Default.Register<IEventLogger, DefaultEventLogger>(); - SimpleIoc.Default.Register<ISpeechProvider, DefaultSpeechProvider>(); - SimpleIoc.Default.Register<IHtmlPresenter, DefaultHtmlPresenter>(); + TangoIOC.Default.Register<INotificationProvider, DefaultNotificationProvider>(); + TangoIOC.Default.Register<IAuthenticationProvider, DefaultAuthenticationProvider>(); + TangoIOC.Default.Register<INavigationManager, DefaultNavigationManager>(); + TangoIOC.Default.Register<IStudioModuleLoader, DefaultStudioModuleLoader>(); + TangoIOC.Default.Register<IStudioApplicationManager, DefaultStudioApplicationManager>(); + TangoIOC.Default.Register<ExternalBridgeScanner, ExternalBridgeScanner>(); + TangoIOC.Default.Register<IVideoCaptureProvider, DefaultVideoCaptureProvider>(); + TangoIOC.Default.Register<IDiagnosticsFrameProvider, DefaultDiagnosticsFrameProvider>(); + TangoIOC.Default.Register<IEventLogger, DefaultEventLogger>(); + TangoIOC.Default.Register<ISpeechProvider, DefaultSpeechProvider>(); + TangoIOC.Default.Register<IHtmlPresenter, DefaultHtmlPresenter>(); - SimpleIoc.Default.Register<MainViewVM>(); - SimpleIoc.Default.Register<LoadingViewVM>(); - SimpleIoc.Default.Register<ShutdownViewVM>(); - SimpleIoc.Default.Register<LoginViewVM>(); - SimpleIoc.Default.Register<MachineConnectionViewVM>(); - SimpleIoc.Default.Register<ConnectedMachineViewVM>(); - SimpleIoc.Default.Register<MachineLoginViewVM>(); - SimpleIoc.Default.Register<UpdateViewVM>(); + TangoIOC.Default.Register<MainViewVM>(); + TangoIOC.Default.Register<LoadingViewVM>(); + TangoIOC.Default.Register<ShutdownViewVM>(); + TangoIOC.Default.Register<LoginViewVM>(); + TangoIOC.Default.Register<MachineConnectionViewVM>(); + TangoIOC.Default.Register<ConnectedMachineViewVM>(); + TangoIOC.Default.Register<MachineLoginViewVM>(); + TangoIOC.Default.Register<UpdateViewVM>(); //Register View (Supervising Controller Pattern). - if (!ViewModelBase.IsInDesignModeStatic) - { - LogManager.Log(String.Format("Registering Supervising Controller {0}...", nameof(IMainView))); - SimpleIoc.Default.Register(() => (IMainView)MainView.Self); - } + //if (!ViewModelBase.IsInDesignModeStatic) + //{ + // LogManager.Log(String.Format("Registering Supervising Controller {0}...", nameof(IMainView))); + // TangoIOC.Default.Register(() => (IMainView)MainView.Self); + //} } public MainViewVM MainViewVM { get { - return ServiceLocator.Current.GetInstance<MainViewVM>(); + return TangoIOC.Default.GetInstance<MainViewVM>(); } } @@ -107,7 +102,7 @@ namespace Tango.MachineStudio.UI { get { - return ServiceLocator.Current.GetInstance<LoadingViewVM>(); + return TangoIOC.Default.GetInstance<LoadingViewVM>(); } } @@ -115,7 +110,7 @@ namespace Tango.MachineStudio.UI { get { - return ServiceLocator.Current.GetInstance<ShutdownViewVM>(); + return TangoIOC.Default.GetInstance<ShutdownViewVM>(); } } @@ -123,7 +118,7 @@ namespace Tango.MachineStudio.UI { get { - return ServiceLocator.Current.GetInstance<LoginViewVM>(); + return TangoIOC.Default.GetInstance<LoginViewVM>(); } } @@ -131,7 +126,7 @@ namespace Tango.MachineStudio.UI { get { - return ServiceLocator.Current.GetInstance<MachineConnectionViewVM>(); + return TangoIOC.Default.GetInstance<MachineConnectionViewVM>(); } } @@ -139,7 +134,7 @@ namespace Tango.MachineStudio.UI { get { - return ServiceLocator.Current.GetInstance<ConnectedMachineViewVM>(); + return TangoIOC.Default.GetInstance<ConnectedMachineViewVM>(); } } @@ -147,7 +142,7 @@ namespace Tango.MachineStudio.UI { get { - return ServiceLocator.Current.GetInstance<MachineLoginViewVM>(); + return TangoIOC.Default.GetInstance<MachineLoginViewVM>(); } } @@ -155,7 +150,7 @@ namespace Tango.MachineStudio.UI { get { - return ServiceLocator.Current.GetInstance<UpdateViewVM>(); + return TangoIOC.Default.GetInstance<UpdateViewVM>(); } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs index b97825d34..25346e94b 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -1,6 +1,4 @@ -using GalaSoft.MvvmLight.Ioc; -using GalaSoft.MvvmLight.Messaging; -using System; +using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; @@ -14,6 +12,7 @@ using System.Windows.Controls; using System.Windows.Media; using Tango.BL.Entities; using Tango.Core.Commands; +using Tango.Core.DI; using Tango.Integration.Services; using Tango.Logging; using Tango.MachineStudio.Common; @@ -45,7 +44,7 @@ namespace Tango.MachineStudio.UI.ViewModels /// Represents the Machine Studio main view, view model. /// </summary> /// <seealso cref="Tango.SharedUI.ViewModel{Tango.MachineStudio.UI.SupervisingController.IMainView}" /> - public class MainViewVM : ViewModel<IMainView> + public class MainViewVM : ViewModel { private IStudioModule _currentModule; private INavigationManager _navigation; @@ -240,7 +239,6 @@ namespace Tango.MachineStudio.UI.ViewModels /// <param name="applicationManager">The application manager.</param> /// <param name="navigationManager">The navigation manager.</param> public MainViewVM( - IMainView view, IAuthenticationProvider authenticationProvider, IStudioModuleLoader studioModuleLoader, INotificationProvider notificationProvider, @@ -249,7 +247,7 @@ namespace Tango.MachineStudio.UI.ViewModels IEventLogger eventLogger, IDiagnosticsFrameProvider frameProvider, ISpeechProvider speechProvider, - IHtmlPresenter htmlPresenter) : base(view) + IHtmlPresenter htmlPresenter) : base() { _eventLogger = eventLogger; _navigation = navigationManager; @@ -508,9 +506,10 @@ namespace Tango.MachineStudio.UI.ViewModels } } - foreach (var m in StudioModuleLoader.AllModules.Where(x => x != module)) + foreach (var m in StudioModuleLoader.AllModules.Where(x => x != module && !x.InNewWindow)) { m.IsLoaded = false; + TangoIOC.Default.GetModuleViewModels(m).ToList().ForEach(x => x.OnNavigatedFrom()); } if (module != null) @@ -519,6 +518,8 @@ namespace Tango.MachineStudio.UI.ViewModels CurrentModule.IsLoaded = true; IsModuleLoaded = true; (MainView.Self as MainView).TransitionControl.NavigateTo(module.Name); + + TangoIOC.Default.GetModuleViewModels(module).ToList().ForEach(x => x.OnNavigatedTo()); } else { @@ -528,14 +529,6 @@ namespace Tango.MachineStudio.UI.ViewModels } /// <summary> - /// Called when the <see cref="T:Tango.SharedUI.IView" /> is loaded and attached. - /// </summary> - protected override void OnViewAttached() - { - base.OnViewAttached(); - } - - /// <summary> /// Opens the module in a new window. /// </summary> /// <param name="module">The module.</param> @@ -545,10 +538,10 @@ namespace Tango.MachineStudio.UI.ViewModels try { - StartModule(null); - module.InNewWindow = true; + StartModule(null); + if (!(MainView.Self as MainView).TransitionControl.Elements.ToList().Exists(x => x.GetType() == module.MainViewType)) { FrameworkElement v = Activator.CreateInstance(module.MainViewType) as FrameworkElement; @@ -565,11 +558,14 @@ namespace Tango.MachineStudio.UI.ViewModels { window.grid.Children.Remove(view); module.InNewWindow = false; + TangoIOC.Default.GetModuleViewModels(module).ToList().ForEach(v => v.OnNavigatedFrom()); }; window.Owner = MainWindow.Instance; window.Show(); + TangoIOC.Default.GetModuleViewModels(module).ToList().ForEach(x => x.OnNavigatedTo()); + (_applicationManager as DefaultStudioApplicationManager).RegisterOpenedWindow(window); } catch (Exception ex) diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs index ab4fd8e0b..0f6ec8b98 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs @@ -1,6 +1,5 @@ using FluentFTP; using Ionic.Zip; -using Microsoft.Practices.ServiceLocation; using System; using System.Collections.Generic; using System.Diagnostics; @@ -12,6 +11,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using Tango.Core.Commands; +using Tango.Core.DI; using Tango.Core.Helpers; using Tango.Logging; using Tango.MachineStudio.Common.Authentication; @@ -256,7 +256,7 @@ namespace Tango.MachineStudio.UI.ViewModels } } - ServiceLocator.Current.GetInstance<MainViewVM>().DisableCheckForUpdates = true; + TangoIOC.Default.GetInstance<MainViewVM>().DisableCheckForUpdates = true; Status = UpdateStatus.UpdateCompleted; } catch (Exception ex) diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml.cs index df1f97f23..1e894f3f2 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml.cs @@ -1,5 +1,4 @@ -using Microsoft.Practices.ServiceLocation; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -27,6 +26,7 @@ using Tango.Core.Helpers; using Tango.SharedUI.Helpers; using Tango.Logging; using static Tango.SharedUI.Controls.NavigationControl; +using Tango.Core.DI; namespace Tango.MachineStudio.UI.Views { @@ -41,7 +41,7 @@ namespace Tango.MachineStudio.UI.Views { InitializeComponent(); - _loader = ServiceLocator.Current.GetInstance<IStudioModuleLoader>() as DefaultStudioModuleLoader; + _loader = TangoIOC.Default.GetInstance<IStudioModuleLoader>() as DefaultStudioModuleLoader; _loader.ModulesLoaded += Loader_ModulesLoaded; } @@ -51,7 +51,7 @@ namespace Tango.MachineStudio.UI.Views { LogManager.Default.Log("Loading modules views..."); - var item = ServiceLocator.Current.GetInstance<INotificationProvider>().PushTaskItem("Loading Modules..."); + var item = TangoIOC.Default.GetInstance<INotificationProvider>().PushTaskItem("Loading Modules..."); var modules = _loader.UserModules.ToList(); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/packages.config b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/packages.config index 5dcc330a7..9568f9f90 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/packages.config +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/packages.config @@ -3,6 +3,7 @@ <package id="CommonServiceLocator" version="1.3" targetFramework="net46" /> <package id="Dragablz" version="0.0.3.197" targetFramework="net46" /> <package id="EntityFramework" version="6.0.0" targetFramework="net46" /> + <package id="Expression.Blend.Sdk" version="1.0.2" targetFramework="net46" /> <package id="FluentFTP" version="19.1.2" targetFramework="net46" /> <package id="FontAwesome.WPF" version="4.7.0.9" targetFramework="net46" /> <package id="Google.Protobuf" version="3.4.1" targetFramework="net46" /> @@ -10,8 +11,6 @@ <package id="MahApps.Metro" version="1.5.0" targetFramework="net46" /> <package id="MaterialDesignColors" version="1.1.2" targetFramework="net46" /> <package id="MaterialDesignThemes" version="2.3.1.953" targetFramework="net46" /> - <package id="MvvmLight" version="5.3.0.0" targetFramework="net46" /> - <package id="MvvmLightLibs" version="5.3.0.0" targetFramework="net46" /> <package id="SimpleValidator" version="0.6.1.0" targetFramework="net46" /> <package id="System.Data.SQLite" version="1.0.106.0" targetFramework="net46" /> <package id="System.Data.SQLite.Core" version="1.0.106.0" targetFramework="net46" /> |
