Пример #1
0
 internal static void SwitchPage(Page page)
 {
     if (Pages.First(x => x.GetType() == page.GetType()) != null)
     {
         Pages.RemoveAll(x => x.GetType() == page.GetType());
     }
     Pages.Add(page);
     PageContent.Content = page.Content;
 }
Пример #2
0
 public TabItem AddFrame(Page _window)
 {
     TabItem tabitem = new TabItem();
     tabitem.Header = "Tab: " + _window.GetType().Name;
     Frame tabFrame = new Frame();
     _window.GetType();
     tabitem.Tag = _window.GetType().Name;
     tabFrame.Content = _window;
     tabitem.Content = tabFrame;
     TabControl.Items.Add(tabitem);
     tabitem.Focus();
     return tabitem;
 }
Пример #3
0
 /// <summary>
 /// Switches the contents of the frame to the requested page. Also sets background on
 /// the button on the top to show what section you are currently on.
 /// </summary>
 internal static void SwitchPage(Page page)
 {
     IsOnPlayPage = page is PlayPage;
     //Dont cache important pages
     if (!(page is LoginPage ||
           page is CustomGameLobbyPage ||
           page is ChampSelectPage ||
           page is CreateCustomGamePage))
     {
         foreach (Page p in Pages) //Cache pages
         {
             if (p.GetType() == page.GetType())
             {
                 Container.Content = p.Content;
                 return;
             }
         }
     }
     Container.Content = page.Content;
     if (!(page is FakePage))
         Pages.Add(page);
 }
Пример #4
0
 /// <summary>
 /// Clears the cache of a certain page if not used anymore
 /// </summary>
 internal static void ClearPage(Page page)
 {
     foreach (Page p in Pages.ToArray())
     {
         if (p.GetType() == page.GetType())
         {
             Pages.Remove(p);
             return;
         }
     }
 }
Пример #5
0
 /// <summary>
 /// Switches the contents of the frame to the requested page. Also sets background on
 /// the button on the top to show what section you are currently on.
 /// </summary>
 internal static void SwitchPage(Page page)
 {
     IsOnPlayPage = page is PlayPage;
     foreach (Page p in Pages) //Cache pages
     {
         if (p.GetType() == page.GetType())
         {
             Container.Content = p.Content;
             return;
         }
     }
     Container.Content = page.Content;
     if (!(page is FakePage))
         Pages.Add(page);
 }
Пример #6
0
        /// <summary>
        ///     Switches the contents of the frame to the requested page. Also sets background on
        ///     the button on the top to show what section you are currently on.
        /// </summary>
        internal static void SwitchPage(Page page)
        {
            Log("Switching to the page: " + page.GetType());
            IsOnPlayPage = page is PlayPage;
            BackgroundImage.Visibility = page is ChampSelectPage
                ? Visibility.Hidden
                : Visibility.Visible;

            if (page is MainPage)
            {
                Page p = Pages.FirstOrDefault(x => x is MainPage);
                var mainPage = p as MainPage;
                if (mainPage != null)
                    mainPage.UpdateSummonerInformation();
            }

            TrueCurrentPage = page;
            foreach (Page p in Pages.Where(p => p.GetType() == page.GetType()))
            {
                Container.Content = p.Content;
                return;
            }

            Container.Content = page.Content;
            Pages.Add(page);
        }
 /// <summary>
 /// Navigates the specified page.
 /// </summary>
 /// <param name="page">The page.</param>
 internal void Navigate(Page page)
 {
     _logger.Info("Navigating to " + page.GetType().Name);
     
     Dispatcher.InvokeAsync(() => PageFrame.NavigateWithTransition(page));
 }
Пример #8
0
 public void Navigate(Page page)
 {
     CurrentPage = page.GetType().ToString().Replace("WPBackup.", "");
     if (OnNavigate != null)
     {
         NavigationHandler = null;
         OnNavigate(this, new NavigateEventArgs(page));
         Refresh();
     }
 }
Пример #9
0
 public static void AddPage(Page page)
 {
     AddPage(page.GetType().Name,page);
 }