private void StationsSettingForm_Closing(object sender, System.ComponentModel.CancelEventArgs e) { // 放送局を追加し忘れていると思われる場合 if (stationNameTextBox.Text.Trim().Length != 0 && stationKindComboBox.Text.Trim().Length != 0) { // 追加するかを聞く DialogResult result = MessageBox.Show( stationNameTextBox.Text.Trim() + "を追加しますか?\n(" + stationNameTextBox.Text.Trim() + "はまだ追加されていません)", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (result == DialogResult.Yes) { CreateStation(stationKindComboBox.Text.Trim()); } } // 設定の書き込み StationList.SetStationList((Station[])alStationList.ToArray(typeof(Station))); try { UserSetting.SaveSetting(); } catch (IOException) { MessageBox.Show("設定ファイルが書き込めませんでした", "設定ファイル書き込みエラー"); } }
/// <summary> /// PocketLadio終了時の処理。 /// </summary> public static void ExitDisable() { // 設定ファイルの書き込み UserSetting.SaveSetting(); }
private void SettingForm_Closing(object sender, System.ComponentModel.CancelEventArgs e) { // 設定の書き込み if (playlistSaveLocalCheckBox.Checked == true) { UserSetting.PlayListSave = true; } else if (playlistSaveLocalCheckBox.Checked == false) { UserSetting.PlayListSave = false; } UserSetting.MediaPlayerPath = mediaPlayerPathTextBox.Text.Trim(); UserSetting.BrowserPath = browserPathTextBox.Text.Trim(); try { UserSetting.HeadlineTimerMillSecond = Convert.ToInt32(headlineTimerSecondNumericUpDown.Text) * 1000; } catch (ArgumentException) { ; } catch (FormatException) { ; } catch (OverflowException) { ; } if (headlineListBoxFontSizeCheckBox.Checked == true) { UserSetting.HeadlineListBoxFontSizeChange = true; } else if (headlineListBoxFontSizeCheckBox.Checked == false) { UserSetting.HeadlineListBoxFontSizeChange = false; } try { UserSetting.HeadlineListBoxFontSize = Convert.ToInt32(headlineListBoxFontSizeNumericUpDown.Text); } catch (ArgumentException) { ; } catch (FormatException) { ; } catch (OverflowException) { ; } if (proxyUnuseRadioButton.Checked == true) { UserSetting.ProxyUse = UserSetting.ProxyConnect.Unuse; } else if (proxyUseOsSettingRadioButton.Checked == true) { UserSetting.ProxyUse = UserSetting.ProxyConnect.OsSetting; } else if (proxyUseOriginalSettingRadioButton.Checked == true) { UserSetting.ProxyUse = UserSetting.ProxyConnect.OriginalSetting; } else { // ここに到達することはあり得ない Trace.Assert(false, "想定外の動作のため、終了します"); } UserSetting.ProxyServer = proxyServerTextBox.Text.Trim(); try { UserSetting.ProxyPort = int.Parse(proxyPortTextBox.Text.Trim()); } catch (ArgumentException) { ; } catch (FormatException) { ; } catch (OverflowException) { ; } try { UserSetting.SaveSetting(); } catch (IOException) { MessageBox.Show("設定ファイルが書き込めませんでした", "設定ファイル書き込みエラー"); } }