public GroupDetailViewModel(Dictionary <CupYear, IRepo <string, Group> > groupsByYear, IHaveCupYear hasCupYear, IHaveOverviewItem overview)
        {
            _groupsByYear = groupsByYear;
            _hasCupYear   = hasCupYear;
            _overview     = overview;

            this.WhenActivated(disposables =>
            {
                this.WhenAnyValue(
                    x => x._hasCupYear.SelectedYear,
                    x => x._overview.SelectedItem,
                    UpdateDetail)
                .Subscribe()
                .DisposeWith(disposables);
            });
        }
Esempio n. 2
0
        public GoalsDetailViewModel(Dictionary <CupYear, IRepo <int, Match> > matchesByYear, IHaveCupYear hasCupYear, IHaveOverviewItem overview)
        {
            _matchesByYear = matchesByYear;
            _hasCupYear    = hasCupYear;
            _overview      = overview;

            this.WhenActivated(disposables =>
            {
                this.WhenAnyValue(
                    x => x._hasCupYear.SelectedYear,
                    x => x._overview.SelectedItem,
                    UpdateDetail)
                .Subscribe()
                .DisposeWith(disposables);
            });
        }
        public DetailConductor(IWorldCupRepo worldCupRepo, IHaveCupYear hasCupYear, IHaveOverviewItem overview)
        {
            _worldCupRepo = worldCupRepo;
            _hasCupYear   = hasCupYear;
            _overview     = overview;

            this.WhenActivated(disposables =>
            {
                this.WhenAnyValue(x => x.SelectedDetail, SwitchDetail)
                .Subscribe()
                .DisposeWith(disposables);

                var canRefresh =
                    this.WhenAnyValue(x => x.ActiveItem)
                    .Select(item => item is EmptyDetailViewModel);

                var canCleanUp = canRefresh.Select(x => !x);

                CleanUpCommand = ReactiveCommand.CreateFromTask(CleanUp, canCleanUp).DisposeWith(disposables);

                RefreshCommand = ReactiveCommand.Create(() => SwitchDetail(SelectedDetail), canRefresh).DisposeWith(disposables);
            });
        }
        public OverviewViewModel(Dictionary <CupYear, IRepo <int, Match> > matchesByYear, IHaveCupYear hasCupYear)
        {
            _matchesByYear = matchesByYear;

            this.WhenInitialized(disposables =>
            {
                hasCupYear
                .WhenAnyValue(x => x.SelectedYear, UpdateOverview)
                .Subscribe()
                .DisposeWith(disposables);
            });
        }