diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2021-08-22 12:43:58 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2021-08-22 12:43:58 +0300 |
| commit | 33b515e9151243281506cba38bff963dcd43d41d (patch) | |
| tree | 28ce24cb232f340e44e43c1ebec08e1e98b0da56 /Software/Visual_Studio/PPC/Tango.PPC.UI/Modules | |
| parent | 9de6ed771ef74d5fb4ba9d9353ca7a676921f0db (diff) | |
| download | Tango-33b515e9151243281506cba38bff963dcd43d41d.tar.gz Tango-33b515e9151243281506cba38bff963dcd43d41d.zip | |
Jobs module v2 creation and conditional loading.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/Modules')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/Modules/DefaultPPCModuleLoader.cs | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Modules/DefaultPPCModuleLoader.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Modules/DefaultPPCModuleLoader.cs index bbabed225..d0f6484ab 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Modules/DefaultPPCModuleLoader.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Modules/DefaultPPCModuleLoader.cs @@ -15,6 +15,7 @@ using Tango.PPC.Common; using Tango.PPC.Jobs; using System.Windows.Data; using Tango.Core.DI; +using Tango.Settings; namespace Tango.PPC.UI.Modules { @@ -84,11 +85,21 @@ namespace Tango.PPC.UI.Modules /// </summary> public void LoadModules() { + var settings = SettingsManager.Default.GetOrCreate<PPCSettings>(); + if (!_loaded) { //Preloaded - LogManager.Log(String.Format("Loading module '{0}'...", nameof(JobsModule))); - AllModules.Add(new JobsModule()); + if (settings.UseJobsModuleV2) + { + LogManager.Log(String.Format("Loading module '{0}'...", nameof(JobsV2Module))); + AllModules.Add(new JobsV2Module()); + } + else + { + LogManager.Log(String.Format("Loading module '{0}'...", nameof(JobsModule))); + AllModules.Add(new JobsModule()); + } //Preloaded AllModules.Clear(); @@ -129,6 +140,17 @@ namespace Tango.PPC.UI.Modules AllModules = AllModules.OrderBy(x => x.GetType().GetCustomAttribute<PPCModuleAttribute>().Index).ToObservableCollection(); + if (settings.UseJobsModuleV2) + { + var legacyJobsModule = AllModules.SingleOrDefault(x => x.GetType() == typeof(JobsModule)); + AllModules.Remove(legacyJobsModule); + } + else + { + var newJobsModule = AllModules.SingleOrDefault(x => x.GetType() == typeof(JobsV2Module)); + AllModules.Remove(newJobsModule); + } + UserModules.Clear(); if (_authenticationProvider.AuthenticationRequired && _authenticationProvider.CurrentUser != null) |
