diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-10-18 11:36:44 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-10-18 11:36:44 +0300 |
| commit | 58762e977fe0fcd2340e36b36938cdaadf5302e9 (patch) | |
| tree | e6e02e7f4e25a6fb0e385c833954685bece771c0 /Software/Visual_Studio/MachineStudio | |
| parent | dbe2e256a3c5b5c1640d6cc55a051d26ce7432d9 (diff) | |
| download | Tango-58762e977fe0fcd2340e36b36938cdaadf5302e9.tar.gz Tango-58762e977fe0fcd2340e36b36938cdaadf5302e9.zip | |
Implemented main window last module loading.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio')
5 files changed, 42 insertions, 8 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs index 22ed1a33d..06d5d44c5 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs @@ -74,11 +74,16 @@ namespace Tango.MachineStudio.Common public bool UseExternalBridgeEmulator { get; set; } /// <summary> - /// Gets or sets the studio modules bounds. + /// Gets or sets the last bounds of modules open windows. /// </summary> public List<StudioModuleBounds> StudioModulesBounds { get; set; } /// <summary> + /// Gets or sets the last module that was opened in the main window. + /// </summary> + public String LastMainModuleName { get; set; } + + /// <summary> /// Initializes a new instance of the <see cref="MachineStudio"/> class. /// </summary> public MachineStudioSettings() 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 e6c687b92..8be7f486a 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -217,6 +217,10 @@ namespace Tango.MachineStudio.UI.StudioApplication }); } + var mainViewVM = TangoIOC.Default.GetInstance<MainViewVM>(); + + settings.LastMainModuleName = mainViewVM.CurrentModule != null ? mainViewVM.CurrentModule.Name : null; + try { SettingsManager.Default.Save(); 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 39f748ceb..4fb14ba47 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 @@ -591,7 +591,7 @@ copy /Y "$(SolutionDir)Referenced Assemblies\Microsoft.WITDataStore32.dll" "$(Ta </Target> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_BuildVersioningStyle="None.None.Increment.DeltaBaseYearDayOfYear" BuildVersion_UpdateFileVersion="True" BuildVersion_DetectChanges="True" BuildVersion_UseGlobalSettings="False" /> + <UserProperties BuildVersion_UseGlobalSettings="False" BuildVersion_DetectChanges="True" BuildVersion_UpdateFileVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.DeltaBaseYearDayOfYear" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file 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 bbd621e65..49a8ca807 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -66,6 +66,13 @@ namespace Tango.MachineStudio.UI.ViewModels set { _currentModule = value; RaisePropertyChangedAuto(); } } + private bool _isApplicationReady; + public bool IsApplicationReady + { + get { return _isApplicationReady; } + set { _isApplicationReady = value; RaisePropertyChangedAuto(); } + } + private bool _isModuleLoaded; /// <summary> /// Gets or sets a value indicating whether any module is loaded at the moment. @@ -651,9 +658,10 @@ namespace Tango.MachineStudio.UI.ViewModels m.IsLoaded = false; } + CurrentModule = module; + if (module != null) { - CurrentModule = module; CurrentModule.IsLoaded = true; IsModuleLoaded = true; @@ -868,14 +876,31 @@ namespace Tango.MachineStudio.UI.ViewModels public override void OnApplicationReady() { - foreach (var item in SettingsManager.Default.GetOrCreate<MachineStudioSettings>().StudioModulesBounds) + if (!IsApplicationReady) { - var module = StudioModuleLoader.AllModules.SingleOrDefault(x => x.Name == item.Name); + var settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>(); + + foreach (var item in settings.StudioModulesBounds) + { + var module = StudioModuleLoader.AllModules.SingleOrDefault(x => x.Name == item.Name); + + if (module != null && !module.InNewWindow) + { + OpenModuleInWindow(module, item.Bounds, item.State); + } + } - if (module != null && !module.InNewWindow) + if (settings.LastMainModuleName != null) { - OpenModuleInWindow(module, item.Bounds, item.State); + var m = StudioModuleLoader.UserModules.SingleOrDefault(x => x.Name == settings.LastMainModuleName); + + if (m != null) + { + StartModule(m); + } } + + IsApplicationReady = true; } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml index 977cdb9f5..7edfa50c6 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml @@ -412,7 +412,7 @@ <Grid Grid.Row="2"> <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto"> - <ItemsControl ItemsSource="{Binding StudioModuleLoader.UserModules}" Margin="10"> + <ItemsControl ItemsSource="{Binding StudioModuleLoader.UserModules}" Margin="10" IsEnabled="{Binding IsApplicationReady}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <WrapPanel IsItemsHost="True"></WrapPanel> |
