private void button_chg_preset_Click(object sender, RoutedEventArgs e) { try { if (comboBox_preSet.SelectedItem != null) { var item = comboBox_preSet.SelectedItem as RecPresetItem; if (item.IsCustom == true) { MessageBox.Show("このプリセットは変更できません"); return; } var setting = new AddPresetWindow(); setting.Owner = CommonUtil.GetTopWindow(this); setting.SetMode(true); setting.SetName(item.DisplayName); if (setting.ShowDialog() == true) { item.DisplayName = setting.GetName(); item.RecPresetData = GetRecSetting(); comboBox_preSet.SelectedItem = null; comboBox_preSet.SelectedItem = item; SavePreset(); } } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
private void button_Click(PresetEdit mode, object sender, RoutedEventArgs e) { try { var item = comboBox_preSet.SelectedItem as S; if (mode != PresetEdit.Add && item == null) { return; } var setting = new AddPresetWindow { Owner = CommonUtil.GetTopWindow(this) }; setting.SetMode(mode, this.txt_title.Text); if (mode != PresetEdit.Add) { setting.SetName(item.DisplayName); } if (setting.ShowDialog() == true) { int index = comboBox_preSet.SelectedIndex; switch (mode) { case PresetEdit.Add: index = Items.Count(it => it.IsCustom == false); var newInfo = new S { DisplayName = setting.GetName(), ID = 0, Data = dView.GetData() }; comboBox_preSet.Items.Insert(index, newInfo); break; case PresetEdit.Change: item.DisplayName = setting.GetName(); item.Data = dView.GetData(); break; case PresetEdit.Delete: index = Math.Max(0, Math.Min(index, comboBox_preSet.Items.Count - 2)); comboBox_preSet.Items.Remove(item); break; } comboBox_preSet.Items.Refresh(); ChangeSelect(index, null, true); PresetEdited(mode); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
private void button_chg_preset_Click(object sender, RoutedEventArgs e) { try { if (comboBox_preSet.SelectedItem != null) { RecPresetItem item = comboBox_preSet.SelectedItem as RecPresetItem; if (item.ID == 0xFFFFFFFF) { MessageBox.Show("このプリセットは変更できません"); return; } AddPresetWindow setting = new AddPresetWindow(); PresentationSource topWindow = PresentationSource.FromVisual(this); if (topWindow != null) { setting.Owner = (Window)topWindow.RootVisual; } setting.SetMode(true); setting.SetName(item.DisplayName); if (setting.ShowDialog() == true) { String name = ""; setting.GetName(ref name); RecSettingData newSet = new RecSettingData(); GetRecSetting(ref newSet); item.DisplayName = name; presetList[item.ID] = newSet; SavePreset(); comboBox_preSet.Items.Refresh(); } } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
private void button_chg_preset_Click(object sender, RoutedEventArgs e) { try { if (comboBox_preSet.SelectedItem != null) { var item = comboBox_preSet.SelectedItem as RecPresetItem; if (item.ID == 0xFFFFFFFF) { MessageBox.Show("このプリセットは変更できません"); return; } var setting = new AddPresetWindow(); PresentationSource topWindow = PresentationSource.FromVisual(this); if (topWindow != null) { setting.Owner = (Window)topWindow.RootVisual; } setting.SetMode(true); setting.SetName(item.DisplayName); if (setting.ShowDialog() == true) { item.DisplayName = setting.GetName(); item.RecPresetData = GetRecSetting(); comboBox_preSet.SelectedItem = null; comboBox_preSet.SelectedItem = item; SavePreset(); } } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }