コード例 #1
0
        private void OnAutoHiddenGroupHoverStart(object sender, KryptonPageEventArgs e)
        {
            // The auto hidden group contains proxy pages and not the real pages
            KryptonAutoHiddenProxyPage proxyPage = (KryptonAutoHiddenProxyPage)e.Item;

            OnPageHoverStart(new KryptonPageEventArgs(proxyPage.Page, e.Index));
        }
コード例 #2
0
        private void AppendPagesToControl(KryptonPage[] pages)
        {
            // Make a list of all the 'store' pages being added
            List <string> uniqueNames = new List <string>();

            foreach (KryptonPage page in pages)
            {
                if (page is KryptonStorePage)
                {
                    uniqueNames.Add(page.UniqueName);
                }
            }

            // We only allow a single 'store' page in this docking location at a time
            if (uniqueNames.Count > 0)
            {
                DockingManager.PropogateAction(DockingPropogateAction.ClearAutoHiddenStoredPages, uniqueNames.ToArray());
            }

            // Non-store pages need to be wrapped in a proxy appropriate for the auto hidden control
            for (int i = 0; i < pages.Length; i++)
            {
                if (!(pages[i] is KryptonStorePage))
                {
                    pages[i] = new KryptonAutoHiddenProxyPage(pages[i]);
                }
            }

            // Add the proxy pages so that we can still use the actual pages instances elsewhere
            AutoHiddenGroupControl.Pages.AddRange(pages);
        }
コード例 #3
0
        /// <summary>
        /// Return an array of the visible pages that are inside the auto hidden group.
        /// </summary>
        /// <returns>Array of page references.</returns>
        public KryptonPage[] VisiblePages()
        {
            List <KryptonPage> pages = new List <KryptonPage>();

            // Only interested in visible pages that are not placeholders
            foreach (KryptonPage page in AutoHiddenGroupControl.Pages)
            {
                if ((page is KryptonAutoHiddenProxyPage) && page.LastVisibleSet)
                {
                    // Add the actual page this proxy wraps
                    KryptonAutoHiddenProxyPage proxyPage = (KryptonAutoHiddenProxyPage)page;
                    pages.Add(proxyPage.Page);
                }
            }

            return(pages.ToArray());
        }
コード例 #4
0
 /// <summary>
 /// Propogates a page list request down the hierarchy of docking elements.
 /// </summary>
 /// <param name="state">Request that should result in pages collection being modified.</param>
 /// <param name="pages">Pages collection for modification by the docking elements.</param>
 public override void PropogatePageList(DockingPropogatePageList state, KryptonPageCollection pages)
 {
     switch (state)
     {
     case DockingPropogatePageList.All:
     case DockingPropogatePageList.AutoHidden:
         for (int i = AutoHiddenGroupControl.Pages.Count - 1; i >= 0; i--)
         {
             // Only add real pages and not just placeholders
             KryptonPage page = AutoHiddenGroupControl.Pages[i];
             if ((page != null) && !(page is KryptonStorePage))
             {
                 // Remember the real page is inside a proxy!
                 KryptonAutoHiddenProxyPage proxyPage = (KryptonAutoHiddenProxyPage)page;
                 pages.Add(proxyPage.Page);
             }
         }
         break;
     }
 }
コード例 #5
0
        /// <summary>
        /// Perform docking element specific actions for loading a child xml.
        /// </summary>
        /// <param name="xmlReader">Xml reader object.</param>
        /// <param name="pages">Collection of available pages.</param>
        /// <param name="child">Optional reference to existing child docking element.</param>
        protected override void LoadChildDockingElement(XmlReader xmlReader,
                                                        KryptonPageCollection pages,
                                                        IDockingElement child)
        {
            KryptonDockingManager manager = DockingManager;

            // Is it the expected xml element name?
            if (xmlReader.Name != "KP")
            {
                throw new ArgumentException("Element name 'KP' was expected but found '" + xmlReader.Name + "' instead.");
            }

            // Get the unique name of the page
            string uniqueName  = xmlReader.GetAttribute("UN");
            string boolStore   = xmlReader.GetAttribute("S");
            string boolVisible = xmlReader.GetAttribute("V");

            KryptonPage page = null;

            // If the entry is for just a placeholder...
            if (CommonHelper.StringToBool(boolStore))
            {
                // Recreate the requested store page and append
                page = new KryptonStorePage(uniqueName, "AutoHiddenGroup");
                AutoHiddenGroupControl.Pages.Add(page);
            }
            else
            {
                // Can we find a provided page to match the incoming layout?
                page = pages[uniqueName];
                if (page == null)
                {
                    // Generate event so developer can create and supply the page now
                    RecreateLoadingPageEventArgs args = new RecreateLoadingPageEventArgs(uniqueName);
                    manager.RaiseRecreateLoadingPage(args);
                    if (!args.Cancel)
                    {
                        page = args.Page;

                        // Add recreated page to the looking dictionary
                        if ((page != null) && (pages[page.UniqueName] == null))
                        {
                            pages.Add(page);
                        }
                    }
                }

                if (page != null)
                {
                    // Use the loaded visible state
                    page.Visible = CommonHelper.StringToBool(boolVisible);

                    // Create a proxy around the page and append it
                    KryptonAutoHiddenProxyPage proxyPage = new KryptonAutoHiddenProxyPage(page);
                    AutoHiddenGroupControl.Pages.Add(proxyPage);
                }
            }

            if (!xmlReader.Read())
            {
                throw new ArgumentException("An element was expected but could not be read in.");
            }

            if (xmlReader.Name != "CPD")
            {
                throw new ArgumentException("Expected 'CPD' element was not found");
            }

            bool finished = xmlReader.IsEmptyElement;

            // Generate event so custom data can be loaded and/or the page to be added can be modified
            DockPageLoadingEventArgs pageLoading = new DockPageLoadingEventArgs(manager, xmlReader, page);

            manager.RaisePageLoading(pageLoading);

            // Read everything until we get the end of custom data marker
            while (!finished)
            {
                // Check it has the expected name
                if (xmlReader.NodeType == XmlNodeType.EndElement)
                {
                    finished = (xmlReader.Name == "CPD");
                }

                if (!finished)
                {
                    if (!xmlReader.Read())
                    {
                        throw new ArgumentException("An element was expected but could not be read in.");
                    }
                }
            }

            if (!xmlReader.Read())
            {
                throw new ArgumentException("An element was expected but could not be read in.");
            }
        }