Example #1
0
        public async void OpenSeasonActionAsync()
        {
            var league = this;
            var matchs = await _openLigaService.LoadMatchesAsync(league.LeagueKey, league.SeasonKey);

            var matchViewModels = MatchViewModel.FromMatchs(matchs);
            var seasonViewModel = SeasonViewModel.From(matchViewModels, league.LeagueKey, league.SeasonKey);
            var tabViewModel    = new TabItemViewModel(league.ShortDisplayName,
                                                       league.ShortDisplayName, league.LongDisplayName,
                                                       seasonViewModel, true);

            var message = new TabMessage {
                Action = TabMessageAction.Create, ViewModel = tabViewModel
            };

            this.MessengerInstance.Send(message);
        }
Example #2
0
        public static SeasonViewModel From(IEnumerable <MatchViewModel> matchViewModels, string leagueKey, string seasonKey)
        {
            var season = new SeasonViewModel
            {
                Matchs     = matchViewModels.ToList(),
                _leagueKey = leagueKey,
                _seasonKey = seasonKey
            };

            matchViewModels.Select(x => x.Group)
            .Distinct()
            .Where(x => x.GroupID.HasValue)
            .OrderBy(x => x.GroupOrderID)
            .ForEach(season.Groups.Add);

            season.SelectedGroup = season.Groups.FirstOrDefault();
            return(season);
        }