public virtual void NavigateUserConfig() { ExceptionUtility.Try(() => { //PresentViewController(new AquamonixNavController(UserConfigViewController.CreateInstance()), true, null); this.NavigateTo(UserConfigViewController.CreateInstance(this), inCurrentNavController: false); }); }
protected override void HandleViewDidAppear(bool animated) { base.HandleViewDidAppear(animated); //UIApplication.SharedApplication.KeyWindow.AddSubview(ReconnectingOverlay.Instance); //LocationUtility.DistanceInMetersFrom(13.736717, 100.523186); if (_attemptAutoLogin) { var deviceListVc = DeviceListViewController.CreateInstance(); if (User.Current == null || !User.Current.HasConfig) { //redirect to Config VC //this.NavigationController.PushViewController(ViewControllerFactory.GetViewController<UserConfigViewController>(), true); NavigateUserConfig(); } else { ProgressUtility.SafeShow("Connecting", async() => { var userConfigVc = UserConfigViewController.CreateInstance(); var response = await ServiceContainer.UserService.RequestConnection( User.Current.Username, User.Current.Password); MainThreadUtility.InvokeOnMain(() => { ProgressUtility.Dismiss(); //on connection error, redirect to config if (response != null && response.IsSuccessful) { //redirect to device list this.NavigateTo(deviceListVc, inCurrentNavController: false); //this.PresentViewController(new AquamonixNavController(deviceListVc), true, null); } else { //this.NavigateTo(userConfigVc, inCurrentNavController: false); if (response?.ErrorBody != null && response.ErrorBody.ErrorType == Aquamonix.Mobile.Lib.Domain.Responses.ErrorResponseType.AuthFailure) { Caches.ClearCachesForAuthFailure(); } //is device cache valid? if (DataCache.HasDevices) { //redirect to device list deviceListVc.ShowConnectionError = true; this.NavigateTo(deviceListVc, inCurrentNavController: false); } else { //redirect to user config userConfigVc.ShowConnectionError = true; this.NavigateTo(userConfigVc, inCurrentNavController: false); } } }); }); } } else { this.PresentViewController(new StartViewController(true), false, null); } }