/// <summary> /// エンジンの追加 /// </summary> /// <param name="engine"></param> private void AddEngine(Engine engine) { using (EngineForm form = new EngineForm(engine, engineList)) { if (form.ShowDialog(this) == DialogResult.OK) { listView1.Items.Add(ToListViewItem(engine)); engineList.Engines.Add(engine); engineList.Engines.Sort(); // 書き込み ConfigSerializer.Serialize(engineList); } } }
private void 設定MToolStripMenuItem_Click(object sender, EventArgs e) { if (0 < listView1.SelectedItems.Count) { Engine engine = (Engine)listView1.SelectedItems[0].Tag; using (EngineForm form = new EngineForm(engine, engineList)) { if (form.ShowDialog(this) == DialogResult.OK) { ApplyToListViewItem(listView1.SelectedItems[0], engine); // 保存 ConfigSerializer.Serialize(engineList); } } } }
/// <summary> /// 設定ボタン /// </summary> private void buttonEngineConfig_Click(object sender, EventArgs e) { Engine engine = comboBoxEngine.SelectedItem as Engine; if (engine != null) { using (EngineForm form = new EngineForm(engine, engineList)) { if (form.ShowDialog(this) == DialogResult.OK) { // 保存 ConfigSerializer.Serialize(engineList); // 表示を更新 comboBoxEngine.BeginUpdate(); comboBoxEngine.Items.Clear(); comboBoxEngine.Items.AddRange(engineList.Engines.ToArray()); comboBoxEngine.SelectedItem = engine; comboBoxEngine.EndUpdate(); } } } }