Ejemplo n.º 1
0
        private async void GetSummonerAsync()
        {
            if (Connectivity.NetworkAccess == NetworkAccess.Internet)
            {
                IsBusy = true;
                var summoner = await _summonerApiService.GetSummonerAsync(SummonerName);

                if (summoner == null)
                {
                    await AlertService.DisplayAlertAsync(AlertConstant.SummonerNotFoundTitle, AlertConstant.SummonerNotFoundDescription, AlertConstant.SummonerNotFoundConfirm);

                    Show = false;
                }
                else
                {
                    Show = true;
                }

                Summoner = summoner;
                IsBusy   = false;
            }
            else
            {
                await AlertService.DisplayAlertAsync(AlertConstant.NoInternetConnectionTitle, AlertConstant.NoInternetConnectionDescription, AlertConstant.NoInternetConnectionConfirm);
            }
        }
Ejemplo n.º 2
0
        public async Task LoadTeams()
        {
            IsBusy = true;

            var teamsinformation = await NbaApiService.GetTeamsInformation();

            var info = teamsinformation.League.Standard;

            if ((Connectivity.NetworkAccess == NetworkAccess.Internet))
            {
                if (teamsinformation != null)
                {
                    foreach (Standard team in info)
                    {
                        Teams.Add(team.FullName.ToString());
                    }
                    Selected = Teams[0];
                }
                IsBusy = false;
            }
            else
            {
                await AlertService.DisplayAlertAsync("Error", "No tiene Acceso a internet", "cancel");
            }
        }
Ejemplo n.º 3
0
        private async void GetSummonerLeague()
        {
            if (Connectivity.NetworkAccess == NetworkAccess.Internet)
            {
                var summonerDetail = await _summonerLeagueApiServie.GetSummonerLeagueAsync(Summoner.Id);

                SummonerDetailList = summonerDetail;
            }
            else
            {
                await AlertService.DisplayAlertAsync(AlertConstant.NoInternetConnectionTitle, AlertConstant.NoInternetConnectionDescription, AlertConstant.NoInternetConnectionConfirm);
            }
        }
Ejemplo n.º 4
0
        private async void Load()
        {
            if (!(Connectivity.NetworkAccess == NetworkAccess.Internet))
            {
                await AlertService.DisplayAlertAsync("ERROR", "No internet connection");
            }
            else
            {
                var things = await languageService.GetLanguageAsync();

                TagList = things.Tags;
            }
        }
Ejemplo n.º 5
0
 public async Task GetPeopleList()
 {
     IIsBusy = true;
     if (!(Connectivity.NetworkAccess == NetworkAccess.Internet))
     {
         await AlertService.DisplayAlertAsync("Error", "No internet connection, try later.", "Ok");
     }
     else
     {
         var getpeople = await _peopleService.GetPeopleAsync();
         PeopleCollection = getpeople.ResultsPeople;
     }
     IIsBusy = false;
 }
Ejemplo n.º 6
0
        private async void GetStatus()
        {
            if (Connectivity.NetworkAccess == NetworkAccess.Internet)
            {
                Status = await StatusApiService.GetStatusAsync();

                Entries = Status.Entries[0];
            }
            else
            {
                // Alert
                await AlertService.DisplayAlertAsync(AlertConstant.NoInternetConnectionTitle, AlertConstant.NoInternetConnectionDescription, AlertConstant.NoInternetConnectionConfirm);
            }
        }
Ejemplo n.º 7
0
        public async Task GetSpeciesList()
        {
            IsBusy = true;
            if (!(Connectivity.NetworkAccess == NetworkAccess.Internet))
            {
                await AlertService.DisplayAlertAsync("Error", "No internet connection, try later.", "Ok");
            }
            else
            {
                var getspecies = await _speciesService.GetSpecieAsync();

                SpeciesCollection = getspecies.ResultSpecies;
            }
            IsBusy = false;
        }
Ejemplo n.º 8
0
        public async void GetCoachData()
        {
            if (Connectivity.NetworkAccess == NetworkAccess.Internet)
            {
                var coachInfo = await NbaApiService.GetCoachList();

                CoachList = new ObservableCollection <Standard>(coachInfo.League.Standard);
                Internet  = true;
            }
            else
            {
                Internet = false;
                await AlertService.DisplayAlertAsync("No Network", "Please connect to network", "Ok");
            }
        }
