Beispiel #1
0
        private void buttonProfileEdit_Click(object sender, EventArgs e)
        {
            Profile profile = manager.Search((string)listBoxProfile.Items[index]);

            using (var dlg = new FormProfileEdit(manager, profile))
            {
                dlg.ShowDialog(this);
            }

            UpdateListBox();

            UpdateButtons(false);
        }
Beispiel #2
0
        private void buttonProfileAdd_Click(object sender, EventArgs e)
        {
            string name = "";

            using (var dlg = new FormInput("プロファイル名を入力してください"))
            {
                bool flag = true;
                while (flag)
                {
                    switch (dlg.ShowDialog(this))
                    {
                    case DialogResult.OK:
                        name = dlg.InputText;
                        break;

                    case DialogResult.Cancel:
                        return;
                    }

                    if (string.IsNullOrEmpty(name))
                    {
                        MessageBox.Show("プロファイル名を入力してください", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        if (manager.ContainsKey(name))
                        {
                            MessageBox.Show("このプロファイル名はすでに登録されています\n別の名前を指定してください", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        else
                        {
                            flag = false;
                        }
                    }
                }
            }


            using (var dlg = new FormProfileEdit(manager, name))
            {
                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    UpdateListBox();
                }
            }
        }