public void ShouldReturnTrue()
                {
                    var command = new MvxAsyncCommand(() => Task.Delay(TimeSpan.FromSeconds(1)));

                    command.Execute();

                    Assert.IsTrue(command.CancelExecution());
                }
Exemplo n.º 2
0
        public MainViewModel(IMvxNavigationService navigationService, IDataBaseService dataBaseService) : base(navigationService, dataBaseService)
        {
            _dataBaseService          = dataBaseService;
            _navigationService        = navigationService;
            ShowTableViewModelCommand = new MvxAsyncCommand(async() => { await Task.Delay(500); await _navigationService.Navigate <TableViewModel>(); });

            ShowTableViewModelCommand.Execute();
        }
Exemplo n.º 3
0
 public LoginViewModel(IMvxNavigationService navigationService, ILoginService loginService, ITaskService iTaskService)
 {
     ShowListTaskViewCommand         = new MvxAsyncCommand(async() => await _navigationService.Navigate <ListTaskViewModel>());
     _iTaskService                   = iTaskService;
     _loginService                   = loginService;
     _navigationService              = navigationService;
     LoginCommand                    = new MvxCommand(_loginService.LoginInstagram);
     _loginService.OnLoggedInHandler = new Action(() =>
     {
         CreateNewUser();
         ShowListTaskViewCommand.Execute(null);
     });
 }
Exemplo n.º 4
0
 public ImageViewParamClickBinding(MvxParamCommandImageView imageView) : base(imageView)
 {
     _imageView = imageView;
     if (_imageView != null)
     {
         _imageView.Click += (s, e) =>
         {
             if (ClickCommand != null)
             {
                 ClickCommand.Execute(_imageView.ItemId);
             }
         };
     }
 }
                public void ShouldCancelCommandExecution()
                {
                    Setup();

                    var task    = default(Task);
                    var command = new MvxAsyncCommand(
                        cancellationToken => task = Task.Delay(TimeSpan.FromSeconds(1), cancellationToken)
                        );

                    command.Execute();
                    command.CancelExecution();

                    Assert.IsTrue(task.IsCanceled);
                }
Exemplo n.º 6
0
 public LoginViewModel(IMvxNavigationService navigationService, ILoginService loginService, ITaskService taskService, IUserService userService, IAlertService alertService)
     : base(navigationService)
 {
     _taskService            = taskService;
     _loginService           = loginService;
     _userService            = userService;
     _alertService           = alertService;
     LoginCommand            = new MvxCommand(_loginService.LoginInstagram);
     ShowListTaskViewCommand = new MvxAsyncCommand(LoginWebView);
     LoginWebViewCommand     = new MvxAsyncCommand(async() => await _navigationService.Navigate <LoginWebViewModel>());
     if (Connectivity.NetworkAccess == NetworkAccess.Internet)
     {
         ChangedNetworkAccess = true;
     }
     Connectivity.ConnectivityChanged += Connectivity_ConnectivityChanged;
     _loginService.OnLoggedInHandler   = new Action(() =>
     {
         CreateNewUser();
         ShowListTaskViewCommand.Execute(null);
     });
     _listPointsCanvas = new List <double>();
     AddListPointsCanvas();
 }
Exemplo n.º 7
0
 public MvxMainViewModel(IMvxNavigationService navigationService)
 {
     _navigationService     = navigationService;
     NavigateToLoginCommand = new MvxAsyncCommand(NavigateToLogin);
     NavigateToLoginCommand.Execute();
 }