コード例 #1
0
                public void ShouldReturnTrue()
                {
                    var command = new MvxAsyncCommand(() => Task.Delay(TimeSpan.FromSeconds(1)));

                    command.Execute();

                    Assert.IsTrue(command.CancelExecution());
                }
コード例 #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();
        }
コード例 #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);
     });
 }
コード例 #4
0
 public ImageViewParamClickBinding(MvxParamCommandImageView imageView) : base(imageView)
 {
     _imageView = imageView;
     if (_imageView != null)
     {
         _imageView.Click += (s, e) =>
         {
             if (ClickCommand != null)
             {
                 ClickCommand.Execute(_imageView.ItemId);
             }
         };
     }
 }
コード例 #5
0
                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);
                }
コード例 #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();
 }
コード例 #7
0
 public MvxMainViewModel(IMvxNavigationService navigationService)
 {
     _navigationService     = navigationService;
     NavigateToLoginCommand = new MvxAsyncCommand(NavigateToLogin);
     NavigateToLoginCommand.Execute();
 }