Example #1
0
        public static async Task ApplicationStartup()
        {
            try
            {
                //Check application settings
                SettingsPage.SettingsCheck();

                //Adjust the color theme
                AppAdjust.AdjustColorTheme();

                //Adjust the font sizes
                AppAdjust.AdjustFontSizes();

                //Adjust screen rotation
                AppAdjust.AdjustScreenRotation();

                //Monitor screen rotation
                DisplayInformation.GetForCurrentView().OrientationChanged += AppAdjust.AdjustListviewRotationEvent;

                //Update internet access
                AppVariables.UpdateInternetAccess();

                //Calculate the maximum scroll load items
                Size ScreenResolution = AVFunctions.DevScreenResolution();
                if (ScreenResolution.Width > ScreenResolution.Height)
                {
                    AppVariables.ContentToScrollLoad = Convert.ToInt32(ScreenResolution.Width / 280) + 4;
                }
                else
                {
                    AppVariables.ContentToScrollLoad = Convert.ToInt32(ScreenResolution.Height / 280) + 4;
                }
                System.Diagnostics.Debug.WriteLine("Scroll load items have been set to: " + AppVariables.ContentToScrollLoad);

                //Connect to the database
                if (!DatabaseConnect())
                {
                    MessageDialog MessageDialog = new MessageDialog("Your database will be cleared, please restart the application to continue.", "Failed to connect to the database");
                    await MessageDialog.ShowAsync();

                    await DatabaseReset();

                    Application.Current.Exit();
                    return;
                }

                //Create the database tables
                await DatabaseCreate();

                //Register application timers
                AppTimers.TimersRegister();

                //Prevent application lock screen
                try { AppVariables.DisplayRequest.RequestActive(); } catch { }
            }
            catch { }
        }
Example #2
0
        public static async Task ApplicationStart()
        {
            try
            {
                Debug.WriteLine("NewsScroll startup checks.");

                //Check application settings
                await SettingsPage.SettingsCheck();

                //Create image cache folder
                AVFiles.Directory_Create(@"Cache", false, true);

                //Cleanup image download cache
                CleanImageDownloadCache();

                //Adjust the color theme
                AppAdjust.AdjustColorTheme();

                //Adjust the font sizes
                AppAdjust.AdjustFontSizes();

                //Connect to the database
                if (!DatabaseConnect())
                {
                    List <string> messageAnswers = new List <string>();
                    messageAnswers.Add("Ok");

                    string messageResult = await MessagePopup.Popup("Failed to connect to the database", "Your database will be cleared, please restart the application to continue.", messageAnswers);

                    await DatabaseReset();

                    System.Diagnostics.Process.GetCurrentProcess().Kill();
                    return;
                }

                //Create the database tables
                await DatabaseCreate();

                //Register application timers
                TimersRegister();

                //Register Application Events
                EventsRegister();

                //Prevent application lock screen
                DeviceDisplay.KeepScreenOn = true;
            }
            catch { }
        }
Example #3
0
        public static async Task ApplicationStart()
        {
            try
            {
                //Check application settings
                SettingsPage.SettingsCheck();

                //Adjust the title bar color
                await AppAdjust.AdjustTitleBarColor(null, true, true);

                //Adjust the color theme
                AppAdjust.AdjustColorTheme();

                //Adjust the font sizes
                AppAdjust.AdjustFontSizes();

                //Adjust application user agent
                //AppAdjust.AdjustUserAgent();

                //Set Landscape Display
                if ((bool)AppVariables.ApplicationSettings["DisableLandscapeDisplay"])
                {
                    DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait;
                }
                else
                {
                    DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait | DisplayOrientations.Landscape;
                }

                //Calculate the maximum preload items
                Size ScreenResolution = AVFunctions.DevScreenResolution();
                if (ScreenResolution.Width > ScreenResolution.Height)
                {
                    AppVariables.ContentToScrollLoad = Convert.ToInt32(ScreenResolution.Width / 280) + 4;
                }
                else
                {
                    AppVariables.ContentToScrollLoad = Convert.ToInt32(ScreenResolution.Height / 280) + 4;
                }
                Debug.WriteLine("Preload items has been set to: " + AppVariables.ContentToScrollLoad);

                //Connect to the database
                if (!DatabaseConnect())
                {
                    MessageDialog MessageDialog = new MessageDialog("Your database will be cleared, please restart the application to continue.", "Failed to connect to the database");
                    await MessageDialog.ShowAsync();

                    await DatabaseReset();

                    Application.Current.Exit();
                    return;
                }

                //Create the database tables
                await DatabaseCreate();

                //Register application timers
                AppTimers.TimersRegister();

                //Register application events
                Events.Events.EventsRegister();

                //Check if all items need to load
                if ((bool)AppVariables.ApplicationSettings["LoadAllItems"])
                {
                    AppVariables.ItemsToScrollLoad = 100000;
                }

                //Prevent application lock screen
                try { AppVariables.DisplayRequest.RequestActive(); } catch { }
            }
            catch { }
        }