From de5700549a5fe01862f71d452f2abe4a74996605 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 15 Jul 2018 14:16:26 +0300 Subject: Implemented PPC twine animated gif. Sign out. Implemented TangoInject attribute 'When Available' mode! --- .../PPCApplication/DefaultPPCApplicationManager.cs | 39 +++++++++++++++------- 1 file changed, 27 insertions(+), 12 deletions(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs index 5f5fb4f7e..0fbef92a7 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs @@ -30,6 +30,7 @@ namespace Tango.PPC.UI.PPCApplication public class DefaultPPCApplicationManager : ExtendedObject, IPPCApplicationManager { private List _notifiedViewModels; + private IMachineProvider _machineProvider; /// /// Occurs when the application has started. @@ -63,6 +64,8 @@ namespace Tango.PPC.UI.PPCApplication /// public DefaultPPCApplicationManager(IMachineProvider machineProvider) { + _machineProvider = machineProvider; + if (!DesignMode) { _notifiedViewModels = new List(); @@ -115,20 +118,17 @@ namespace Tango.PPC.UI.PPCApplication { if (loader.UserModules.Count > 0) { - loader.UserModules.LastOrDefault().Initialized += (e, f) => + if (loader.UserModules.ToList().Exists(m => !m.IsInitialized)) { - foreach (var vm in TangoIOC.Default.GetAllInstancesByBase()) + loader.UserModules.LastOrDefault().Initialized += (e, f) => { - if (!_notifiedViewModels.Contains(vm)) - { - vm.OnApplicationStarted(); - _notifiedViewModels.Add(vm); - } - } - - ModulesInitialized?.Invoke(this, new EventArgs()); - machineProvider.Init(); - }; + FinalizeModuleInitialization(); + }; + } + else + { + FinalizeModuleInitialization(); + } } }; }); @@ -136,6 +136,21 @@ namespace Tango.PPC.UI.PPCApplication } } + private void FinalizeModuleInitialization() + { + foreach (var vm in TangoIOC.Default.GetAllInstancesByBase()) + { + if (!_notifiedViewModels.Contains(vm)) + { + vm.OnApplicationStarted(); + _notifiedViewModels.Add(vm); + } + } + + ModulesInitialized?.Invoke(this, new EventArgs()); + _machineProvider.Init(); + } + /// /// Shutdown the application. /// -- cgit v1.3.1