mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-06 15:17:34 +00:00
Task Priority Changes
- added a new task priority for the four auto processes. - added the task priority selection to the global settings.
This commit is contained in:
parent
138e56878a
commit
fb936241c6
21 changed files with 412 additions and 64 deletions
|
|
@ -36,6 +36,7 @@ namespace ServerManagerTool
|
|||
public static readonly DependencyProperty DiscordBotLogLevelsProperty = DependencyProperty.Register(nameof(DiscordBotLogLevels), typeof(ComboBoxItemList), typeof(GlobalSettingsControl), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty DiscordBotWhitelistProperty = DependencyProperty.Register(nameof(DiscordBotWhitelist), typeof(List<DiscordBotWhitelistItem>), typeof(GlobalSettingsControl), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty RconMessageModesProperty = DependencyProperty.Register(nameof(RconMessageModes), typeof(ComboBoxItemList), typeof(GlobalSettingsControl), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty TaskPrioritiesProperty = DependencyProperty.Register(nameof(TaskPriorities), typeof(ComboBoxItemList), typeof(GlobalSettingsControl), new PropertyMetadata(null));
|
||||
|
||||
public GlobalSettingsControl()
|
||||
{
|
||||
|
|
@ -52,6 +53,7 @@ namespace ServerManagerTool
|
|||
PopulateWindowsStatesServerMonitorWindowComboBox();
|
||||
PopulateDiscordBotLogLevelsComboBox();
|
||||
PopulateRconMessageModesComboBox();
|
||||
PopulateTaskPrioritiesComboBox();
|
||||
|
||||
DiscordBotWhitelist = new List<DiscordBotWhitelistItem>();
|
||||
if (Config.DiscordBotWhitelist != null)
|
||||
|
|
@ -122,6 +124,12 @@ namespace ServerManagerTool
|
|||
set { SetValue(RconMessageModesProperty, value); }
|
||||
}
|
||||
|
||||
public ComboBoxItemList TaskPriorities
|
||||
{
|
||||
get { return (ComboBoxItemList)GetValue(TaskPrioritiesProperty); }
|
||||
set { SetValue(TaskPrioritiesProperty, value); }
|
||||
}
|
||||
|
||||
public void ApplyChangesToConfig()
|
||||
{
|
||||
if (Config.DiscordBotWhitelist is null)
|
||||
|
|
@ -396,6 +404,7 @@ namespace ServerManagerTool
|
|||
PopulateWindowsStatesMainWindowComboBox();
|
||||
PopulateWindowsStatesServerMonitorWindowComboBox();
|
||||
PopulateRconMessageModesComboBox();
|
||||
PopulateTaskPrioritiesComboBox();
|
||||
|
||||
App.Instance.OnResourceDictionaryChanged(Config.CultureName);
|
||||
}
|
||||
|
|
@ -557,6 +566,39 @@ namespace ServerManagerTool
|
|||
}
|
||||
}
|
||||
|
||||
private void PopulateTaskPrioritiesComboBox()
|
||||
{
|
||||
var selectedValueAutoBackup = this.TaskPriorityAutoBackupComboBox?.SelectedValue ?? Config.AutoBackup_TaskPriority;
|
||||
var selectedValueAutoUpdate = this.TaskPriorityAutoUpdateComboBox?.SelectedValue ?? Config.AutoUpdate_TaskPriority;
|
||||
var selectedValueAutoShutdown = this.TaskPriorityAutoShutdownComboBox?.SelectedValue ?? Config.AutoShutdown_TaskPriority;
|
||||
var selectedValueAutoStart = this.TaskPriorityAutoStartComboBox?.SelectedValue ?? Config.AutoStart_TaskPriority;
|
||||
var list = new ComboBoxItemList();
|
||||
|
||||
foreach (ProcessPriorityClass priority in Enum.GetValues(typeof(ProcessPriorityClass)))
|
||||
{
|
||||
var displayMember = _globalizer.GetResourceString($"TaskPriority_{priority}") ?? priority.ToString();
|
||||
list.Add(new Common.Model.ComboBoxItem(priority.ToString(), displayMember));
|
||||
}
|
||||
|
||||
this.TaskPriorities = list;
|
||||
if (this.TaskPriorityAutoBackupComboBox != null)
|
||||
{
|
||||
this.TaskPriorityAutoBackupComboBox.SelectedValue = selectedValueAutoBackup;
|
||||
}
|
||||
if (this.TaskPriorityAutoUpdateComboBox != null)
|
||||
{
|
||||
this.TaskPriorityAutoUpdateComboBox.SelectedValue = selectedValueAutoUpdate;
|
||||
}
|
||||
if (this.TaskPriorityAutoShutdownComboBox != null)
|
||||
{
|
||||
this.TaskPriorityAutoShutdownComboBox.SelectedValue = selectedValueAutoShutdown;
|
||||
}
|
||||
if (this.TaskPriorityAutoStartComboBox != null)
|
||||
{
|
||||
this.TaskPriorityAutoStartComboBox.SelectedValue = selectedValueAutoStart;
|
||||
}
|
||||
}
|
||||
|
||||
#region Discord Bot Whitelist
|
||||
private void AddDiscordBotWhitelist_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue