示例#1
0
        private async Task PopulateTeamsDropdown()
        {
            var getTeamTaskRequest = new GetTeamsTaskRequest()
            {
                Cup = settings.Cup
            };

            var allTeams = await Task.Run(() => teamsRepo.GetTeamsTask(getTeamTaskRequest)?.Teams);


            var favouriteTeam = this.teamsRepo.GetFavouriteTeamTask(new GetFavouriteTeamTaskRequest()
            {
                Cup = this.settings.Cup
            });

            if (favouriteTeam.Team != null)
            {
                var favouriteTeamFromDataSource = await Task.Run(() => allTeams.Where(x => x.FifaCode == favouriteTeam.Team.FifaCode).FirstOrDefault());

                cbFavouriteTeam.SelectedItem = favouriteTeamFromDataSource;
            }

            cbFavouriteTeam.DisplayMember = "Country";
            cbFavouriteTeam.ValueMember   = "FifaCode";
            cbFavouriteTeam.DataSource    = allTeams;
        }
示例#2
0
        private void PopulateTeamsDropdown()
        {
            var getTeamTaskRequest = new GetTeamsTaskRequest()
            {
                Cup = this.settings.Cup
            };

            var allTeams = teamsRepo.GetTeamsTask(getTeamTaskRequest)?.Teams;

            cbFavouriteTeam.ItemsSource = allTeams;

            cbEnemyTeam.ItemsSource = allTeams;


            var favouriteTeam = this.teamsRepo.GetFavouriteTeamTask(new GetFavouriteTeamTaskRequest()
            {
                Cup = this.settings.Cup
            });

            if (favouriteTeam.Team != null)
            {
                var favouriteTeamFromDataSource = allTeams.Where(x => x.FifaCode == favouriteTeam.Team.FifaCode).FirstOrDefault();
                cbFavouriteTeam.SelectedItem = favouriteTeamFromDataSource;
            }
        }