void Progres() { SynchronizationContext context = SynchronizationContext.Current; Thread backgroundThread = new Thread( new ThreadStart(() => { for (int n = 0; n < 1000; n++) { Thread.Sleep(5); context?.Post(new SendOrPostCallback((o) => { ProgressBar.Value = n; }), null); if (n.Equals(999)) { this.Dispatcher.Invoke(() => { sw.Stop(); StudyPageViewAction.ChangeStudyPage(sw.Elapsed, 1); }); } } ; } )); backgroundThread.Start(); }
private void Btn4_OnClick(object sender, RoutedEventArgs e) { int answer = 4; sw.Stop(); StudyPageViewAction.ChangeStudyPage(sw.Elapsed, answer); }
private void BtnConfirm_OnClick(object sender, RoutedEventArgs e) { Application.Current.Windows.OfType <MainWindow>().FirstOrDefault().frame.Content = StudyPageViewAction.InitialStudyPage(); }