private void AddButton_Click(object sender, RoutedEventArgs e) { ServiceEditor w = new ServiceEditor(); ServiceDescription c = new ServiceDescription(); w.ViewModel.SetService(c); if (w.ShowDialog() == true) { ServiceDescription nc = w.ViewModel.GetService(); this.Services.Add(nc); this.servicesGrid.SelectedItem = nc; } }
private void EditButton_Click(object sender, RoutedEventArgs e) { if (this.servicesGrid.SelectedItem == null) { return; } ServiceEditor w = new ServiceEditor(); ServiceDescription c = (ServiceDescription)this.servicesGrid.SelectedItem; w.ViewModel.SetService(c); if (w.ShowDialog() == true) { ServiceDescription nc = w.ViewModel.GetService(); this.Services.Remove(c); this.Services.Add(nc); this.servicesGrid.SelectedItem = nc; } }
private void EditButton_Click(object sender, RoutedEventArgs e) { if (this.servicesGrid.SelectedItem == null) return; ServiceEditor w = new ServiceEditor(); ServiceDescription c = (ServiceDescription)this.servicesGrid.SelectedItem; w.ViewModel.SetService(c); if (w.ShowDialog() == true) { ServiceDescription nc = w.ViewModel.GetService(); this.Services.Remove(c); this.Services.Add(nc); this.servicesGrid.SelectedItem = nc; } }