private void BtnEdit_Click(object sender, RoutedEventArgs e) { if (LvPrelimComponents.SelectedItem != null) { ViewModelLocator.SelectedSubjectViewModel.SelectedGradingPeriod = 0; ViewModelLocator.SelectedSubjectViewModel.IsEdit = true; var window = new AddActivityWindow(); window.Owner = this; window.WindowStartupLocation = WindowStartupLocation.CenterOwner; ACTIVITY changedActivity = ViewModelLocator.SelectedSubjectViewModel.SelectedActivity as ACTIVITY; window.DataContext = changedActivity; var result = window.ShowDialog(); if (result == true) { ViewModelLocator.SelectedSubjectViewModel.EditActivity(changedActivity); } } }
private void BtnAddComponent_Click(object sender, RoutedEventArgs e) { var window = new AddActivityWindow(); window.Owner = this; window.WindowStartupLocation = WindowStartupLocation.CenterOwner; ViewModelLocator.SelectedSubjectViewModel.SelectedGradingPeriod = 0; ViewModelLocator.SelectedSubjectViewModel.IsEdit = false; ACTIVITY newActivity = new ACTIVITY(); window.DataContext = newActivity; var result = window.ShowDialog(); if (result == true) { ViewModelLocator.SelectedSubjectViewModel.AddActivity(newActivity); } }