diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-09-17 16:06:27 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-09-17 16:06:27 +0300 |
| commit | 28de564b35207886d181e4a3870f70c3bde04c3d (patch) | |
| tree | 13e20b49201da1fe544b6a218e87d2739fe11da3 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication | |
| parent | 936f105cf65f1efa7b27cea08080c183f2679568 (diff) | |
| download | Tango-28de564b35207886d181e4a3870f70c3bde04c3d.tar.gz Tango-28de564b35207886d181e4a3870f70c3bde04c3d.zip | |
Implemented keep modules windows states and bounds after restart.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs | 33 |
1 files changed, 28 insertions, 5 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 index 29bb459ee..8eff9ea4e 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -21,6 +21,7 @@ using Tango.BL.Enumerations; using Tango.Core.DI; using Tango.BL.Entities; using Tango.BL; +using Tango.MachineStudio.UI.ViewModels; namespace Tango.MachineStudio.UI.StudioApplication { @@ -45,7 +46,7 @@ namespace Tango.MachineStudio.UI.StudioApplication _navigationManager = navigationManager; _openedWindows = new List<Window>(); - Application.Current.MainWindow.ContentRendered += (_, __) => + Application.Current.MainWindow.ContentRendered += (_, __) => { TangoIOC.Default.GetAllInstancesByBase<IStudioViewModel>().ToList().ForEach(x => x.OnApplicationStarted()); }; @@ -150,8 +151,8 @@ namespace Tango.MachineStudio.UI.StudioApplication await Task.Factory.StartNew(async () => { - //Do Shutdown Procedures... - foreach (var vm in TangoIOC.Default.GetAllInstancesByBase<IStudioViewModel>()) + //Do Shutdown Procedures... + foreach (var vm in TangoIOC.Default.GetAllInstancesByBase<IStudioViewModel>()) { try { @@ -173,7 +174,29 @@ namespace Tango.MachineStudio.UI.StudioApplication vm.OnShuttingDown(); } - SettingsManager.Default.GetOrCreate<MachineStudioSettings>().LastBounds = r; + + var settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>(); + settings.LastBounds = r; + settings.StudioModulesBounds.Clear(); + + + foreach (var window in _openedWindows.OfType<Windows.ModuleWindow>()) + { + window.Invoke(() => + { + var context = window.ModuleContext; + + if (context != null) + { + settings.StudioModulesBounds.Add(new MachineStudioSettings.StudioModuleBounds() + { + Bounds = window.RestoreBounds, + State = window.WindowState, + Name = context.Module.Name, + }); + } + }); + } try { @@ -224,7 +247,7 @@ namespace Tango.MachineStudio.UI.StudioApplication catch (Exception ex) { IsShuttingDown = false; - LogManager.Log(ex,"An error occurred while shutting down machine studio."); + LogManager.Log(ex, "An error occurred while shutting down machine studio."); } } |
