Example #1
0
        public MainPage()
        {
            Logger.Log("MainPage:Constructor: called");
            //SLOW: Inititalizing components takes 2020 milliseconds
            this.InitializeComponent();

            Logger.LogBlock = uiLog;
            Logger.Log("MainPage:Constructor: called and components initialized");
            Nav.AddNavigateTo(Navigator.NavigateControlId.ChapterDisplay, uiChapterControl);
            Nav.AddNavigateTo(Navigator.NavigateControlId.MainReader, uiReaderControl);
            Nav.AddNavigateTo(Navigator.NavigateControlId.ProjectRome, RomeActivity);
            // Will be added automatically as needed: Nav.AddSelectTo(Navigator.NavigateControlId.WebSearchDisplay, uiWebSearchControl);
            // SimpleBookHandler is just for notes, not really "books" per se.
            Nav.AddSimpleBookHandler(Navigator.NavigateControlId.MainPage, this);
            Nav.AddSimpleBookHandler(Navigator.NavigateControlId.NoteListDisplay, uiNoteList);
            Nav.AddSimpleBookHandler(Navigator.NavigateControlId.BookSearchDisplay, uiBookSearchControl);
            Nav.AddSimpleBookHandler(Navigator.NavigateControlId.ProjectRome, RomeActivity);
            Nav.AddSetAppColor(Navigator.NavigateControlId.MainPage, this);
            Nav.AddSetAppColor(Navigator.NavigateControlId.MainReader, uiReaderControl);

            Nav.MainBookHandler         = uiReaderControl;
            uiReaderControl.SetChapters = uiChapterControl;
            uiReaderControl.SetImages   = uiImageControl;
            uiReaderControl.SetImages2  = RomeActivity;
            uiReaderControl.SetImages3  = this;

            uiNoteList.ParentCommandBar          = uiSecondDisplayCommandBar;
            uiWebSearchControl.ParentCommandBar  = uiSecondDisplayCommandBar;
            uiBookSearchControl.ParentCommandBar = uiSecondDisplayCommandBar;

            // Customization has to happen after the MainBookHandler is set up.
            var userCustomization = (App.Current as App).Customization;

            userCustomization.Initialize();

            this.Loaded += MainPage_Loaded;


            // Update the title bar. Reset back to the original default colors.
            // Need to do this because I horked everything :-)
#if NEVER_EVER_DEFINED
            if (false)
            {
                var uis      = new UISettings();
                var titleBar = ApplicationView.GetForCurrentView().TitleBar;
                var dict     = App.Current.Resources;
                titleBar.BackgroundColor       = uis.GetColorValue(UIColorType.Background);
                titleBar.ForegroundColor       = uis.GetColorValue(UIColorType.Foreground);
                titleBar.ButtonBackgroundColor = uis.GetColorValue(UIColorType.Background);
                titleBar.ButtonForegroundColor = (Color)Resources["SystemAccentColor"];
                //uis.GetColorValue(UIColorType.Foreground);
            }
#endif

            // COLORTHEME: no colors
            // // // this.ActualThemeChanged += MainPage_ActualThemeChanged;
            // // // UISettings = new UISettings();
            // // // UISettings.ColorValuesChanged += UISettings_ColorValuesChanged;
            Logger.Log("MainPage:Constructor: returning");
        }