private void btnEdit_Click(object sender, EventArgs e) { if (lvQuickExtract.SelectedItems.Count == 0) { return; } using (QuickExtractDialog cpd = new QuickExtractDialog()) { ListViewItem item = (ListViewItem)lvQuickExtract.SelectedItems[0]; QuickExtractPath path = (QuickExtractPath)item.Tag; if (cpd.ShowDialog(this, path) == DialogResult.Cancel) { return; } path.Name = cpd.PathName; path.Path = cpd.Path; path.UseFolderPath = cpd.UseFolderPath; item.Text = cpd.PathName; item.SubItems[1].Text = cpd.Path; item.SubItems[2].Text = cpd.UseFolderPath ? "Yes" : "No"; } }
public DialogResult ShowDialog(IWin32Window owner, QuickExtractPath path) { txtName.Text = path.Name; txtPath.Text = path.Path; chbUseFolderPath.Checked = path.UseFolderPath; return(this.ShowDialog(owner)); }
private void btnAdd_Click(object sender, EventArgs e) { using (var cpd = new QuickExtractDialog()) { if (cpd.ShowDialog(this) == DialogResult.Cancel) { return; } var path = new QuickExtractPath(cpd.PathName, cpd.Path, cpd.UseFolderPath); var newItem = new ListViewItem(cpd.PathName); newItem.SubItems.Add(cpd.Path); newItem.SubItems.Add(cpd.UseFolderPath ? "Yes" : "No"); newItem.Tag = path; lvQuickExtract.Items.Insert(lvQuickExtract.Items.Count, newItem); } }