예제 #1
0
 public BaseViewModel(INavigationService navigationService, IApiService apiService, PageDialogService pagedialogservice, SeassonData seassonData)
 {
     NavigationService = navigationService;
     ApiService        = apiService;
     PageDialogService = pagedialogservice;
     SeassonData       = seassonData;
 }
 public TeamRosterPageViewModel(INavigationService navigationService, IApiService apiService, PageDialogService pagedialogservice, SeassonData seassonData) : base(navigationService, apiService, pagedialogservice, seassonData)
 {
     ViewPlayerInfoCommand = new DelegateCommand(async() =>
     {
         await ViewPlayerInfo();
     });
 }
 public PlayerInfoPageViewModel(INavigationService navigationService, IApiService apiService, PageDialogService pagedialogservice, SeassonData seassonData) : base(navigationService, apiService, pagedialogservice, seassonData)
 {
     ViewTeamRosterCommand = new DelegateCommand(async() =>
     {
         if (!string.IsNullOrEmpty(Player.TeamId))
         {
             await GoToTeamRosterPage();
         }
     });
     OpenTwitterProfileCommand = new DelegateCommand(async() =>
     {
         if (await this.HasInternet())
         {
             if (!string.IsNullOrEmpty(Player.TwitterId))
             {
                 try
                 {
                     await Browser.OpenAsync(new Uri($"{TwitterUrl}{Player.TwitterId.Replace("@", "")}"), BrowserLaunchMode.SystemPreferred);
                 }
                 catch (Exception)
                 {
                     await pagedialogservice.DisplayAlertAsync("Alert", "Twitter profile does not exist", "OK");
                 }
             }
             else
             {
                 await pagedialogservice.DisplayAlertAsync("Alert", "Twitter profile does not exist", "OK");
             }
         }
     });
 }
        public PlayersPageViewModel(INavigationService navigationService, IApiService apiService, PageDialogService pagedialogservice, SeassonData seassonData) : base(navigationService, apiService, pagedialogservice, seassonData)
        {
            SearchPlayerCommand = new DelegateCommand(async() =>
            {
                if (!string.IsNullOrEmpty(SearchEntry))
                {
                    await GetPlayerData(SearchEntry);
                }
            });

            ViewPlayerInfoCommand = new DelegateCommand(async() =>
            {
                await ViewPlayerInfo();
            });
        }
        public TeamsPageViewModel(INavigationService navigationService, IApiService apiService, PageDialogService pagedialogservice, SeassonData seassonData) : base(navigationService, apiService, pagedialogservice, seassonData)
        {
            SeassonsFromViewModelCollector = seassonData.Seassons;
            GetTeamInformationCommand      = new DelegateCommand(async() =>
            {
                await GetPlayerData();
            });

            NavigateToTeamRoster = new DelegateCommand(async() =>
            {
                await GoToTeamRosterPage();
            });
        }
예제 #6
0
 public UpcomingGamesPageViewModel(INavigationService navigationService, IApiService apiService, PageDialogService pagedialogservice, SeassonData seassonData) : base(navigationService, apiService, pagedialogservice, seassonData)
 {
     ViewMLBTwitterCommand = new DelegateCommand(async() =>
     {
         if (await this.HasInternet())
         {
             try
             {
                 await Browser.OpenAsync(new Uri($"{MLBTwitter}"), BrowserLaunchMode.SystemPreferred);
             }
             catch (Exception)
             {
                 await pagedialogservice.DisplayAlertAsync("Alert", TwitterError, "OK");
             }
         }
     });
     ViewGitHubRepoCommand = new DelegateCommand(async() =>
     {
         if (await this.HasInternet())
         {
             try
             {
                 await Browser.OpenAsync(new Uri($"{Github_Repo}"), BrowserLaunchMode.SystemPreferred);
             }
             catch (Exception)
             {
                 await pagedialogservice.DisplayAlertAsync("Alert", GitHubError, "OK");
             }
         }
     });
     ViewMLBInstagramCommand = new DelegateCommand(async() =>
     {
         if (await this.HasInternet())
         {
             try
             {
                 await Browser.OpenAsync(new Uri($"{Insta_Url}"), BrowserLaunchMode.SystemPreferred);
             }
             catch (Exception)
             {
                 await pagedialogservice.DisplayAlertAsync("Alert", InstaError, "OK");
             }
         }
     });
 }