diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-04-22 17:12:21 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-04-22 17:12:21 +0300 |
| commit | 1585f1c1ab1e01888e24260f6da0399d80b93828 (patch) | |
| tree | d01eb8860e6310793c8c1904ca146cf1902e6c31 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels | |
| parent | 829a1f93613c09782c4411431de5fb2b79b364d6 (diff) | |
| download | Tango-1585f1c1ab1e01888e24260f6da0399d80b93828.tar.gz Tango-1585f1c1ab1e01888e24260f6da0399d80b93828.zip | |
Added some logs to Module loading.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs | 15 |
1 files changed, 15 insertions, 0 deletions
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 25346e94b..2144983de 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -498,8 +498,12 @@ namespace Tango.MachineStudio.UI.ViewModels if (module != null) { + LogManager.Log(String.Format("Starting module '{0}'...", module.Name)); + if (!(MainView.Self as MainView).TransitionControl.Elements.ToList().Exists(x => x.GetType() == module.MainViewType)) { + LogManager.Log("Module was not initialized. Initializing..."); + FrameworkElement view = Activator.CreateInstance(module.MainViewType) as FrameworkElement; NavigationControl.SetNavigationName(view, module.Name); (MainView.Self as MainView).TransitionControl.Elements.Add(view); @@ -517,6 +521,8 @@ namespace Tango.MachineStudio.UI.ViewModels CurrentModule = module; CurrentModule.IsLoaded = true; IsModuleLoaded = true; + + LogManager.Log(String.Format("Navigating to module '{0}'...", module.Name)); (MainView.Self as MainView).TransitionControl.NavigateTo(module.Name); TangoIOC.Default.GetModuleViewModels(module).ToList().ForEach(x => x.OnNavigatedTo()); @@ -524,6 +530,7 @@ namespace Tango.MachineStudio.UI.ViewModels else { IsModuleLoaded = false; + LogManager.Log(String.Format("Navigating to Home...")); (MainView.Self as MainView).TransitionControl.NavigateTo("Home"); } } @@ -542,13 +549,17 @@ namespace Tango.MachineStudio.UI.ViewModels StartModule(null); + LogManager.Log(String.Format("Starting module '{0}' in new window...", module.Name)); + if (!(MainView.Self as MainView).TransitionControl.Elements.ToList().Exists(x => x.GetType() == module.MainViewType)) { + LogManager.Log("Module was not initialized. Initializing..."); FrameworkElement v = Activator.CreateInstance(module.MainViewType) as FrameworkElement; NavigationControl.SetNavigationName(v, module.Name); (MainView.Self as MainView).TransitionControl.Elements.Add(v); } + LogManager.Log("Detaching module view..."); var view = (MainView.Self as MainView).TransitionControl.GetAndDetach(module.Name); ModuleWindowVM vm = new ModuleWindowVM(module); @@ -556,12 +567,16 @@ namespace Tango.MachineStudio.UI.ViewModels window.Closing += (x, y) => { + LogManager.Log(String.Format("Closing module '{0}' on new window...", module.Name)); + window.grid.Children.Remove(view); module.InNewWindow = false; TangoIOC.Default.GetModuleViewModels(module).ToList().ForEach(v => v.OnNavigatedFrom()); }; window.Owner = MainWindow.Instance; + + LogManager.Log("Opening new window..."); window.Show(); TangoIOC.Default.GetModuleViewModels(module).ToList().ForEach(x => x.OnNavigatedTo()); |
