コード例 #1
0
        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); }
        }
コード例 #2
0
ファイル: RecSettingView.xaml.cs プロジェクト: nekopanda/EDCB
        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);
            }
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
ファイル: RecSettingView.xaml.cs プロジェクト: nekopanda/EDCB
 private void button_add_preset_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         var setting = new AddPresetWindow();
         setting.Owner = CommonUtil.GetTopWindow(this);
         if (setting.ShowDialog() == true)
         {
             RecPresetItem preCust     = FindPresetItem(RecPresetItem.CustomID);
             int           insertIndex = comboBox_preSet.Items.Count + (preCust == null ? 0 : -1);
             var           newInfo     = new RecPresetItem(setting.GetName(), 0, GetRecSetting());//IDはSavePresetですぐ割り振られる。
             comboBox_preSet.Items.Insert(insertIndex, newInfo);
             comboBox_preSet.SelectedIndex = insertIndex;
             SavePreset();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
     }
 }
コード例 #5
0
 private void button_add_preset_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         AddPresetWindow    setting   = new AddPresetWindow();
         PresentationSource topWindow = PresentationSource.FromVisual(this);
         if (topWindow != null)
         {
             setting.Owner = (Window)topWindow.RootVisual;
         }
         if (setting.ShowDialog() == true)
         {
             String name = "";
             setting.GetName(ref name);
             AddPreset(name);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
     }
 }
コード例 #6
0
ファイル: RecSettingView.xaml.cs プロジェクト: niisaka/EDCB
        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);
            }
        }
コード例 #7
0
ファイル: RecSettingView.xaml.cs プロジェクト: niisaka/EDCB
 private void button_add_preset_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         AddPresetWindow setting = new AddPresetWindow();
         PresentationSource topWindow = PresentationSource.FromVisual(this);
         if (topWindow != null)
         {
             setting.Owner = (Window)topWindow.RootVisual;
         }
         if (setting.ShowDialog() == true)
         {
             String name = "";
             setting.GetName(ref name);
             AddPreset(name);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
     }
 }
コード例 #8
0
ファイル: RecSettingView.xaml.cs プロジェクト: xceza7/EDCB
        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);
            }
        }
コード例 #9
0
ファイル: RecSettingView.xaml.cs プロジェクト: xceza7/EDCB
 private void button_add_preset_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         var setting = new AddPresetWindow();
         PresentationSource topWindow = PresentationSource.FromVisual(this);
         if (topWindow != null)
         {
             setting.Owner = (Window)topWindow.RootVisual;
         }
         if (setting.ShowDialog() == true)
         {
             RecPresetItem preCust = FindPresetItem(0xFFFFFFFF);
             int insertIndex = comboBox_preSet.Items.Count + (preCust == null ? 0 : -1);
             var newInfo = new RecPresetItem(setting.GetName(), 0, GetRecSetting());//IDはSavePresetですぐ割り振られる。
             comboBox_preSet.Items.Insert(insertIndex, newInfo);
             comboBox_preSet.SelectedIndex = insertIndex;
             SavePreset();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
     }
 }