/// <summary> /// 接続文字列設定値追加イベント /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ConnectionItemAddEvent(object sender, EventArgs e) { EditConnectionStringDialog dialog = new EditConnectionStringDialog(); dialog.Text = "項目の追加"; if (dialog.ShowDialog(this) == DialogResult.OK) { ListViewItem listItem = listViewConnectionString.Items.Add(dialog.Key); listItem.SubItems.Add(dialog.Value); listItem.Checked = dialog.EnableItem; } }
/// <summary> /// 接続文字列設定値編集イベント /// </summary> private void ConnectionItemEditEvent(object sender, EventArgs e) { if (listViewConnectionString.SelectedItems.Count == 0) { MessageBox.Show(this, "編集する項目を選択してください。", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } ListViewItem listItem = listViewConnectionString.SelectedItems[0]; EditConnectionStringDialog dialog = new EditConnectionStringDialog(); dialog.Text = "項目の編集"; dialog.Key = listItem.Text; dialog.Value = listItem.SubItems[1].Text; dialog.EnableItem = listItem.Checked; if (dialog.ShowDialog(this) == DialogResult.OK) { listItem.Text = dialog.Key; listItem.SubItems[1].Text = dialog.Value; listItem.Checked = dialog.EnableItem; } }