public App()
        {
            InitializeComponent();
            SetupIOC();
            defaultsFactory = App.Container.Resolve <IDefaultsFactory>();
            MessagingCenter.Subscribe <ILoginViewModel, bool>(this, "LoginStatus", (sender, args) =>
            {
                loggedIn = args;
                if (loggedIn)
                {
                    loadMainPage();
                }
                else
                {
                    ShowToast(new NotificationOptions()
                    {
                        Title            = "Oops!",
                        Description      = $"Login Failed!",
                        IsClickable      = true,
                        ClearFromHistory = true
                    });
                }
            });
            MessagingCenter.Subscribe <ITermsPage>(this, "mTermsAgreed", (sender) =>
            {
                if (defaultsFactory.GetIsLoginPageEnabled())
                {
                    loadLoginPage();
                }
                else
                {
                    loadMainPage();
                }
            });
            MessagingCenter.Subscribe <ILogoutPage>(this, "LogMeOut", (sender) =>
            {
                loggedIn = false;
                loadLoginPage();
            });

            Task.Run(async() => { await InitializeSettings(); }).Wait();

            setting = _settingsFactory.GetSettings();

            if (defaultsFactory.GetIsTermsPageEnabled())
            {
                if (string.IsNullOrEmpty(setting.AgreedToTermsDate))
                {
                    loadTermsPage();
                }
                else
                {
                    ContinueWithoutTerms();
                }
            }
            else
            {
                // if we've disabled the terms page, go ahead and wipe out the AgreedToTermsDate, this way we can easily test
                // reseting the terms without having to uninstall
                if (!string.IsNullOrEmpty(setting.AgreedToTermsDate))
                {
                    setting.AgreedToTermsDate = "";
                    var settings = _settingsService.CreateSetting(setting);
                }

                ContinueWithoutTerms();
            }
            if (defaultsFactory.GetCheckInternet() && setting.ShowConnectionErrors)
            {
                if (!CrossConnectivity.Current.IsConnected)
                {
                    ShowToast(new NotificationOptions()
                    {
                        Title       = "No Connection",
                        Description = $"Please check your internet connection!",
                        IsClickable = true,
                        //WindowsOptions = new WindowsOptions() { LogoUri = "icon.png" },
                        ClearFromHistory = true
                                           //DelayUntil = DateTime.Now.AddSeconds(0)
                    });
                }
            }
            CrossConnectivity.Current.ConnectivityChanged += ConnectionError;
            var wifi = Plugin.Connectivity.Abstractions.ConnectionType.WiFi;

            if (defaultsFactory.GetShowWifiErrors())
            {
                var connectionTypes = CrossConnectivity.Current.ConnectionTypes;
                if (!connectionTypes.Contains(wifi))
                {
                    ShowToast(new NotificationOptions()
                    {
                        Title       = "Wifi Not Detected",
                        Description = $"Please turn Wifi On!",
                        IsClickable = true,
                        //WindowsOptions = new WindowsOptions() { LogoUri = "icon.png" },
                        ClearFromHistory = true
                                           //DelayUntil = DateTime.Now.AddSeconds(0)
                    });
                }
            }
        }