private async void SemesterComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (SemesterComboBox.SelectedItem != null) { LoadingProgressBar.Visibility = Visibility.Visible; try { currentRound = (ExamRound)SemesterComboBox.SelectedItem; Scores = await app.Assist.GetExamScores( Convert.ToInt32(currentRound.Year), Convert.ToInt32(currentRound.Semester), showMajor ); ExamScoreListView.ItemsSource = Scores; } catch (Exception err) { var msgDialog = new CommonDialog(err.Message) { Title = "错误", }; await msgDialog.ShowAsyncQueue(); } finally { LoadingProgressBar.Visibility = Visibility.Collapsed; } SaveScores(); } }
private async void PreviewAppBarButton_Clicked(object sender, RoutedEventArgs e) { var dialog = new PreviewExamArragementDialog(); if (await dialog.ShowAsyncQueue() == ContentDialogResult.Primary) { SemesterComboBox.SelectedItem = null; var year = DateTime.Now.Year; var month = DateTime.Now.Month; var term = 0; // 秋季学期 if (month < 9) { // 春季学期 term = 1; year--; } currentRound = year + "-" + (year + 1) + "学年" + (term == 0 ? "秋季学期" : "春季学期") + "考试" + dialog.n; var round = new ExamRound("", year + "," + term + "," + dialog.n); LoadingProgressBar.Visibility = Visibility.Visible; try { Arrangement = await app.Assist.GetExamArrangement(round); ExamArrangementListView.ItemsSource = Arrangement; } catch (Exception err) { var msgDialog = new CommonDialog(err.Message) { Title = "错误", }; await msgDialog.ShowAsyncQueue(); } finally { LoadingProgressBar.Visibility = Visibility.Collapsed; } LoadingProgressBar.Visibility = Visibility.Collapsed; } }