public static void Close(this DocumentBase doc) { if (Workspace.Instance.AvalonDockDocuments.Contains(doc)) { Workspace.Instance.AvalonDockDocuments.Remove(doc); } }
private void DebuggerInstance_OnHalt(object sender, OnHaltEventArgs e) { Application.Current.Dispatcher.Invoke(() => { Logger.Log(NLog.LogLevel.Info, "Execution was halted."); this.IsPaused = true; this.CurrentLine = e.Line; this.CurrentColumn = e.Column; this.CallStack = this.DebuggerInstance.GetCallstack(); Application.Current.MainWindow.Activate(); var pff = Workspace.Instance.Solution.GetProjectFileFromArmAPath(e.DocumentPath); DocumentBase doc; if (pff == null) { var content = e.DocumentContent; if (string.IsNullOrWhiteSpace(content)) { content = "NA"; } this.CurrentDocument = doc = Workspace.Instance.CreateOrFocusTemporaryDocument(e.DocumentPath, content, ".sqf"); Logger.Info($"Created temporary document for {e.DocumentPath}"); } else { this.CurrentDocument = doc = Workspace.Instance.CreateOrFocusDocument(pff); } doc.RefreshVisuals(); this.LastEditorContext = doc as CodeEditorBaseDataContext; }, System.Windows.Threading.DispatcherPriority.Send); }
/// <summary> /// Adds provided <see cref="DocumentBase"/> to the displayed documents. /// If already added, <see cref="DocumentBase"/> will be focused. /// </summary> /// <param name="doc">The document to focus/display</param> public void DisplayDocument(DocumentBase doc) { if (this.AvalonDockDocuments.Contains(doc)) { this.AvalonDockDocuments.Add(doc); } doc.IsActive = true; }