Exemplo n.º 1
0
        protected async override void OnResume()
        {
            try
            {
                AppCrossConnectivity.Init(CrossConnectivity.Current);
                UserDialogs.Instance.ShowLoading("Reconnecting, please wait...");

                if (AppCrossConnectivity.Instance.IsConnected)
                {
                    var keyValueCacheUtility = Container.Resolve <IDependencyService>().Get <IKeyValueCacheUtility>();
                    UserName = keyValueCacheUtility.GetUserDefaultsKeyValue("Username");
                    Password = keyValueCacheUtility.GetUserDefaultsKeyValue("Password");

                    if (!string.IsNullOrEmpty(UserName) && !string.IsNullOrEmpty(Password))
                    {
                        await PostFeedSpokeStatic.LogonToHubFake(UserName, Password);
                    }

                    await ShowLocalNotifications();
                }

                Container.Resolve <IDependencyService>().Get <IHelperUtility>().ResetPackageVersionNo();
            }
            catch (Exception ex)
            {
                Container.GetContainer().Resolve <IDependencyService>().Get <ILogger>().Log(ex);
            }
            finally
            {
                UserDialogs.Instance.HideLoading();
            }
        }
Exemplo n.º 2
0
        //chito. this code is just put to public here to be unit tested
        public async Task OnResumePublic()
        {
            try
            {
                UserDialogs.Instance.ShowLoading("Reconnecting, please wait...");

                if (AppCrossConnectivity.Instance.IsConnected)
                {
                    var keyValueCacheUtility = Container.Resolve <IDependencyService>().Get <IKeyValueCacheUtility>();
                    UserName = keyValueCacheUtility.GetUserDefaultsKeyValue("Username");
                    Password = keyValueCacheUtility.GetUserDefaultsKeyValue("Password");

                    if (!string.IsNullOrEmpty(UserName) && !string.IsNullOrEmpty(Password))
                    {
                        await PostFeedSpokeStatic.LogonToHubFake(UserName, Password);
                    }

                    await ShowLocalNotifications();
                }
            }
            catch (Exception ex)
            {
                ProcessErrorReportingForHockeyApp(ex);
            }
            finally
            {
                UserDialogs.Instance.HideLoading();
            }
        }