Rev | Line | |
---|
[17386] | 1 | using System.CodeDom.Compiler;
|
---|
| 2 | using System.Diagnostics;
|
---|
| 3 | using System.Drawing;
|
---|
| 4 | using System.Windows.Forms;
|
---|
| 5 | using HeuristicLab.Common.Resources;
|
---|
| 6 |
|
---|
| 7 | namespace 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.