private void buttonAddPlatformConfig_Click(object sender, RoutedEventArgs e) { var platformConfig = new PlatformConfig(); var dialog = new EditPlatformConfigDialog(platformConfig, "Add"); dialog.Owner = this; var result = dialog.ShowDialog(); if (result.HasValue && result.Value) { this.Config.PlatformConfigs.Add(dialog.PlatformConfig); UpdatePlatformConfigs(); listPlatformConfigs.SelectedItem = dialog.PlatformConfig; } }
private void buttonEditPlatformConfig_Click(object sender, RoutedEventArgs e) { var platformConfig = (PlatformConfig)listPlatformConfigs.SelectedItem; if (platformConfig != null) { var dialog = new EditPlatformConfigDialog(platformConfig, "Edit"); dialog.Owner = this; var result = dialog.ShowDialog(); if (result.HasValue && result.Value) { var index = this.Config.PlatformConfigs.IndexOf(platformConfig); this.Config.PlatformConfigs.Remove(platformConfig); this.Config.PlatformConfigs.Insert(index, dialog.PlatformConfig); UpdatePlatformConfigs(); listPlatformConfigs.SelectedItem = dialog.PlatformConfig; } } }