private void buttonProfileNameEdit_Click(object sender, EventArgs e) { using (var dlg = new FormInput("プロファイル名を入力してください", "入力", textBoxProfileName.Text)) { bool flag = true; while (flag) { if (dlg.ShowDialog(this) == DialogResult.OK) { if (string.IsNullOrEmpty(dlg.InputText)) { MessageBox.Show("プロファイル名を入力してください"); } else { if (manager.ContainsKey(dlg.InputText)) { MessageBox.Show("そのプロファイル名はすでに登録されています\n別の名前を指定してください", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { flag = false; manager.Remove(profile.Name); File.Delete(profile.GetPath(true)); profile.Name = dlg.InputText; profile.Save(); manager.Add(profile); textBoxProfileName.Text = profile.Name; } } } } } }
private void buttonProfileDelete_Click(object sender, EventArgs e) { string item = (string)listBoxProfile.Items[index]; string msg = string.Format("プロファイル「{0}」を削除しますか?", item); if (MessageBox.Show(msg, "確認", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1) == DialogResult.Yes) { manager.Remove(item); UpdateListBox(); } }