Пример #1
0
        private void SaveCurrentToConfig(string layoutName)
        {
            // TODO: better input of layout names
            // TODO: verify with user when re-using a layout name: it will overwrite the existing settings

            var processWindows = _desktopWindowUtil.ListWindows();
            var selector       = _dialogFactory.Create(
                processWindows,
                new[]
            {
                nameof(ProcessWindow.ProcessName),
                nameof(ProcessWindow.WindowTitle),
                nameof(ProcessWindow.Position)
            });
            var selectorResult = selector.Prompt();

            if (selectorResult.Result == DialogResult.Cancel)
            {
                return;
            }
            processWindows = selectorResult.SelectedItems;

            RemoveAllAppLayoutSectionsFor(layoutName);
            AddAppLayoutSectionsFor(layoutName, processWindows);
            _config.Persist();
        }
Пример #2
0
        private void OnLayoutRestored(string layout)
        {
            var existing = _config.GetValue(Sections.GENERAL, Keys.LAST_LAYOUT);

            _config.SetValue(Sections.GENERAL, Keys.LAST_LAYOUT, layout);
            _config.Persist();
            if (existing == layout)
            {
                return;
            }

            _trayIcon.ShowBalloonTipFor(
                10000,
                "Tip",
                $"The layout '{layout}' can be quickly restored by double-clicking the Ghoul icon",
                ToolTipIcon.Info
                );
        }
Пример #3
0
        private void SaveCurrentConfigButton_Click(object sender, EventArgs e)
        {
            if (_loadedConfig is null)
            {
                MessageBox.Show("Please load a config file first!");
                return;
            }

            if (!(ColorList.SelectedItem is ColorInfo selected))
            {
                MessageBox.Show("Please select a color first");
                return;
            }

            _loadedConfig["colors"]["FavoriteColor"] = selected.Name;
            // will write out the file to the same filename as where it was loaded from
            _loadedConfig.Persist();

            MessageBox.Show("Please re-load configuration to see changes above");
        }