private void addMemberButton_Click(object sender, EventArgs e) { HighNGCollectionEditDialog hnced = new HighNGCollectionEditDialog(); hnced.IsRegex = false; hnced.Abone = AboneType.Name; hnced.Word = String.Empty; hnced.Url = String.Empty; hnced.Settime = DateTime.MinValue; hnced.ReleaseTime = TimeSpan.MinValue; DialogResult dr = hnced.ShowDialog(); if (dr == System.Windows.Forms.DialogResult.OK) { NGWord n = hnced.NGData; ListViewItem lvi = new ListViewItem(new string[] { n.AboneTypes.ToString(), n.Word, n.IsRegex.ToString(), n.Url, n.SetTime.ToString(), n.ReleaseTime.ToString() }); this.listView1.Items.Add(lvi); } }
private void listView1_DoubleClick(object sender, EventArgs e) { if (this.listView1.SelectedItems.Count <= 0) { return; } int count = this.listView1.SelectedItems[0].Index; ListViewItem lvi = this.listView1.SelectedItems[0]; HighNGCollectionEditDialog hnced = new HighNGCollectionEditDialog(); hnced.IsRegex = Boolean.Parse(lvi.SubItems[2].Text); hnced.Abone = (AboneType)Enum.Parse(typeof(AboneType), lvi.SubItems[0].Text); hnced.Word = lvi.SubItems[1].Text; hnced.Url = lvi.SubItems[3].Text; hnced.Settime = DateTime.Parse(lvi.SubItems[4].Text); hnced.ReleaseTime = TimeSpan.Parse(lvi.SubItems[5].Text); DialogResult dr = hnced.ShowDialog(); if (dr == System.Windows.Forms.DialogResult.OK) { NGWord n = hnced.NGData; if (n.IsRegex) { lvi = new ListViewItem(new string[] { n.AboneTypes.ToString(), n.RegexWord.ToString(), n.IsRegex.ToString(), n.Url, n.SetTime.ToString(), n.ReleaseTime.ToString() }); } else { lvi = new ListViewItem(new string[] { n.AboneTypes.ToString(), n.Word, n.IsRegex.ToString(), n.Url, n.SetTime.ToString(), n.ReleaseTime.ToString() }); } this.listView1.Items[count] = lvi; } }