Example #1
0
        public ErrorWindow(Error error)
        {
            InitializeComponent();

            ErrorBrowser.Navigating += ErrorBrowser_Navigating;

            // extract values from error message using regex and insert them into the template
            var html = error.Message;
            var i    = 0;

            foreach (Group group in Regex.Match(error.ShortDescription, error.RegexTrigger.ToString()).Groups)
            {
                // first group is always the entire match, ignore it
                if (i == 0)
                {
                    i++;
                    continue;
                }

                html = html.Replace($"[sub:{i}]", group.Value);
                i++;
            }

            ErrorBrowser.NavigateToString(html);
        }
Example #2
0
        public ErrorWindow(string html)
        {
            InitializeComponent();

            ErrorBrowser.Navigating += ErrorBrowser_Navigating;

            ErrorBrowser.NavigateToString(html);
        }
Example #3
0
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.detailList  = new System.Windows.Forms.ListBox();
            this.tabSplitter = new System.Windows.Forms.Splitter();

            this.errorBrowser          = new NUnit.UiException.Controls.ErrorBrowser();
            this.sourceCode            = new SourceCodeDisplay();
            this.stackTraceDisplay     = new StackTraceDisplay();
            this.detailListContextMenu = new System.Windows.Forms.ContextMenu();
            this.copyDetailMenuItem    = new System.Windows.Forms.MenuItem();
            this.SuspendLayout();
            //
            // detailList
            //
            this.detailList.Dock                  = System.Windows.Forms.DockStyle.Top;
            this.detailList.DrawMode              = System.Windows.Forms.DrawMode.OwnerDrawVariable;
            this.detailList.Font                  = DefaultFixedFont;
            this.detailList.HorizontalExtent      = 2000;
            this.detailList.HorizontalScrollbar   = true;
            this.detailList.ItemHeight            = 16;
            this.detailList.Location              = new System.Drawing.Point(0, 0);
            this.detailList.Name                  = "detailList";
            this.detailList.ScrollAlwaysVisible   = true;
            this.detailList.Size                  = new System.Drawing.Size(496, 128);
            this.detailList.TabIndex              = 1;
            this.detailList.Resize               += new System.EventHandler(this.detailList_Resize);
            this.detailList.MouseHover           += new System.EventHandler(this.OnMouseHover);
            this.detailList.MeasureItem          += new System.Windows.Forms.MeasureItemEventHandler(this.detailList_MeasureItem);
            this.detailList.MouseMove            += new System.Windows.Forms.MouseEventHandler(this.detailList_MouseMove);
            this.detailList.MouseLeave           += new System.EventHandler(this.detailList_MouseLeave);
            this.detailList.DrawItem             += new System.Windows.Forms.DrawItemEventHandler(this.detailList_DrawItem);
            this.detailList.SelectedIndexChanged += new System.EventHandler(this.detailList_SelectedIndexChanged);
            //
            // tabSplitter
            //
            this.tabSplitter.Dock           = System.Windows.Forms.DockStyle.Top;
            this.tabSplitter.Location       = new System.Drawing.Point(0, 128);
            this.tabSplitter.MinSize        = 100;
            this.tabSplitter.Name           = "tabSplitter";
            this.tabSplitter.Size           = new System.Drawing.Size(496, 9);
            this.tabSplitter.TabIndex       = 3;
            this.tabSplitter.TabStop        = false;
            this.tabSplitter.SplitterMoved += new System.Windows.Forms.SplitterEventHandler(this.tabSplitter_SplitterMoved);
            //
            // errorBrowser
            //
            this.errorBrowser.Dock             = System.Windows.Forms.DockStyle.Fill;
            this.errorBrowser.Location         = new System.Drawing.Point(0, 137);
            this.errorBrowser.Name             = "errorBrowser";
            this.errorBrowser.Size             = new System.Drawing.Size(496, 151);
            this.errorBrowser.StackTraceSource = null;
            this.errorBrowser.TabIndex         = 4;
            //
            // configure and register SourceCodeDisplay
            //
            this.sourceCode.AutoSelectFirstItem = true;
            this.sourceCode.ListOrderPolicy     = ErrorListOrderPolicy.ReverseOrder;
            this.sourceCode.SplitOrientation    = Orientation.Vertical;
            this.sourceCode.SplitterDistance    = 0.3f;
            this.stackTraceDisplay.Font         = DefaultFixedFont;
            this.errorBrowser.RegisterDisplay(sourceCode);
            this.errorBrowser.RegisterDisplay(stackTraceDisplay);
            //
            // detailListContextMenu
            //
            this.detailListContextMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                this.copyDetailMenuItem
            });
            //
            // copyDetailMenuItem
            //
            this.copyDetailMenuItem.Index  = 0;
            this.copyDetailMenuItem.Text   = "Copy";
            this.copyDetailMenuItem.Click += new System.EventHandler(this.copyDetailMenuItem_Click);
            //
            // ErrorDisplay
            //
            this.Controls.Add(this.errorBrowser);
            this.Controls.Add(this.tabSplitter);
            this.Controls.Add(this.detailList);
            this.Name = "ErrorDisplay";
            this.Size = new System.Drawing.Size(496, 288);
            this.ResumeLayout(false);
        }