Пример #1
0
        /// <summary>
        /// Opens the page on the given switcher, setting it as the current page.
        /// Runs the page's lifecycle methods if it implements IPageCleanupable or IPageReadyable.
        /// </summary>
        /// <param name="switcher">The switcher that the page is associated with</param>
        /// <param name="page">The page to set as the current page for the given switcher</param>
        public void OpenPageOnSwitcher(NetPageSwitcher switcher, NetPage page)
        {
            if (switcher.CurrentPage is IPageCleanupable cleanupable)
            {
                cleanupable.OnPageDeactivated();
            }

            if (page is IPageReadyable readyable)
            {
                readyable.OnPageActivated();
            }

            switcher.SetActivePage(page);
        }