示例#1
0
 internal void ShowError(RuntimeError error)
 {
     this.lblLevel.Text       = error.Level.ToString();
     this.lblDescription.Text = error.Description;
     this.lblSource.Text      = (error.Source == null) ? "Not defined." : error.Source.ToString();
     this.tbxDetails.Text     = error.Details;
 }
        public static void ReportError(RuntimeError error)
        {
            lock (typeof(RuntimeErrorManager))
            {
                MethodInvoker invoker2;
                _errorCollection.AddError(error);
                if (Trace.IsLevelEnabled(TraceLevel.Error))
                {
                    Trace.WriteLine(error.ToString());
                }
                if (Environment.UserInteractive)
                {
                    switch (_outputTarget)
                    {
                    case RuntimeErrorOutputTarget.Console:
                        System.Console.WriteLine(error.ToString());
                        break;

                    case RuntimeErrorOutputTarget.PopupWindow:
                    {
                        invoker2 = null;
                        RuntimeErrorForm form = new RuntimeErrorForm();
                        form.ShowError(error);
                        Control app = Control.FromHandle(Process.GetCurrentProcess().MainWindowHandle);
                        if ((app != null) && app.InvokeRequired)
                        {
                            if (invoker2 == null)
                            {
                                invoker2 = () => form.ShowDialog(app);
                            }
                            MethodInvoker method = invoker2;
                            app.Invoke(method);
                        }
                        else
                        {
                            form.ShowDialog(app);
                        }
                        break;
                    }
                    }
                }
                //Emit error to other listeners
                if (_runtimeErrorEventHandler != null)
                {
                    _runtimeErrorEventHandler(new RuntimeErrorEventArgs(error));
                }
            }
        }
 public RuntimeErrorEventArgs(RuntimeError error)
 {
     this._error = error;
 }
 internal void AddError(RuntimeError _error)
 {
     base.InnerList.Add(_error);
 }