private async Task LoadSport(CommonDetails details) { ServiceHelper serviceHelper = new ServiceHelper(); List <Sport> sportList = new List <Sport>(); if (helper.CheckInternetConnection(this)) { try { sportList = serviceHelper.GetSports(details.access_token, details.VenueId); linearProgressBar.Visibility = Android.Views.ViewStates.Gone; //linearProgressBar.Visibility = Android.Views.ViewStates.Visible; //new Thread(new ThreadStart(delegate //{ // RunOnUiThread(async () => { await LoadCourt(); linearProgressBar.Visibility = Android.Views.ViewStates.Gone; }); //})).Start(); if (sportList != null && sportList.Count > 0) { sportListView.SetAdapter(new Sport_ItemAdapter(this, sportList, linearProgressBar, details)); } linearProgressBar.Visibility = ViewStates.Gone; } catch (Exception e) { helper.AlertPopUp("Error", "Unable to retrive data the server", this); linearProgressBar.Visibility = ViewStates.Gone; } } else { helper.AlertPopUp("Warning", "Please enable mobile data", this); linearProgressBar.Visibility = ViewStates.Gone; } }
public void CheckLandingPage(CommonDetails details) { ServiceHelper serviceHelper; serviceHelper = new ServiceHelper(); List <Sport> sportList = new List <Sport>(); List <Court> courtList = new List <Court>(); List <BatchCountModel> batchList = new List <BatchCountModel>(); sportList = serviceHelper.GetSports(details.access_token, details.VenueId); if (sportList != null && sportList.Count > 0) { if (sportList.Count > 1) { var sportIntent = new Intent(context, typeof(SportActivity)); sportIntent.PutExtra("details", JsonConvert.SerializeObject(details)); context.StartActivity(sportIntent); context.Finish(); } else { serviceHelper = new ServiceHelper(); details.SportId = sportList[0].SportId.ToString(); courtList = serviceHelper.GetCourt(details.access_token, details.VenueId, details.SportId); if (courtList != null && courtList.Count > 0) { if (courtList.Count > 1) { var courtIntent = new Intent(context, typeof(CourtActivity)); courtIntent.PutExtra("details", JsonConvert.SerializeObject(details)); context.StartActivity(courtIntent); context.Finish(); } else { serviceHelper = new ServiceHelper(); details.CourtId = courtList[0].CourtId.ToString(); batchList = serviceHelper.GetBatch(details.access_token, details.VenueId, details.SportId, details.CourtId); var batchesIntent = new Intent(context, typeof(BatchesActivity)); batchesIntent.PutExtra("details", JsonConvert.SerializeObject(details)); context.StartActivity(batchesIntent); context.Finish(); } } else { helper.AlertPopUp("Warning", "There are no court available", context); progress.Visibility = Android.Views.ViewStates.Gone; } } } else { helper.AlertPopUp("Warning", "There are no sports available", context); progress.Visibility = Android.Views.ViewStates.Gone; } }
public void CheckLandingPage(CommonDetails details) { ServiceHelper serviceHelper; serviceHelper = new ServiceHelper(); //Check More than one Venue List <Venue> venueList = new List <Venue>(); List <Sport> sportList = new List <Sport>(); List <Court> courtList = new List <Court>(); List <BatchCountModel> batchList = new List <BatchCountModel>(); venueList = serviceHelper.GetVenue(details.access_token); if (venueList != null && venueList.Count > 0) { if (venueList.Count > 1) { var venueIntent = new Intent(this, typeof(VenueActivity)); venueIntent.PutExtra("isLogin", "1"); venueIntent.PutExtra("details", JsonConvert.SerializeObject(details)); StartActivity(venueIntent); Finish(); } else { serviceHelper = new ServiceHelper(); details.VenueId = venueList[0].VenueId.ToString(); details.VenueCode = venueList[0].VenueCode.ToString(); sportList = serviceHelper.GetSports(details.access_token, details.VenueId); if (sportList != null && sportList.Count > 0) { if (sportList.Count > 1) { var sportIntent = new Intent(this, typeof(SportActivity)); sportIntent.PutExtra("details", JsonConvert.SerializeObject(details)); StartActivity(sportIntent); Finish(); } else { serviceHelper = new ServiceHelper(); details.SportId = sportList[0].SportId.ToString(); courtList = serviceHelper.GetCourt(details.access_token, details.VenueId, details.SportId); if (courtList != null && courtList.Count > 0) { if (courtList.Count > 1) { var courtIntent = new Intent(this, typeof(CourtActivity)); courtIntent.PutExtra("details", JsonConvert.SerializeObject(details)); StartActivity(courtIntent); Finish(); } else { serviceHelper = new ServiceHelper(); details.CourtId = courtList[0].CourtId.ToString(); batchList = serviceHelper.GetBatch(details.access_token, details.VenueId, details.SportId, details.CourtId); var batchesIntent = new Intent(this, typeof(BatchesActivity)); batchesIntent.PutExtra("details", JsonConvert.SerializeObject(details)); StartActivity(batchesIntent); Finish(); } } else { helper.AlertPopUp("Warning", "There are no court available", this); } } } else { helper.AlertPopUp("Warning", "There are no sport available", this); } } } else { helper.AlertPopUp("Warning", "There are no venue available", this); } }