private void btnOk_Click(object sender, EventArgs e) { userSettings = new UserSettings() { BeepOnError = chkBeepOnError.Checked, AllowBackspace = chkAllowBackspace.Checked, WordWrap = chkWordWrap.Checked, VisibleNewlines = chkVisibleNewlines.Checked, RemoveEndOfLineSpaces = chkRemoveEndOfLineSpaces.Checked, RemoveMultipleWhitespace = chkRemoveMultipleWhitespace.Checked, RememberLastImportedFile = chkRememberLastImportedFile.Checked, HideStatisticsWhileTyping = chkHideStatisticsWhileTyping.Checked, CountWhitespaceAsWordChars = chkCountWhitespaceAsWordChars.Checked, CountErrorsAsWordChars = chkCountErrorsAsWordChars.Checked, AskBeforeCloseDuringPractice = chkAskBeforeCloseDuringPractice.Checked, ShowCursorWhenPaused = chkShowCursorWhenPaused.Checked, PauseAfterElapsed = chkPauseAfterElapsed.Checked ? readInt(txtPauseAfterElapsed) : 0, }; }
private void openSettingsDialog() { dlgSettingsDialog.UserSettings = userSettings; if (dlgSettingsDialog.ShowDialog() == DialogResult.OK) { userSettings = dlgSettingsDialog.UserSettings; ImportedText.ExpandNewlines = userSettings.VisibleNewlines; displayWPM(); picTyping.WordWrap = userSettings.WordWrap; picTyping.Invalidate(); } dlgSettingsDialog.StartPosition = FormStartPosition.Manual; }
private void loadUserSettings() { userSettings = new UserSettings() { BeepOnError = Properties.Settings.Default.UserSettings_BeepOnError, AllowBackspace = Properties.Settings.Default.UserSettings_AllowBackspace, WordWrap = Properties.Settings.Default.UserSettings_WordWrap, VisibleNewlines = Properties.Settings.Default.UserSettings_VisibleNewlines, RemoveEndOfLineSpaces = Properties.Settings.Default.UserSettings_RemoveEndOfLineSpaces, RemoveMultipleWhitespace = Properties.Settings.Default.UserSettings_RemoveMultipleWhitespace, RememberLastImportedFile = Properties.Settings.Default.UserSettings_RememberLastImportedFile, HideStatisticsWhileTyping = Properties.Settings.Default.UserSettings_HideStatisticsWhileTyping, CountWhitespaceAsWordChars = Properties.Settings.Default.UserSettings_CountWhitespaceAsWordChars, CountErrorsAsWordChars = Properties.Settings.Default.UserSettings_CountErrorsAsWordChars, AskBeforeCloseDuringPractice = Properties.Settings.Default.UserSettings_AskBeforeCloseDuringPractice, ShowCursorWhenPaused = Properties.Settings.Default.UserSettings_ShowCursorWhenPaused, PauseAfterElapsed = Properties.Settings.Default.UserSettings_PauseAfterElapsed, }; LastImportedFile = userSettings.RememberLastImportedFile ? Properties.Settings.Default.LastImportedFile : ""; }