コード例 #1
0
        public MainPage()
        {
            InitializeComponent();
            _navigationService  = DependencyContainer.Instance.GetInstance <INavigationService>();
            _retroGamingService = DependencyContainer.Instance.GetInstance <IRetroGamingService>();

            LoadOnDemandCard.BindingContext = new LoadOnDemandViewModel(_retroGamingService);
        }
コード例 #2
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;
        }
コード例 #3
0
        public RetroGamesViewModel(INavigationService navigationService, IRetroGamingService retroGamingService, ErrorEmulator errorEmulator)
            : base(navigationService)
        {
            _retroGamingService = retroGamingService;

            ErrorEmulatorViewModel = new ErrorEmulatorViewModel(errorEmulator, () => Loader.Load(InitializeAsync));

            // TaskStartMode = Auto
            // Loader = new TaskLoaderNotifier<List<Game>>(InitializeAsync);

            // TaskStartMode = Manual (Default mode)
            Loader = new TaskLoaderNotifier <List <Game> >();
        }
コード例 #4
0
        public RetroGamesIsBusyViewModel(
            INavigationService navigationService,
            IRetroGamingService retroGamingService,
            ErrorEmulator errorEmulator)
            : base(navigationService)
        {
            _retroGamingService = retroGamingService;

            ErrorEmulatorViewModel = new ErrorEmulatorViewModel(errorEmulator, () => Load());

            RefreshCommand = new Command(() => Load(true));
            ReloadCommand  = new Command(() => Load());
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        public LoadOnDemandViewModel(IRetroGamingService retroGamingService)
        {
            _retroGamingService = retroGamingService;

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