public static void SaveCurrentTool(LoadedSettings loadedSettings, ListBox toolsListBox, ToolStruct tool) { var currentTool = loadedSettings.Tools.First(t => t.ID == tool.ID); if (tool.ID == Guid.Empty) { return; } if (currentTool.Name != tool.Name) { currentTool.Name = tool.Name; } if (currentTool.FileLocation != tool.FileLocation) { currentTool.FileLocation = tool.FileLocation; } if (currentTool.HotKey != tool.HotKey) { currentTool.HotKey = tool.HotKey; } ListboxUtils.RepopulateListBox(false, toolsListBox, loadedSettings, tool.ID); ListboxUtils.SetCurrentOrderFromListBoxAndSave(false, toolsListBox, loadedSettings); MessageBox.Show($"{currentTool.Name} {Constants.Messages.SavedSuccessfully}", $"Tool {Constants.Messages.SavedSuccessfullyCaption}", MessageBoxButtons.OK, MessageBoxIcon.Information); }
public static void SaveCurrentEnvironment(LoadedSettings loadedSettings, ListBox environmentsListBox, EnvironmentStruct environment) { var currentEnvironment = loadedSettings.Environments.First(env => env.ID == environment.ID); if (environment.ID == Guid.Empty) { return; } if (currentEnvironment.Name != environment.Name) { currentEnvironment.Name = environment.Name; } if (currentEnvironment.SubkeyValue != environment.SubkeyValue) { currentEnvironment.SubkeyValue = environment.SubkeyValue; } if (currentEnvironment.HotKey != environment.HotKey) { currentEnvironment.HotKey = environment.HotKey; } if (currentEnvironment.IconLabel != environment.IconLabel) { currentEnvironment.IconLabel = environment.IconLabel; } if (currentEnvironment.IconTextColor != environment.IconTextColor) { currentEnvironment.IconTextColor = environment.IconTextColor; } if (currentEnvironment.IconBackgroundColor != environment.IconBackgroundColor) { currentEnvironment.IconBackgroundColor = environment.IconBackgroundColor; } if (currentEnvironment.LoadIcon != environment.LoadIcon) { currentEnvironment.LoadIcon = environment.LoadIcon; } if (currentEnvironment.IconFileLocation != environment.IconFileLocation) { currentEnvironment.IconFileLocation = environment.IconFileLocation; } if (currentEnvironment.DisplayOnMenu != environment.DisplayOnMenu) { currentEnvironment.DisplayOnMenu = environment.DisplayOnMenu; } ListboxUtils.RepopulateListBox(true, environmentsListBox, loadedSettings, environment.ID); ListboxUtils.SetCurrentOrderFromListBoxAndSave(true, environmentsListBox, loadedSettings); MessageBox.Show($"{currentEnvironment.Name} {Constants.Messages.SavedSuccessfully}", $"Environment {Constants.Messages.SavedSuccessfullyCaption}", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void RepopulateSelectedTabsListbox() { var env = tabControl.SelectedTab == tabEnvironments; var envGuid = string.IsNullOrEmpty(lblEnvCurrentEnvironmentGuid.Text) ? Guid.Empty : Guid.Parse(lblEnvCurrentEnvironmentGuid.Text); var toolGuid = string.IsNullOrEmpty(lblToolCurrentToolGuid.Text) ? Guid.Empty : Guid.Parse(lblToolCurrentToolGuid.Text); ListboxUtils.RepopulateListBox(env, env ? lstEnvAllEnvironments : lstToolAllTools, _loadedSettings, env ? envGuid : toolGuid); }