Esempio n. 1
0
 /// <summary>
 /// Adds the document's dock state to the session
 /// </summary>
 public static void AddDocumentDock(ITabbedDocument document, Session session)
 {
     try
     {
         DockContent   content   = document as DockContent;
         double        prop      = content.Pane.NestedDockingStatus.Proportion;
         DockAlignment align     = content.Pane.NestedDockingStatus.Alignment;
         Int32         paneIndex = content.DockPanel.Panes.IndexOf(content.Pane);
         Int32         nestIndex = content.DockPanel.Panes.IndexOf(content.Pane.NestedDockingStatus.PreviousPane);
         if (nestIndex > -1)
         {
             NestedDock dock = new NestedDock(document.FileName, nestIndex, paneIndex, align, prop);
             session.Nested.Add(dock);
         }
     }
     catch { /* No errors please... */ }
 }
Esempio n. 2
0
 /// <summary>
 /// Restores the previous document docks
 /// </summary>
 private static void RestoreDocks(Session session)
 {
     try
     {
         DockPane prevPane;
         for (Int32 i = 0; i < session.Nested.Count; i++)
         {
             NestedDock  nestedDock  = session.Nested[i];
             DockContent dockContent = DocumentManager.FindDocument(nestedDock.FileName) as DockContent;
             if (dockContent != null && nestedDock.NestIndex > -1)
             {
                 if (dockContent.DockPanel.Panes.Count > nestedDock.PaneIndex)
                 {
                     prevPane = dockContent.DockPanel.Panes[nestedDock.PaneIndex];
                     dockContent.DockTo(prevPane, DockStyle.Fill, -1);
                 }
                 else if (dockContent.DockPanel.Panes.Count > nestedDock.NestIndex)
                 {
                     DockStyle ds = DockStyle.Right;
                     prevPane = dockContent.DockPanel.Panes[nestedDock.NestIndex];
                     if (nestedDock.Alignment == DockAlignment.Top)
                     {
                         ds = DockStyle.Top;
                     }
                     else if (nestedDock.Alignment == DockAlignment.Left)
                     {
                         ds = DockStyle.Left;
                     }
                     else if (nestedDock.Alignment == DockAlignment.Bottom)
                     {
                         ds = DockStyle.Bottom;
                     }
                     dockContent.DockTo(prevPane, ds, -1, nestedDock.Proportion);
                 }
             }
         }
     }
     catch { /* No errors please... */ }
 }