Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/HeuristicLab.Scripting.Views/3.3/CompilerErrorDialog.cs @ 18006

Last change on this file since 18006 was 17386, checked in by jkarder, 5 years ago

#3045: fixed build fail

File size: 1.4 KB
Line 
1using System.CodeDom.Compiler;
2using System.Diagnostics;
3using System.Drawing;
4using System.Windows.Forms;
5using HeuristicLab.Common.Resources;
6
7namespace HeuristicLab.Scripting.Views {
8  public partial class CompilerErrorDialog : Form {
9    private const string ErrorLinkFormatString = "https://docs.microsoft.com/en-us/search/?search={0}&scope=.NET";
10
11    private static readonly Bitmap WarningImage = VSImageLibrary.Warning;
12    private static readonly Bitmap ErrorImage = VSImageLibrary.Error;
13
14    public CompilerErrorDialog(CompilerError error) {
15      InitializeComponent();
16
17      var image = error.IsWarning ? WarningImage : ErrorImage;
18
19      Icon = Icon.FromHandle(image.GetHicon());
20      Text = error.IsWarning ? "Warning" : "Error";
21      iconLabel.Image = image;
22      infoTextBox.Text = string.Format(infoTextBox.Text, error.IsWarning ? "A warning" : "An error");
23      lineValueLabel.Text = error.Line.ToString();
24      columnValueLabel.Text = error.Column.ToString();
25      codeValueLinkLabel.Text = error.ErrorNumber;
26      codeValueLinkLabel.Links.Add(new LinkLabel.Link(0, error.ErrorNumber.Length, string.Format(ErrorLinkFormatString, error.ErrorNumber)));
27      messageValueTextBox.Text = error.ErrorText;
28    }
29
30    private void codeLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
31      Process.Start((string)e.Link.LinkData);
32    }
33  }
34}
Note: See TracBrowser for help on using the repository browser.