private void Button_Click(object sender, RoutedEventArgs e) { addFarm add = new addFarm(); add.Closed += (asd, dsa) => { Show(); Refresh(); }; Hide(); add.Show(); }
private void Button_Click_1(object sender, RoutedEventArgs e) { if (farmDataGrid.SelectedItem != null) { addFarm add = new addFarm(farmDataGrid.SelectedItem as Farm); add.Closed += (asd, dsa) => { Show(); Refresh(); }; Hide(); add.Show(); } else { MessageBox.Show("Выберите ферму для внесения изменений"); } }