public NavigationButtonViewModel(IUserService service, IUserAccountManager manager) { _service = service; ClickCommand = new RelayCommand(async args => { if (_service.User.Id == null) { await manager.LoginAsync(); } else { manager.NavigateToMyAccount(); } }); }
public RequestSignInViewModel(IUserAccountManager manager, TaskCompletionSource <bool> source, string text) { _source = source; Text = text; CreateAccountCommand = new RelayCommand(async args => { taskCompletionSource.SetResult(true); source.SetResult(await manager.RegisterAsync()); }); SignInCommand = new RelayCommand(async args => { taskCompletionSource.SetResult(true); source.SetResult(await manager.LoginAsync()); }); }
public RegisterViewModel(IUserAccountManager manager, PanaceaServices core, TaskCompletionSource <bool> source) { _core = core; _source = source; LoginCommand = new RelayCommand(async arg => { _waitingForAnotherTask = true; var res = await manager.LoginAsync(); _waitingForAnotherTask = false; source.TrySetResult(res); }); RegisterCommand = new AsyncCommand(async arg => { await RegisterAsync(); }); }