Example #1
0
        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);
        }
Example #2
0
        private void removeButton_Click(object sender, EventArgs e)
        {
            var env = tabControl.SelectedTab == tabEnvironments;

            ListboxUtils.RemoveListBoxItem(env,
                                           env ? lstEnvAllEnvironments : lstToolAllTools,
                                           _loadedSettings,
                                           env ? lblEnvCurrentEnvironmentGuid.Text : lblToolCurrentToolGuid.Text);
            if (env)
            {
                if (_allowFeatureUsageLogging)
                {
                    ExceptionlessClient.Default.SubmitFeatureUsage(Constants.FeatureUsages.EnvironmentRemoved);
                }
                ClearEnvironmentFields();
            }
            else
            {
                if (_allowFeatureUsageLogging)
                {
                    ExceptionlessClient.Default.SubmitFeatureUsage(Constants.FeatureUsages.ToolRemoved);
                }
                ClearToolFields();
            }
            RepopulateSelectedTabsListbox();
        }
Example #3
0
        private void moveDownButton_Click(object sender, EventArgs e)
        {
            var env = tabControl.SelectedTab == tabEnvironments;

            TurnOffListEventHandlers();
            ListboxUtils.MoveItem(1, env, env ? lstEnvAllEnvironments : lstToolAllTools, _loadedSettings);
            TurnOnListEventHandlers();
        }
Example #4
0
        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);
        }
Example #5
0
        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);
        }