public void Run() { Helper.WaitAsync(RunAsync); ShowRawTextDialog.Show("", _report_sb.ToString()); _report_sb.Clear(); }
public void Run() { _progress = new ProgressDialog(null, Translate._("Action.Validate.Progress.Title")); _callback = _progress.Events; _progress.CounterFormat = Translate._("Action.Validate.Progress.CounterFormat"); _progress.Interval = 1000; //_Run(); var task = Task.Run(async() => await RunAsync()); while (!task.IsCompleted) { Application.Current.Dispatcher.Invoke(() => { }, DispatcherPriority.Render); System.Threading.Thread.Yield(); Application.Current.Dispatcher.Invoke(() => { }, DispatcherPriority.ContextIdle); } bool outcome = task.Result; _progress.Events.Stop("", ""); _progress = null; if (outcome) { MessageBox.Show(Application.Current.MainWindow, Translate._("Action.Validate.NoErrors"), Translate._("Action.Validate.Title")); } else { MessageBoxResult res = MessageBox.Show(Application.Current.MainWindow, string.Format(Translate._("Action.Validate.HasErrors"), _errors), Translate._("Action.Validate.Title"), MessageBoxButton.YesNo, MessageBoxImage.Error); if (res == MessageBoxResult.Yes) { _report_sb = new StringBuilder(); _report_depth = 0; var c_task = Task.Run(async() => await _CreateReportAsync()); while (!c_task.IsCompleted) { Application.Current.Dispatcher.Invoke(() => { }, DispatcherPriority.Render); System.Threading.Thread.Yield(); Application.Current.Dispatcher.Invoke(() => { }, DispatcherPriority.ContextIdle); } ShowRawTextDialog.Show("", _report_sb.ToString()); _report_sb = null; } } }