public bool UnRegisterAccount(WsAccountRepository accountRepository) { if (accountRepository.UnRegisterAccount(_account)) { if (_apiClient.IsLoggedIn) { using (ThreadKeeper exec = new ThreadKeeper()) { exec.ExecAsync((cancellationToken) => _apiClient.Logout()); } } return(true); } return(false); }
public static bool TryRegisterAccount(WsAccountRepository accountRepository, TcUIProvider uiProvider, WsAccountLoginInfo userCredential, out WsAccountAccessor accountAccessor) { WsAccountRepository.SuccessAccountRegistrationInfo successRegistration; using (ThreadKeeper exec = new ThreadKeeper()) { successRegistration = exec.ExecAsync((cancellationToken) => accountRepository.TryRegisterAccount(userCredential)); } if (successRegistration != null) { accountAccessor = new WsAccountAccessor(successRegistration.Account, uiProvider, successRegistration.ConnectedApiClient); return(true); } accountAccessor = null; return(false); }
public WsAccountCollection(TcUIProvider uiProvider) { _uiProvider = uiProvider; _accountRepository = new WsAccountRepository(new TcDataProtector(), "TotalCommander"); _accountAccessors = new List <WsAccountAccessor>(_accountRepository.Select(a => new WsAccountAccessor(a, uiProvider, _accountRepository.GetDeviceUuid())).ToArray()); }