public AdvancedSettings() { InitializeComponent(); actionFolderPath.KeyDown += new KeyEventHandler(FreakingStopDingSoundNoHandle); actionFileExtension.KeyDown += new KeyEventHandler(FreakingStopDingSound); void FreakingStopDingSound(Object o, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { e.Handled = true; e.SuppressKeyPress = true; } } void FreakingStopDingSoundNoHandle(Object o, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { e.SuppressKeyPress = true; e.Handled = true; MainProgram.SetCheckFolder(actionFolderPath.Text); } } //actionFolderPath.KeyDown += delegate { pathChanged(); }; //actionFolderPath.KeyUp += delegate { pathChanged(); }; /*void pathChanged() { * MainProgram.SetCheckFolder(actionFolderPath.Text); * actionFolderPath.Text = MainProgram.CheckPath(); * }*/ actionFileExtension.KeyDown += delegate { MainProgram.SetCheckExtension(actionFileExtension.Text); }; actionFileExtension.KeyUp += delegate { MainProgram.SetCheckExtension(actionFileExtension.Text); }; actionFolderPath.Text = MainProgram.CheckPath(); actionFileExtension.Text = Properties.Settings.Default.ActionFileExtension; mainPanel.Click += delegate { mainPanel.Focus(); }; actionFolderPath.GotFocus += delegate { if (!hasUnfocused) { mainPanel.Focus(); hasUnfocused = true; } }; //Fixes it being auto-foxused Text = Translator.__("window_name", "advanced_settings"); foreach (Control x in this.Controls) { Translator.TranslateWinForms("advanced_settings", x.Controls); } }
public SettingsForm() { InitializeComponent(); versionInfo.Text = "|Version " + MainProgram.softwareVersion; computerName.KeyDown += new KeyEventHandler(FreakingStopDingSound); fileEditedMargin.KeyDown += new KeyEventHandler(FreakingStopDingSound); fileReadDelay.KeyDown += new KeyEventHandler(FreakingStopDingSound); void FreakingStopDingSound(Object o, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { e.Handled = true; e.SuppressKeyPress = true; } } //Set values startWithWindows.Checked = Properties.Settings.Default.StartWithWindows; checkUpdates.Checked = Properties.Settings.Default.CheckForUpdates; betaProgram.Checked = Properties.Settings.Default.BetaProgram; warnDeletion.Checked = Properties.Settings.Default.WarnWhenDeletingManyFiles; defaultComputer.Checked = Properties.Settings.Default.DefaultComputer; computerName.Text = Properties.Settings.Default.ComputerName; fileEditedMargin.Value = (decimal)Properties.Settings.Default.FileEditedMargin; fileReadDelay.Value = (decimal)Properties.Settings.Default.FileReadDelay; maxDeleteFiles.Value = Properties.Settings.Default.MaxDeleteFiles; maxDeleteFiles.Enabled = warnDeletion.Checked; infoTooltip.SetToolTip(betaProgram, "Receive updates on new beta versions (often unstable, experimental builds)"); mainPanel.Click += delegate { mainPanel.Focus(); }; //On change //Has to be down & up, otherwise the last character isn't appended for some reason computerName.KeyDown += delegate { Properties.Settings.Default.ComputerName = computerName.Text; Properties.Settings.Default.Save(); }; computerName.KeyUp += delegate { Properties.Settings.Default.ComputerName = computerName.Text; Properties.Settings.Default.Save(); }; fileEditedMargin.ValueChanged += delegate { Properties.Settings.Default.FileEditedMargin = (float)fileEditedMargin.Value; Properties.Settings.Default.Save(); }; fileReadDelay.ValueChanged += delegate { Properties.Settings.Default.FileReadDelay = (float)fileReadDelay.Value; Properties.Settings.Default.Save(); }; maxDeleteFiles.ValueChanged += delegate { Properties.Settings.Default.MaxDeleteFiles = (int)maxDeleteFiles.Value; Properties.Settings.Default.Save(); }; /* Translations */ int i = 0; string activeLanguage = Properties.Settings.Default.ActiveLanguage; foreach (string item in Translator.languagesArray) { programLanguage.Items.Add(item); if (activeLanguage == item) { programLanguage.SelectedIndex = i; } ++i; } Text = Translator.__("window_name", "settings"); foreach (Control x in this.Controls) { Translator.TranslateWinForms("settings", x.Controls); } }