Exemple #1
0
        public void Navigate(string page)
        {
            if (string.IsNullOrEmpty(page))
            {
                mainGrid.Children.Add(MainSection);
                currentPage = MainSectionKey;
                return;
            }
            if (page == CurrentPage)
            {
                return;
            }
            switch (page)
            {
            case MainSectionKey:
                // Navigate from GameSetting to MainSection
                if (CurrentPage == GameSettingSectionKey)
                {
                    if (!mainGrid.Children.Contains(MainSection))
                    {
                        mainGrid.Children.Add(MainSection);
                    }
                    var sb = Anima.TransitionRight(mainGrid, GameSettingSection, MainSection);
                    sb.Completed += (o, e) => { mainGrid.Children.Remove(GameSettingSection); };
                    sb.Begin();
                }
                break;

            case GameSettingSectionKey:
                // Navigate from MainSection to GameSetting
                if (CurrentPage == MainSectionKey)
                {
                    if (!mainGrid.Children.Contains(GameSettingSection))
                    {
                        mainGrid.Children.Add(GameSettingSection);
                    }
                    var sb = Anima.TransitionLeft(mainGrid, MainSection, GameSettingSection);
                    sb.Completed += (o, e) => { mainGrid.Children.Remove(MainSection); };
                    sb.Begin();
                }
                break;
            }
            currentPage = page;
        }