From 59ea707007fc62e7d5a4fbb4d8a7d175192668af Mon Sep 17 00:00:00 2001 From: Elias Fierke Date: Sat, 19 Sep 2026 12:58:29 +0200 Subject: [PATCH] [feat:] module enabling (default: none) --- MainWindow.axaml | 29 +++++++++++++--- MainWindow.axaml.cs | 84 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+), 5 deletions(-) diff --git a/MainWindow.axaml b/MainWindow.axaml index c7c2c33..26baf28 100644 --- a/MainWindow.axaml +++ b/MainWindow.axaml @@ -22,7 +22,7 @@ - + @@ -396,7 +396,7 @@ - + @@ -404,7 +404,7 @@ - + @@ -412,7 +412,7 @@ - + @@ -420,7 +420,15 @@ - + + + + + + + + @@ -540,6 +548,17 @@ + + + + + + + + + + diff --git a/MainWindow.axaml.cs b/MainWindow.axaml.cs index 4642944..af3cf31 100644 --- a/MainWindow.axaml.cs +++ b/MainWindow.axaml.cs @@ -85,8 +85,92 @@ public partial class MainWindow : Window { Logger.Log($"Error while doing wiki stuff: {ex.Message}", Logger.LogType.Error); } + + try + { + foreach(var module in Enum.GetValues()) + { + CheckBox b = new CheckBox + { + IsChecked = false + }; + b.Click += (object sender, RoutedEventArgs e) => { + RenewModuleSettings(module, b.IsChecked); + }; + + foreach(var conf in Settings._instance.moduleConfig.EnabledModules) + { + if(conf.Item1 == module) + { + b.IsChecked = true; + } + } + + Label l = new Label() + { + Content = module.ToString(), + }; + StpSettingsModules.Children.Add(new StackPanel() + { + Orientation = Avalonia.Layout.Orientation.Horizontal, + Children = {b,l} + }); + } + + foreach(var conf in Settings._instance.moduleConfig.EnabledModules) + { + Logger.Log($"Enabling module: {conf.Item1}"); + switch (conf.Item1) + { + case LCModule.Addressmanagement: + Addressmanagement.IsVisible = true; + break; + case LCModule.Pricemanagement: + Pricemanagement.IsVisible = true; + break; + case LCModule.Staffmanagement: + Staffmanagement.IsVisible = true; + break; + case LCModule.Financemanagement: + Financemanagement.IsVisible = true; + break; + case LCModule.Wiki: + Wiki.IsVisible = true; + break; + case LCModule.UnifiedEndpointManagement: + UnifiedEndpointManagement.IsVisible = true; + break; + default: + break; + } + } + + } catch (Exception ex) + { + Logger.Log($"Error while applying module configuration: {ex.Message}"); + } } + private void RenewModuleSettings(LCModule value, bool? enabled = true) + { + if (enabled == true) + { + Settings._instance.moduleConfig.EnabledModules.Add((value,false)); + } else + { + int index = -1; + foreach(var conf in Settings._instance.moduleConfig.EnabledModules) + { + if(conf.Item1 == value) + { + index = Settings._instance.moduleConfig.EnabledModules.IndexOf(conf); + } + } + if(index != -1) + Settings._instance.moduleConfig.EnabledModules.RemoveAt(index); + } + Settings.Save(); + } private async void StartAddressCheck(int addresSetID) { var progressWindow = new ProgressWindow();