Пример #1
0
        private void Apply_Click(object sender, EventArgs e)
        {
            Properties.Settings.Default.StartIcon    = StartupCheckboxList.GetItemChecked(StartIconIndex);
            Properties.Settings.Default.StartFreenet = StartupCheckboxList.GetItemChecked(StartFreenetIndex);

            Properties.Settings.Default.UseBrowser = (string)BrowserChoice.SelectedItem;

            Properties.Settings.Default.ShowSlowOpenTip = SlowStartOption.Checked;

            Properties.Settings.Default.LogLevel = LogLevelChoice.Text;

            Properties.Settings.Default.CustomLocation = CustomLocationDisplay.Text;

            Properties.Settings.Default.Save();

            foreach (var rule in LogManager.Configuration.LoggingRules)
            {
                ChangeRuleMinLevel(rule, LogLevel.FromString(LogLevelChoice.Text));
            }

            if (Properties.Settings.Default.StartIcon)
            {
                // Start Freenet or just the icon.
                SetStartupArguments(Properties.Settings.Default.StartFreenet ? "-start" : "");
            }
            else if (Properties.Settings.Default.StartFreenet)
            {
                // Just start Freenet.
                SetStartupArguments("-start -hide");
            }
            else
            {
                // Do not start.
                SetStartupArguments(null);
            }

            if (_initialCustomLocation != CustomLocationDisplay.Text)
            {
                // TODO: Reload config without restart? What would be the difference?
                Application.Restart();
            }

            Close();
        }