/*** Page Events *******************************************************************************************************/ /// <summary> /// Set size of buttons defined in MainPage.xaml to same size. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Page_Loaded(object sender, RoutedEventArgs e) { _ = sender; // Discard unused parameter. _ = e; // Discard unused parameter. TblkAppTitle.Text = resourceLoader.GetString("MP_TblkAppName"); // Set MainPage public values XAML variables so can be called from library LibMPC. mainPageScrollViewer = ScrollViewerMP; mainPageButBack = ButBack; mainPageButAbout = ButAbout; mainPageButSettings = ButSettings; // Back-a-page navigation event handler. Invoked when software or hardware back button is selected, // or Windows key + Backspace is entered, or say, "Hey Cortana, go back". SystemNavigationManager.GetForCurrentView().BackRequested += BackRequestedPage; // Get App data store location. // https://msdn.microsoft.com/windows/uwp/app-settings/store-and-retrieve-app-data#local-app-data applicationDataContainer = ApplicationData.Current.LocalSettings; LibMPC.CustomizeAppTitleBar(); List <Button> listButtonsThisPage = new List <Button>() { ButBack, ButAbout, ButSettings }; LibMPC.SizePageButtons(listButtonsThisPage); // TODO: set next line to EnumResetApp.DoNothing before store publish. AppReset(EnumResetApp.DoNothing); // Reset App to various states. // TODO: Comment out next 5 code lines before App publish. // StorageFolder storageFolderApp = ApplicationData.Current.LocalFolder; // Debug.WriteLine($"MainPage().Page_Loaded(): storageFolderApp.Path={storageFolderApp.Path}"); // AppReset(EnumResetApp.ShowDataStoreValues); // Show data store values. // https://stackoverflow.com/questions/12799619/how-to-get-actual-language-in-a-winrt-app/15135121#15135121 // Debug.WriteLine($"MainPage().Page_Loaded(): Device culture is {LibMPC.GetCulture(true)}"); // https://msdn.microsoft.com/en-us/library/windows/apps/hh694557.aspx?f=255&MSPPError=-2147217396 // Debug.WriteLine($"MainPage().Page_Loaded(): Current application culture is {LibMPC.GetCulture(false)}"); // Get application culture. Some translations may need this value to tweak page output display. stringCultureCurrent = LibMPC.GetCulture(false); // Get data store values for next four items and set to true or false. boolLockerFolderSelected = LibMPC.DataStoreStringToBool(applicationDataContainer, ds_BoolLockerFolderSelected); boolAppPurchased = LibMPC.DataStoreStringToBool(applicationDataContainer, ds_BoolAppPurchased); boolAppRated = LibMPC.DataStoreStringToBool(applicationDataContainer, ds_BoolAppRated); boolVerbose = LibMPC.DataStoreStringToBool(applicationDataContainer, ds_BoolVerbose); // AppReset(EnumResetApp.ShowDataStoreValues); // TODO: Comment out this line before store publish. Show data store values. LibMPC.ScrollViewerOff(mainPageScrollViewer); // Turn ScrollViewerMP off for now. Individual pages will set it as required. NavigateFirstPage(); }
/// <summary> /// Code that runs after page is loaded that will not execute properly until page is rendered. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Page_Loaded(object sender, RoutedEventArgs e) { _ = sender; // Discard unused parameter. _ = e; // Discard unused parameter. List <Button> listButton = new List <Button>() { ButBack, ButAbout, ButSamples }; LibMPC.SizePageButtons(listButton); LibMPC.ScrollViewerOff(mainPageScrollViewer); // Turn ScrollViewerMP off for now. Individual pages will set it as required. ShowPageHome(); }
/*** Page Events *******************************************************************************************************/ /// <summary> /// Initialize settings for this page and set visibility of title bar items. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Page_Loaded(object sender, RoutedEventArgs e) { _ = sender; // Discard unused parameter. _ = e; // Discard unused parameter. // Set MainPage public values XAML variables so can be called from library LibMPC. mainPageScrollViewer = ScrollViewerMP; mainPageButBack = ButBack; mainPageButAbout = ButAbout; mainPageButLabels = ButLabels; mainPageButReverse = ButReverse; mainPageButRotate = ButRotate; mainPageTblkAppTitle = TblkAppTitle; // Back-a-page navigation event handler. Invoked when software or hardware back button is selected, // or Windows key + Backspace is entered, or say, "Hey Cortana, go back". SystemNavigationManager.GetForCurrentView().BackRequested += BackRequestedPage; // Get App data store location used to write or read various settings to or from location. // https://msdn.microsoft.com/windows/uwp/app-settings/store-and-retrieve-app-data#local-app-data applicationDataContainer = ApplicationData.Current.LocalSettings; // Comment out next two lines before store publish. // StorageFolder storageFolderApp = ApplicationData.Current.LocalFolder; // Debug.WriteLine($"storageFolderApp.Path={storageFolderApp.Path}"); LibMPC.CustomizeAppTitleBar(); List <Button> listButtonsThisPage = new List <Button>() { ButBack, ButAbout, ButLabels, ButReverse, ButRotate }; LibMPC.SizePageButtons(listButtonsThisPage); // TODO: set next line to EnumResetApp.DoNothing before store publish. AppReset(EnumResetApp.DoNothing); // Reset App to various states using parameter enumResetApp. // Get data store values for next two items and set to true or false. boolAppPurchased = LibMPC.DataStoreStringToBool(applicationDataContainer, ds_BoolAppPurchased); boolAppRated = LibMPC.DataStoreStringToBool(applicationDataContainer, ds_BoolAppRated); // AppReset(EnumResetApp.ShowDataStoreValues); // TODO: Comment out this line before store publish. Show data store values. LibMPC.ScrollViewerOff(ScrollViewerMP); // Turn mainScroller off for now. Individual pages will set it as required. NavigateToPageStart(); }