private void cmdOk_Click(object sender, EventArgs e) { Properties.Settings.Default.OutputFolder = string.IsNullOrEmpty(txtFolder.Text) ? Common.DefaultPath : txtFolder.Text; Properties.Settings.Default.ShowInfoOnStartup = chkShowInfoAtStartup.Checked; Properties.Settings.Default.EnableSound = chkSoundNotification.Checked; Properties.Settings.Default.SoundFile = txtSound.Text; Properties.Settings.Default.EnableShortcuts = chkShortcutsEnabled.Checked; Properties.Settings.Default.ImageFormat = Common.GetCurrentFormat(ddlImageFormats); Properties.Settings.Default.ExecuteAfterCapture = chkExecuteAfterCapture.Checked; Properties.Settings.Default.ExecuteAfterCapturePlugin = ddlPlugins.Items[ddlPlugins.SelectedIndex].ToString(); Properties.Settings.Default.PromptToSave = chkPromptToSave.Checked; var keyboardMapper = keyboardProperties.SelectedObject as KeyboardMapper; Properties.Settings.Default.Shortcuts = Utilities.Serialize <KeyboardMapper>(keyboardMapper); Properties.Settings.Default.IncludeCursor = chkIncludeCursor.Checked; Properties.Settings.Default.StartWithWindows = chkStartsWithWindows.Checked; Properties.Settings.Default.FilenameTemplate = string.IsNullOrEmpty(txtFileNameTemplate.Text) ? Constants.DEFAULT_TEMPLATE : txtFileNameTemplate.Text; Properties.Settings.Default.JpegQuality = tbjpgQuality.Value; Properties.Settings.Default.Save(); KeyboardMapper.UnregisterHotKeys(this); RegisterHotKeys(keyboardMapper); Close(); }
private void frmSettings_FormClosing(object sender, FormClosingEventArgs e) { if (e.CloseReason == CloseReason.UserClosing) { WindowState = FormWindowState.Minimized; e.Cancel = true; } else { KeyboardMapper.UnregisterHotKeys(this); e.Cancel = false; captureItSysTrayIcon.Dispose(); } }