public MainWindow() { InitializeEnviornment(); InitializeComponent(); StartPage = new StartPage(); StartPage.ShowAsDocument(dockingManager); OutputWindow = new OutputWindow(); ErrorWindow = new ErrorWindow(); ErrorWindow.OpenError += ErrorWindow_OpenError; Closing += OnClosing; Instance = this; Drop += MainWindow_Drop; AllowDrop = true; }
void ErrorWindow_OpenError(object sender, ErrorWindow.OpenErrorEventArgs e) { var file = Path.Combine(CurrentProject.RootDirectory, e.Error.FileFullPath); var editor = OpenFile(file); if (editor == null) return; var offset = editor.textEditor.Document.GetOffset(e.Error.LineNumber, 0); var line = editor.textEditor.Document.GetLineByOffset(offset); editor.textEditor.ScrollToLine(e.Error.LineNumber); editor.textEditor.Select(offset, line.Length); editor.Focus(); editor.textEditor.Focus(); }