diff options
| author | Avi Levkovich <avi@twine-s.com> | 2017-12-19 12:28:20 +0200 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2017-12-19 12:28:20 +0200 |
| commit | 76aa983631df4fa5b16b170e2f6dd845c5ac9531 (patch) | |
| tree | 6b2b4d0776c54536ec07aabc6be94857dcee91fc /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs | |
| parent | 6bf71c81050b824398dc82ce4b69cdf71fb4a2f7 (diff) | |
| parent | b421701fd5cf000a16cab9b1fe9eda812ccce8c3 (diff) | |
| download | Tango-76aa983631df4fa5b16b170e2f6dd845c5ac9531.tar.gz Tango-76aa983631df4fa5b16b170e2f6dd845c5ac9531.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs new file mode 100644 index 000000000..b95a74a3e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -0,0 +1,53 @@ +using Microsoft.Practices.ServiceLocation; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +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; + +namespace Tango.MachineStudio.UI.StudioApplication +{ + public class DefaultStudioApplicationManager : IStudioApplicationManager + { + private INavigationManager _navigationManager; + + public DefaultStudioApplicationManager(INavigationManager navigationManager) + { + _navigationManager = navigationManager; + } + + public async void ShutDown() + { + _navigationManager.NavigateTo(NavigationView.ShutdownView); + + await Task.Factory.StartNew(async () => + { + + //Do Shutdown Procedures... + foreach (var vm in ServiceLocator.Current.GetAllInstancesByBase<IShutdownRequestBlocker>()) + { + var result = await vm.OnShutdownRequest(); + if (!result) + { + ThreadsHelper.InvokeUI(() => + { + _navigationManager.NavigateTo(NavigationView.MainView); + }); + return; + } + } + + Thread.Sleep(3000); + Environment.Exit(0); + + }); + } + } +} |
