/// <summary> /// ショートカットのデフォルト設定読み込み /// </summary> private void LoadDefaultSettings() { settings = new ShortcutSettings(); SettingEvent(); SettingGesture(); SettingKey(); SettingSerializer.SaveSettings <ShortcutSettings>("ShortcutSettings.xml", settings); }
/// <summary> /// 保存ボタン押下 /// </summary> private void saveButton_Click(object sender, System.EventArgs e) { // プレイヤー設定 PlayerSettings.DisconnectRealyOnClose = disconnectRealyOnCloseCheckBox.Checked; PlayerSettings.ReturnPositionOnStart = returnPositionOnStartCheckBox.Checked; PlayerSettings.ReturnSizeOnStart = returnSizeOnStartCheckBox.Checked; PlayerSettings.WindowSnapEnable = windowSnapEnableCheckBox.Checked; PlayerSettings.AspectRateFix = aspectRateFixCheckBox.Checked; PlayerSettings.FrameInvisible = frameInvisibleCheckBox.Checked; PlayerSettings.TopMost = topMostCheckBox.Checked; PlayerSettings.WriteFieldVisible = writeFieldVisibleCheckBox.Checked; PlayerSettings.SaveReturnPositionOnClose = saveReturnPositionCheckBox.Checked; PlayerSettings.SaveReturnSizeOnClose = saveReturnSizeCheckBox.Checked; PlayerSettings.ExitedViewerClose = exitedViewerCloseCheckBox.Checked; // チェックボックスの設定(ステータスバー) PlayerSettings.DisplayFps = displayFpsCheckBox.Checked; PlayerSettings.DisplayBitrate = displayBitrateCheckBox.Checked; PlayerSettings.DisplayListenerNumber = listenerNumberCheckBox.Checked; // 初期音量 int initVolume = 0; if (int.TryParse(initVolumeTextBox.Text, out initVolume)) { PlayerSettings.InitVolume = initVolume; } // 音量変化 int volumeChangeNone = 10; if (int.TryParse(volumeChangeNoneTextBox.Text, out volumeChangeNone)) { PlayerSettings.VolumeChangeNone = volumeChangeNone; } int volumeChangeCtrl = 5; if (int.TryParse(volumeChangeCtrlTextBox.Text, out volumeChangeCtrl)) { PlayerSettings.VolumeChangeCtrl = volumeChangeCtrl; } int volumeChangeShift = 1; if (int.TryParse(volumeChangeShiftTextBox.Text, out volumeChangeShift)) { PlayerSettings.VolumeChangeShift = volumeChangeShift; } // 動画再生開始時のコマンド if (movieStartComboBox.SelectedIndex != -1) { PlayerSettings.MovieStartCommand = movieStartCommandList[movieStartComboBox.SelectedIndex]; } // スクリーンショット PlayerSettings.ScreenshotFolder = screenshotFolderTextBox.Text; PlayerSettings.ScreenshotExtension = screenshotExtensionComboBox.SelectedItem.ToString(); PlayerSettings.ScreenshotFormat = screenshotFormatTextBox.Text; // スレッド PlayerSettings.AutoReadThread = autoReadThreadCheckBox.Checked; // FLV PlayerSettings.Gpu = flvGpuCheckBox.Checked; PlayerSettings.Rtmp = useRtmpCheckBox.Checked; double bufferTime = 1.0; if (double.TryParse(bufferTimeTextBox.Text, out bufferTime)) { PlayerSettings.BufferTime = bufferTime; } double bufferTimeMax = 1.0; if (double.TryParse(bufferTimeMaxTextBox.Text, out bufferTimeMax)) { PlayerSettings.BufferTimeMax = bufferTimeMax; } // 設定を保存 PlayerSettings.Save(); Close(); // ショートカット設定 shortcut.Settings.KeyMap = new Dictionary <KeyInput, Commands>(); shortcut.Settings.GestureMap = new Dictionary <string, Commands>(); foreach (ListViewItem item in shortcutListView.Items) { object tag1 = item.Tag; // Commands object tag2 = item.SubItems[1].Tag; // KeyInput // コマンド取得失敗 if (tag1 == null) { continue; } Commands command = (Commands)item.Tag; // ショートカット設定 if (tag2 != null) { KeyInput keyInput = (KeyInput)item.SubItems[1].Tag; shortcut.Settings.KeyMap.Add(keyInput, command); } // マウスジェスチャ設定 string gesture = item.SubItems[2].Text; if (gesture != "-") { shortcut.Settings.GestureMap.Add(gesture, command); } } SettingSerializer.SaveSettings <ShortcutSettings>("ShortcutSettings.xml", shortcut.Settings); }