// 加入一个新事项 public ScriptAction NewItem(string strName, string strComment, string strScriptEntry, bool bActive) { ScriptAction item = new ScriptAction(); item.Name = strName; item.Comment = strComment; item.ScriptEntry = strScriptEntry; item.Active = bActive; this.Add(item); return item; }
private void button_OK_Click(object sender, System.EventArgs e) { if (listView1.SelectedItems.Count == 0) { MessageBox.Show(this, "尚未选择事项..."); return; } this.SelectedIndex = listView1.SelectedIndices[0]; if (Actions != null) { this.SelectedAction = (ScriptAction)this.Actions[this.SelectedIndex]; } else { this.SelectedAction = null; } this.DialogResult = DialogResult.OK; this.Close(); }
void FillList() { listView1.Items.Clear(); if (Actions == null) { return; } for (int i = 0; i < Actions.Count; i++) { ScriptAction action = (ScriptAction)Actions[i]; ListViewItem item = new ListViewItem(action.Name, 0); item.SubItems.Add(action.Comment); item.SubItems.Add(action.ScriptEntry); if (action.Active == true) { item.Selected = true; } listView1.Items.Add(item); } }
private void button_OK_Click(object sender, System.EventArgs e) { if (listView1.SelectedItems.Count == 0) { MessageBox.Show(this, "尚未选择事项..."); return; } this.SelectedIndex = listView1.SelectedIndices[0]; if (Actions != null) this.SelectedAction = (ScriptAction)this.Actions[this.SelectedIndex]; else this.SelectedAction = null; this.DialogResult = DialogResult.OK; this.Close(); }