private void buttonPathNew_Click(object sender, EventArgs e) { AddPathForm addPathForm = new AddPathForm(); DialogResult result = addPathForm.ShowDialog(this); if (result == DialogResult.OK) { Location newLocation = new Location { Name = addPathForm.PathName, Path = addPathForm.PathFolder }; _locations.Add(newLocation); listBoxPaths.SelectedIndex = listBoxPaths.Items.Add(newLocation); } UpdateSingleDestinationCombo(); }
private void buttonEdit_Click(object sender, EventArgs e) { Location currentLocation = (Location)listBoxPaths.SelectedItem; if (currentLocation != null) { var editPathForm = new AddPathForm { PathName = currentLocation.Name, PathFolder = currentLocation.Path }; DialogResult result = editPathForm.ShowDialog(this); if (result == DialogResult.OK) { currentLocation.Name = editPathForm.PathName; currentLocation.Path = editPathForm.PathFolder; } } }
private void buttonEdit_Click(object sender, EventArgs e) { Location currentLocation = (Location) listBoxPaths.SelectedItem; if (currentLocation != null) { var editPathForm = new AddPathForm {PathName = currentLocation.Name, PathFolder = currentLocation.Path}; DialogResult result = editPathForm.ShowDialog(this); if (result == DialogResult.OK) { currentLocation.Name = editPathForm.PathName; currentLocation.Path = editPathForm.PathFolder; } } }
private void buttonPathNew_Click(object sender, EventArgs e) { AddPathForm addPathForm = new AddPathForm(); DialogResult result = addPathForm.ShowDialog(this); if ( result == DialogResult.OK) { Location newLocation = new Location {Name = addPathForm.PathName, Path = addPathForm.PathFolder}; _locations.Add(newLocation); listBoxPaths.SelectedIndex = listBoxPaths.Items.Add(newLocation); } UpdateSingleDestinationCombo(); }