private void ErrorException(string data, string info) { if (!Application.Current.Dispatcher.CheckAccess()) { Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new ErrorExceptionDelegate(ErrorException), data, info); } else { IsErrors = true; if (worker != null) { worker.WorkerReportsProgress = false; } if (Handle == IntPtr.Zero) { Handle = new WindowInteropHelper(this).Handle; } Win7Taskbar.SetProgressTaskComplete(Handle, TBPF.ERROR); Message mes = new Message(this.IsLoaded ? this : Owner); mes.ShowMessage(data, info, Languages.Translate("Error"), Message.MessageStyle.Ok); } }
private void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (e.Error != null) { ErrorException("ScriptRunner (Unhandled): " + ((Exception)e.Error).Message, ((Exception)e.Error).StackTrace); Close(); } else if (e.Result != null) { //Добавляем скрипт в StackTrace string stacktrace = ((Exception)e.Result).StackTrace; if (!string.IsNullOrEmpty(script)) { stacktrace += Calculate.WrapScript(script, 150); } ErrorException("ScriptRunner: " + ((Exception)e.Result).Message, stacktrace); Close(); } else if (IsAborted || Settings.CloseScriptRunner) { Close(); } else { Title = Languages.Translate("Complete"); if (progress_total.IsIndeterminate) { //Прогресс еще не выводился progress_total.IsIndeterminate = false; progress_total.Value = progress_total.Maximum; label_info.Content = label.Replace("XX", total.ToString()).Replace("YY", total.ToString()); Win7Taskbar.SetProgressTaskComplete(Handle, TBPF.NORMAL); } } }