private void btnAdd_Click(object sender, EventArgs e) { AutoLaunchEditItemForm autoLaunchEditItemForm = new AutoLaunchEditItemForm(virtPackage, fileSystemEditor); autoLaunchEditItemForm.Text = btnAdd.Text.Replace("&", ""); autoLaunchEditItemForm.SetValues("", "", "", ""); if (autoLaunchEditItemForm.ShowDialog() == DialogResult.OK) { String name = "", target = "", args = "", description = ""; autoLaunchEditItemForm.GetValues( ref name, ref target, ref args, ref description); // Add to list ListViewItem lvItem = new ListViewItem(); lvItem.Text = name; lvItem.SubItems.Add(target); lvItem.SubItems.Add(description); lvItem.SubItems.Add(args); propertyMenuLV.Items.Add(lvItem); } }
private void btnModify_Click(object sender, EventArgs e) { if (propertyMenuLV.SelectedItems.Count != 1) { return; } String name = propertyMenuLV.SelectedItems[0].Text; String target = propertyMenuLV.SelectedItems[0].SubItems[1].Text; // Note: SubItems are 1-indexed! String args = propertyMenuLV.SelectedItems[0].SubItems[3].Text; // Note: SubItems are 1-indexed! String description = propertyMenuLV.SelectedItems[0].SubItems[2].Text; // Note: SubItems are 1-indexed! AutoLaunchEditItemForm autoLaunchEditItemForm = new AutoLaunchEditItemForm(virtPackage, fileSystemEditor); autoLaunchEditItemForm.Text = btnModify.Text.Replace("&", "");; autoLaunchEditItemForm.SetValues(name, target, args, description); if (autoLaunchEditItemForm.ShowDialog() == DialogResult.OK) { autoLaunchEditItemForm.GetValues(ref name, ref target, ref args, ref description); propertyMenuLV.SelectedItems[0].SubItems.Clear(); propertyMenuLV.SelectedItems[0].Text = name; propertyMenuLV.SelectedItems[0].SubItems.Add(target); propertyMenuLV.SelectedItems[0].SubItems.Add(description); propertyMenuLV.SelectedItems[0].SubItems.Add(args); } }
private void btnModify_Click(object sender, EventArgs e) { if (propertyMenuLV.SelectedItems.Count != 1) return; String name = propertyMenuLV.SelectedItems[0].Text; String target = propertyMenuLV.SelectedItems[0].SubItems[1].Text; // Note: SubItems are 1-indexed! String args = propertyMenuLV.SelectedItems[0].SubItems[3].Text; // Note: SubItems are 1-indexed! String description = propertyMenuLV.SelectedItems[0].SubItems[2].Text; // Note: SubItems are 1-indexed! AutoLaunchEditItemForm autoLaunchEditItemForm = new AutoLaunchEditItemForm(virtPackage, fileSystemEditor); autoLaunchEditItemForm.Text = btnModify.Text.Replace("&", ""); ; autoLaunchEditItemForm.SetValues(name, target, args, description); if (autoLaunchEditItemForm.ShowDialog() == DialogResult.OK) { autoLaunchEditItemForm.GetValues(ref name, ref target, ref args, ref description); propertyMenuLV.SelectedItems[0].SubItems.Clear(); propertyMenuLV.SelectedItems[0].Text = name; propertyMenuLV.SelectedItems[0].SubItems.Add(target); propertyMenuLV.SelectedItems[0].SubItems.Add(description); propertyMenuLV.SelectedItems[0].SubItems.Add(args); } }