public void SetActiveDocument(Document document) { foreach (LayoutDocument entry in this.editors.Children) { if (entry.GetType() == typeof(AvalonDocument)) { AvalonDocument doc = (AvalonDocument)entry; if (doc.GetDocument().Equals(document)) { doc.IsActive = true; lastactivedocument = doc; return; } doc.IsActive = false; } } var newdoc = new AvalonDocument(document); newdoc.IsActive = true; lastactivedocument = newdoc; editors.Children.Add(newdoc); }
public void SaveAllDocument() { foreach (LayoutDocument child in editors.Children) { if (child.GetType() == typeof(AvalonDocument)) { AvalonDocument avalondoc = (AvalonDocument)child; avalondoc.GetDocument().SaveDocument(); } } }
internal void OnChanged(Document document, Document.State state) { Logger.Info("[IDE] Changed document: " + document.GetName() + " >> " + state); switch (state) { case Document.State.CREATED: AvalonDocument d = new AvalonDocument(document); this.editors.Children.Add(d); this.SetActiveDocument(document); break; case Document.State.CHANGED: foreach (LayoutDocument entry in this.editors.Children) { if (entry.GetType() == typeof(AvalonDocument)) { AvalonDocument doc = (AvalonDocument)entry; if (doc.GetDocument() == document) { doc.Title = document.GetName() + "*"; } } } break; case Document.State.REMOVED: foreach (LayoutDocument entry in this.editors.Children) { if (entry.GetType() == typeof(AvalonDocument)) { AvalonDocument doc = (AvalonDocument)entry; if (doc.GetDocument() == document) { //Boot.Core.Workspace.RemoveDocument( ? doc.GetDocument() : null); this.editors.Children.Remove(doc); this.GetMenu().Update(); //state = Document.State.CREATED; break; } } } break; } this.GetMenu().Update(); }