TopShelfCustomer/TopShelfCustomer/App.xaml.cs
/// <summary>
/// SetCurrentPage:
///
/// Attempts to find a page of type T in the application's state.
/// If no page is found, it creates a new one and navigates to it.
/// </summary>


Attempts to find a page of type T in the application's state.
If no page is found, it creates a new one and navigates to it.
Attempts to find a page of type T in the application ' s state . If no page is found it creates a new one and navigates to it .
public static void SetCurrentPage<T> () where T : Page {
            foreach ( Page page in PageContainer.Views ) {      
                if ( page is T ) {
                    Current.MainPage = page;
                    return;
                }
            }
            var newPage = (T)Activator.CreateInstance( typeof( T ) );
            PageContainer.Views.Add( newPage );       
            Current.MainPage = newPage;     
        }
public static void SetCurrentPage < T > ( ) where T : Page { foreach ( Page page in PageContainer . Views ) { if ( page is T ) { Current . MainPage = page ; return ; } } var newPage = ( T ) Activator . CreateInstance ( typeof ( T ) ) ; PageContainer . Views . Add ( newPage ) ; Current . MainPage = newPage ; }
SetCurrentPage:
SetCurrentPage :
//Check if Page of type T already exists /* Page didn't exist */ //Add passed Page to the PageContainer static class //Set the current page