public AddGameViewModel(IRepository repository, IBggService bggService, INotificationService notificationService)
        {
            _repository          = repository;
            _bggService          = bggService;
            _notificationService = notificationService;

            _availableSoloModes =
                new ReadOnlyCollection <SoloModeViewModel>(
                    ((SoloMode[])Enum.GetValues(typeof(SoloMode))).Select(p => new SoloModeViewModel(p)).ToList());

            _repository.Games
            .Sort(SortExpressionComparer <GameModel> .Ascending(p => p.Name))
            .Transform(p => new AvailableGameViewModel(p.Id, p.Name))
            .ObserveOn(RxApp.MainThreadScheduler)
            .Bind(out _availableGames).Subscribe();

            SetInitialValues();
            AddValidationRules();

            this.WhenAnyValue(x => x.BggGameName)
            .Throttle(TimeSpan.FromMilliseconds(400))
            .Select(term => term?.Trim())
            .DistinctUntilChanged()
            .Where(term => !string.IsNullOrWhiteSpace(term))
            .Select(SearchBggGames)
            .ObserveOn(RxApp.MainThreadScheduler)
            .Subscribe(async p => await AssignAvailableBggGames(p));

            this.WhenAnyValue(x => x.SelectedBggGame)
            .Throttle(TimeSpan.FromMilliseconds(400))
            .Select(LoadBggGameDetail)
            .ObserveOn(RxApp.MainThreadScheduler)
            .Subscribe(async p => await AssignSelectedBggGameDetail(p));

            var canSave = WhenDataErrorsChanged.Select(p => !p);

            Save = ReactiveCommand.CreateFromTask(SaveGame, canSave);
        }
 public Authenticator(IBggService bggService)
 {
     BggService = bggService;
 }
Esempio n. 3
0
 public Logger(IBggService bggService)
 {
     BggService = bggService;
 }
 public BGGApiController(IBggService bggService)
 {
     this.bggService = bggService;
 }
Esempio n. 5
0
 public GamesController(BoardGameContext db, IBggService bggService)
 {
     this.db         = db;
     this.bggService = bggService;
 }
Esempio n. 6
0
 public Processor(IBggService bggService)
 {
     BggService = bggService;
     Summary    = new Summary();
 }