private void BtnEdit_Click(object sender, RoutedEventArgs e) { if (ViewModelLocator.ScoresListViewModel.SelectedScore != null) { var window = new AddScoreWindow(); window.Owner = this; window.WindowStartupLocation = WindowStartupLocation.CenterOwner; SCORE changedScore = ViewModelLocator.ScoresListViewModel.SelectedScore as SCORE; window.DataContext = changedScore; var result = window.ShowDialog(); if (result == true) { ViewModelLocator.ScoresListViewModel.EditScore(changedScore); ViewModelLocator.ScoresListViewModel.ComputeGrade(); ViewModelLocator.SelectedSubjectViewModel.SelectedActivity.Grade = ViewModelLocator.ScoresListViewModel.ComputeConvertedGrade(); } } }
private void BtnAddActivity_Click(object sender, RoutedEventArgs e) { var window = new AddScoreWindow(); window.Owner = this; window.WindowStartupLocation = WindowStartupLocation.CenterOwner; SCORE newScore = new SCORE(); newScore.Date = DateTime.Now; window.DataContext = newScore; var result = window.ShowDialog(); if (result == true) { ViewModelLocator.ScoresListViewModel.AddNewScore(newScore); ViewModelLocator.ScoresListViewModel.ComputeGrade(); ViewModelLocator.SelectedSubjectViewModel.SelectedActivity.Grade = ViewModelLocator.ScoresListViewModel.ComputeConvertedGrade(); } }