BlipFace.View.SettingsWindow.btnSave_Click C# (CSharp) Method

btnSave_Click() private method

private btnSave_Click ( object sender, RoutedEventArgs e ) : void
sender object
e System.Windows.RoutedEventArgs
return void
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (chbAutoLogon.IsChecked.HasValue)
            {
                Settings.Default.AutoLogon = chbAutoLogon.IsChecked.Value;
            }

            if (chbAutoStart.IsChecked.HasValue)
            {
                Settings.Default.AutoStart = chbAutoStart.IsChecked.Value;
                AutoStart.Current.EnabledThroughStartupMenu = chbAutoStart.IsChecked.Value;
            }

            if (chbAlwaysInTray.IsChecked.HasValue)
            {
                Settings.Default.AlwaysInTray = chbAlwaysInTray.IsChecked.Value;
            }

            if (chbMinimalizeToTray.IsChecked.HasValue)
            {
                Settings.Default.MinimalizeToTray = chbMinimalizeToTray.IsChecked.Value;
            }

            if (chbPlaySoundWhenNewStatus.IsChecked.HasValue)
            {
                Settings.Default.PlaySoundWhenNewStatus = chbPlaySoundWhenNewStatus.IsChecked.Value;
            }

            if (chbHotKeyEnabled.IsChecked.HasValue)
            {
                Settings.Default.HotKeyEnabled = chbHotKeyEnabled.IsChecked.Value;
            }

            System.Windows.Forms.KeysConverter keysConverter = new System.Windows.Forms.KeysConverter();
            Settings.Default.HotKey = (System.Windows.Forms.Keys)keysConverter.ConvertFromString(HotKeyComboBox.SelectedItem.ToString());

            Settings.Default.Save();
            Close();
        }