Esempio n. 1
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            Engine engine = engineSelectControl1.SelectedItem;

            if (engine == null)
            {
                volatileConfig.ThinkEngineName = null;
                volatileConfig.ThinkEnginePath = null;
            }
            else
            {
                // 念のため存在チェック
                string path = ShogiCore.USI.USIDriver.NormalizeEnginePath(engine.Path);
                if (!System.IO.File.Exists(path))
                {
                    MessageBox.Show(this, path + " が存在しません。", "エラー");
                    DialogResult = System.Windows.Forms.DialogResult.None;
                    return;
                }
                volatileConfig.ThinkEngineName = engine.Name;
                volatileConfig.ThinkEnginePath = engine.Path;
                // 保存
                ConfigSerializer.Serialize(volatileConfig);
            }
        }
Esempio n. 2
0
 private void 削除DToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (0 < listView1.SelectedItems.Count)
     {
         ListViewItem item   = listView1.SelectedItems[0];
         Engine       engine = (Engine)item.Tag;
         if (MessageBox.Show(this, engine.Name + "を削除します。よろしいですか?", "確認",
                             MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK)
         {
             if (engineList.Engines.Remove(engine))
             {
                 listView1.Items.Remove(item);
                 // 書き込み
                 ConfigSerializer.Serialize(engineList);
             }
         }
     }
 }