private void ChangeCurrentRow(SubgroupPresenter subgroupPresenter, SubgroupEditPresenter subgroupEdit, Subgroup obj) { Subgroup subgroup = ((Subgroup)subgroupEdit.View.DataContext); obj.id = subgroup.id; obj.short_name = subgroup.short_name; obj.name = subgroup.name; subgroupPresenter.View.dataGridSubgroups.Items.Refresh(); }
private void btnUpdate_Click(object sender, RoutedEventArgs e) { try { SubgroupPresenter subgroupPresenter = (SubgroupPresenter)this.DataContext; Subgroup subgroup = new Subgroup(); DeepClone.CopyTo((Subgroup)(subgroupPresenter.View.dataGridSubgroups.SelectedItem), subgroup); SubgroupEditPresenter subgroupEditPresenter = new SubgroupEditPresenter(new SubgroupEditView(), subgroup); subgroupEditPresenter.View.Label_AddOrEditSubgroup.Content = "Edytowanie podgrupy"; if (subgroupEditPresenter.View.ShowDialog() == true) { subgroupPresenter.SaveSubgroup(subgroup, true); Subgroup temp = (Subgroup)subgroupPresenter.View.dataGridSubgroups.SelectedItem; ChangeCurrentRow(subgroupPresenter, subgroupEditPresenter, temp); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }