[feat:] module enabling (default: none)
This commit is contained in:
@@ -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<LCModule>())
|
||||
{
|
||||
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();
|
||||
|
||||
Reference in New Issue
Block a user