예제 #1
0
        public LoadOnDemandViewModel(IRetroGamingService retroGamingService)
        {
            _retroGamingService = retroGamingService;

            var cts = new CancellationTokenSource();

            // For testing the TaskMonitorConfiguration.ConsiderCanceledAsFaulted = true setting
            // cts.Cancel();

            RandomGameLoaderCommand = new TaskLoaderCommand <object, Game>(_ => GetRandomGame(cts.Token));
            RandomGameLoaderCommand.CanExecuteChanged += RandomGameLoaderCommandCanExecuteChanged;
        }
예제 #2
0
        public GridPageViewModel(INavigationService navigationService, ISillyDudeService sillyDudeService)
            : base(navigationService)
        {
            _sillyDudeService = sillyDudeService;

            InitCommands();

            SillyPeople               = new ObservableRangeCollection <SillyDudeVmo>();
            SillyPeoplePaginator      = new Paginator <SillyDude>(LoadSillyPeoplePageAsync, pageSize: PageSize);
            SillyPeopleLoaderNotifier = new TaskLoaderNotifier <IReadOnlyCollection <SillyDude> >();

            GoBackCommand = new TaskLoaderCommand(() => NavigationService.NavigateBackAsync());
        }
예제 #3
0
        public HeaderFooterGroupingPageViewModel(INavigationService navigationService, ISillyDudeService sillyDudeService)
            : base(navigationService)
        {
            _sillyDudeService = sillyDudeService;

            InitCommands();

            SillyPeople               = new List <IDudeItem>();
            SillyPeoplePaginator      = new Paginator <SillyDude>(LoadSillyPeoplePageAsync, pageSize: PageSize);
            SillyPeopleLoaderNotifier = new TaskLoaderNotifier <IReadOnlyCollection <SillyDude> >();

            GoBackCommand = new TaskLoaderCommand(() => NavigationService.NavigateBackAsync());
        }
        public CommandsPageViewModel(INavigationService navigationService, IRetroGamingService retroGamingService)
            : base(navigationService)
        {
            _retroGamingService = retroGamingService;

            Loader = new TaskLoaderNotifier <Game>();

            BuyGameCommand     = new TaskLoaderCommand(BuyGame);
            PlayTheGameCommand = new TaskLoaderCommand(PlayTheGame);

            CompositeNotifier = new CompositeTaskLoaderNotifier(
                BuyGameCommand.Notifier,
                PlayTheGameCommand.Notifier);
        }
        public LoadOnDemandViewModel(IRetroGamingService retroGamingService)
        {
            _retroGamingService = retroGamingService;

            RandomGameLoaderCommand = new TaskLoaderCommand <object, Game>(_ => GetRandomGame());
        }