Exemplo n.º 1
0
 public NavigationButtonViewModel(IUserService service, IUserAccountManager manager)
 {
     _service     = service;
     ClickCommand = new RelayCommand(async args =>
     {
         if (_service.User.Id == null)
         {
             await manager.LoginAsync();
         }
         else
         {
             manager.NavigateToMyAccount();
         }
     });
 }
Exemplo n.º 2
0
        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());
            });
        }
Exemplo n.º 3
0
 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();
     });
 }