private void DeleteProfileByCredential(ICredentialsDataService credentialsDataService) { if (this.ActiveProfile == null || !this.ActiveProfile.Id.Equals(credentialsDataService.GetCredentialProfileId(this.UserName, this.Password))) { return; } this._profileDataService.Delete(this.ActiveProfile); }
public LoginViewModel( IMvxMessenger messenger, IWebNavigation webNavigation, IAppVersionService appVersionService, IRefreshDataService refreshDataService, IAuthDataService authDataService, IPlatformStyleProvider platformStyleProvider, ICredentialsDataService credentialsDataService) : base(messenger, webNavigation, appVersionService, refreshDataService, authDataService, platformStyleProvider, credentialsDataService) { }
public override void HandleError(ServerUnreachableException exception) { IAuthDataService authDataService = (IAuthDataService)Mvx.get_IoCProvider().Resolve <IAuthDataService>(); IProfileDataService profileDataService = (IProfileDataService)Mvx.get_IoCProvider().Resolve <IProfileDataService>(); M0 m0 = Mvx.get_IoCProvider().Resolve <IConnectivity>(); ICredentialsDataService credentialsDataService = (ICredentialsDataService)Mvx.get_IoCProvider().Resolve <ICredentialsDataService>(); if (((IConnectivity)m0).get_IsConnected()) { Profile profile = profileDataService.GetActiveProfile(); try { if (profile == null) { this.DisplayServerUnreachableErrorMessage(exception); } else { Credentials credentials = credentialsDataService.GetCredentials(profile?.Id); if (credentials != null) { Task.Run <Profile>((Func <Task <Profile> >)(() => authDataService.Login(profile.Institute, credentials.UserName, credentials.Password))).Wait(); } else { Task.Run <TokenData>((Func <Task <TokenData> >)(() => authDataService.RefreshToken(profile))).Wait(); } } } catch (AggregateException ex) { foreach (Exception innerException in ex.Flatten().InnerExceptions) { if (innerException is ServerUnreachableException exception1) { this.DisplayServerUnreachableErrorMessage(exception1); ErrorHandler.Current.HandleError((Exception) new RefreshTokenException("Sikertelen relogin vagy token refresh", profile).SetErrorCode <RefreshTokenException>("/Users/admin/myagent/macMiniBlack3/_work/2/s/eKreta.Mobile/eKreta.Mobile.Core.Standard/Helpers/ErrorHandlers/ServerUnreachableErrorHandler.cs", 58)); } else { ErrorHandler.Current.HandleError(innerException); } } } } else { ErrorHandler.Current.HandleError((Exception) new NoInternetConnectionException().SetErrorCode <NoInternetConnectionException>("/Users/admin/myagent/macMiniBlack3/_work/2/s/eKreta.Mobile/eKreta.Mobile.Core.Standard/Helpers/ErrorHandlers/ServerUnreachableErrorHandler.cs", 69)); } }
public NewProfileViewModel( IMvxMessenger messenger, IWebNavigation webNavigation, IAppVersionService appVersionService, IRefreshDataService refreshDataService, IAuthDataService authDataService, IPlatformStyleProvider platformStyleProvider, ICredentialsDataService credentialsDataService) { this._messenger = messenger; this._webNavigation = webNavigation; this._appVersionService = appVersionService; this._refreshDataService = refreshDataService; this._platformStyleProvider = platformStyleProvider; this._credentialsDataService = credentialsDataService; this._authDataService = authDataService; }
public CredentialsController(ICredentialsService credentialsService, ICredentialsDataService credentialsDataService) { _credentialsService = credentialsService; _credentialsDataService = credentialsDataService; }