public MainPage() { InitializeComponent(); _navigationService = DependencyContainer.Instance.GetInstance <INavigationService>(); _retroGamingService = DependencyContainer.Instance.GetInstance <IRetroGamingService>(); LoadOnDemandCard.BindingContext = new LoadOnDemandViewModel(_retroGamingService); }
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; }
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> >(); }
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()); }
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()); }