예제 #1
0
        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);
        }
예제 #2
0
 public void SaveAllDocument()
 {
     foreach (LayoutDocument child in editors.Children)
     {
         if (child.GetType() == typeof(AvalonDocument))
         {
             AvalonDocument avalondoc = (AvalonDocument)child;
             avalondoc.GetDocument().SaveDocument();
         }
     }
 }
예제 #3
0
        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();
        }