Ejemplo n.º 9
0
        private async void LoadTeams()
        {
            IsBusy = true;
            if (!(Connectivity.NetworkAccess == NetworkAccess.Internet))
            {
                await AlertService.DisplayAlertAsync("Error", "No internet connection, try later.");
            }
            else
            {
                var teams = await teamApiService.GetSportsTeamsAsync();

                Teams = teams.Data;
            }
            IsBusy = false;
        }
Ejemplo n.º 10
0
        public async Task GetFilmList()
        {
            IsBusy = true;
            if (!(Connectivity.NetworkAccess == NetworkAccess.Internet))
            {
                await AlertService.DisplayAlertAsync("Error", "No internet connection, try later.", "Ok");
            }
            else
            {
                var getfilms = await _filmService.GetFilmAsync();

                FilmsCollection = getfilms.ResultsFilms;
            }
            IsBusy = false;
        }
Ejemplo n.º 11
0
        private async void LoadLiveGames()
        {
            IsBusy = true;
            if (!(Connectivity.NetworkAccess == NetworkAccess.Internet))
            {
                await AlertService.DisplayAlertAsync(AlertDialogConstants.Error, AlertDialogConstants.NoInternet, AlertDialogConstants.Ok);
            }
            else
            {
                var events = await _eventApiService.GetInfoAsync();

                Events = events.Data;
            }
            IsBusy = false;
        }
Ejemplo n.º 12
0
        private async void GetLeaguesAsync()
        {
            if (!(Connectivity.NetworkAccess == NetworkAccess.Internet))
            {
                await AlertService.DisplayAlertAsync(AlertDialogConstants.Error, AlertDialogConstants.NoInternet, AlertDialogConstants.Ok);

                return;
            }
            IsDataVisible = false;
            IsBusy        = true;
            var leagues = await _leagueApiService.GetInfoAsync();

            LeaguesData   = leagues.Data;
            IsBusy        = false;
            IsDataVisible = true;
        }
Ejemplo n.º 13
0
        private async void GetSummonerMatches()
        {
            if (Connectivity.NetworkAccess == NetworkAccess.Internet)
            {
                var summonerMatches = await _matchApiService.GetMatchesByAccountIdAsync(Summoner.AccountId);

                SummonerMatches = summonerMatches;

                SummonerDetailedMatches = new ObservableCollection <Match>();

                participantIdByMatch = new List <int>();

                foreach (MatchElement element in SummonerMatches.Matches)
                {
                    Match matchWholeElement = await _matchApiService.GetMatchByIdAsync(element.GameId.ToString());

                    SummonerDetailedMatches.Add(matchWholeElement);

                    foreach (ParticipantIdentity participantId in matchWholeElement.ParticipantIdentities)
                    {
                        if (participantId.Player.SummonerId == Summoner.Id)
                        {
                            participantIdByMatch.Add(participantId.ParticipantId);
                        }
                    }
                }

                ParticipationsOfCurrentSummoner = new ObservableCollection <Participant>();

                int counter = 0;

                foreach (Match match in SummonerDetailedMatches)
                {
                    ParticipationsOfCurrentSummoner.Add(match.Participants.First(element => element.ParticipantId == participantIdByMatch[counter]));
                    ParticipationsOfCurrentSummoner[counter].GameId = match.GameId;
                    counter++;
                }



                // var participantId = SummonerDetailedMatches.First((p)=> p.ParticipantIdentities.Pla == "")
            }
            else
            {
                await AlertService.DisplayAlertAsync(AlertConstant.NoInternetConnectionTitle, AlertConstant.NoInternetConnectionDescription, AlertConstant.NoInternetConnectionConfirm);
            }
        }
Ejemplo n.º 14
0
        public async void LoadRanking()
        {
            if (string.IsNullOrEmpty(Queue) || string.IsNullOrEmpty(Tier) || string.IsNullOrEmpty(Division))
            {
                await AlertService.DisplayAlertAsync("Error", "You must select a queue, a tier and a division", "Ok", null);
            }
            else
            {
                IsBusy = true;
                if (Connectivity.NetworkAccess == NetworkAccess.Internet)
                {
                    Ranking = await _rankingApiService.GetRankingAync(Queue, Tier, Division);
                }
                else
                {
                    await AlertService.DisplayAlertAsync(AlertConstant.NoInternetConnectionTitle, AlertConstant.NoInternetConnectionDescription, AlertConstant.NoInternetConnectionConfirm);
                }

                IsBusy = false;
            }
        }