private void copyButton_Click(object sender, EventArgs e) { if (commandersWindow.SelectedItems.Count == 1) { int index = commandersWindow.SelectedIndex; Commander c = new Commander(mCommanders[index]); SetupForm dlg = new SetupForm(c); if (dlg.ShowDialog() == DialogResult.OK) { c = new Commander(dlg.CommanderName, dlg.Filter, dlg.WorkingDirectory, dlg.Commands, dlg.Paths); c.Log += CommanderLog; mBinding.Add(c); WriteXml(mCommanders); c.Start(); } dlg.Dispose(); commandersWindow.ClearSelected(); commandersWindow.SelectedIndex = index; } else { MessageBox.Show("Select one item."); } }
////////////////////////////////////////////////// // Control event handlers private void addPathButton_Click(object sender, EventArgs e) { SetupForm dlg = new SetupForm(); if (dlg.ShowDialog() == DialogResult.OK) { Commander c = new Commander(dlg.CommanderName, dlg.Filter, dlg.WorkingDirectory, dlg.Commands, dlg.Paths); c.Log += CommanderLog; mBinding.Add(c); c.Start(); WriteXml(mCommanders); } dlg.Dispose(); }