コード例 #1
0
 public AsyncViewModel()
 {
     //this.asyncCommand = DelegateCommand.FromAsyncHandler(this.GetListAsync);
     this.asyncCommandFromHandler = DelegateCommand.FromAsyncHandler(this.LoadHousesAsync);
     this.asyncCommand = new DelegateCommand(this.GetHousesAction); // wrong
     this.asyncCommandOwn = new AsyncCommand(this.LoadHousesAsync);
     
     this.Status = "StartUp";
 }
コード例 #2
0
ファイル: UnitTest1.cs プロジェクト: AlexJCross/LearningsInC
        public async Task AsyncCommandOwn()
        {
            var vm = new AsyncViewModel();

            var a = new AsyncCommand(null);

            Task executeCommand = vm.AsyncCommandOwn.ExecuteAsync();

            Assert.IsFalse(vm.AsyncCommandOwn.CanExecute());

            await executeCommand;

            Assert.IsTrue(vm.AsyncCommandOwn.CanExecute());
            Assert.AreEqual(vm.Status, "Downloaded 5 houses.");
        }