/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAdd_Click(object sender, EventArgs e) { frmReplyItem f = new frmReplyItem(); if (f.ShowDialog() == DialogResult.OK) { ReplyItem ri = f.ReplyItem; this._replyCollection.Add(ri); this.AddReplyItemToListView(ri); this.lvReply.SelectedIndices.Add(this.lvReply.Items.Count - 1); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnModify_Click(object sender, EventArgs e) { if (this.lvReply.SelectedItems.Count > 0) { ListViewItem lvi = this.lvReply.SelectedItems[0]; ReplyItem ri = lvi.Tag as ReplyItem; frmReplyItem f = new frmReplyItem(ri); if (f.ShowDialog() == DialogResult.OK) { lvi.SubItems[0].Text = ri.Name; lvi.SubItems[1].Text = ri.ReceivedPattern; lvi.SubItems[2].Text = HexStringConverter.Default.ConvertToObject(ri.ReplyBytes).ToString(); lvi.SubItems[3].Text = ri.Description; } } else { NUnit.UiKit.UserMessage.DisplayFailure(Strings.SelectListViewItemFirst); } }