예제 #1
0
        /// <summary>
        /// Transistion from one Page to another
        /// </summary>
        /// <param name="newContent">New page to display once transistion is complete</param>
        /// <returns></returns>
        private async Task transitionContentTo(Page newContent)
        {
            // Use type pattern matching to call AnimateOut() method
            switch (mainWindowContent.Content)
            {
            case Home homePage:
                if (mainWindowContent.Content != homePage)
                {
                    await homePage.AnimateOut();
                }
                break;

            case Products productPage:
                if (mainWindowContent.Content != productPage)
                {
                    await productPage.AnimateOut();
                }
                break;

            case Support supportPage:
                if (mainWindowContent.Content != supportPage)
                {
                    await supportPage.AnimateOut();
                }
                break;

            case About aboutPage:
                if (mainWindowContent.Content != aboutPage)
                {
                    await aboutPage.AnimateOut();
                }
                break;
            }

            // Loading it animates it in
            mainWindowContent.Content = newContent;
        }