TopShelfCustomer/TopShelfCustomer/App.xaml.cs
/// <summary>
/// SetNewPage:
///
/// Attempts to find the page (of type T) in the application's state.
/// If a page is found, it removes it from the application's state
/// and creates a new instance of it. Then it navigates to the newly
/// created page.
/// </summary>
/// <typeparam name="T"></typeparam>


Attempts to find the page (of type T) in the application's state.
If a page is found, it removes it from the application's state
and creates a new instance of it. Then it navigates to the newly
created page.
Attempts to find the page ( of type T ) in the application ' s state . If a page is found it removes it from the application ' s state and creates a new instance of it . Then it navigates to the newly created page .
public static void SetNewPage<T> () where T : Page {
            foreach ( Page page in PageContainer.Views ) {
                if ( page is T ) {
                    if ( PageContainer.Views.Contains( page ) ) {
                        PageContainer.Views.Remove( page );
                    }
                    var freshPage = (T)Activator.CreateInstance( typeof( T ) );
                    PageContainer.Views.Add( freshPage );
                    Current.MainPage = freshPage;
                    break;
                }
            }
            var newPage = (T)Activator.CreateInstance( typeof( T ) );
            PageContainer.Views.Add( newPage );
            Current.MainPage = newPage;
        }
public static void SetNewPage < T > ( ) where T : Page { foreach ( Page page in PageContainer . Views ) { if ( page is T ) { if ( PageContainer . Views . Contains ( page ) ) { PageContainer . Views . Remove ( page ) ; } var freshPage = ( T ) Activator . CreateInstance ( typeof ( T ) ) ; PageContainer . Views . Add ( freshPage ) ; Current . MainPage = freshPage ; break ; } } var newPage = ( T ) Activator . CreateInstance ( typeof ( T ) ) ; PageContainer . Views . Add ( newPage ) ; Current . MainPage = newPage ; }
SetNewPage:
SetNewPage :
/* Page didn't exist */
typeparam
None