public BloodBankFilter(eKyorType eKyorType, string StateName = "Any", string CityName = "Any") { InitializeComponent(); try { objeKyorType = eKyorType; if (Device.RuntimePlatform == "iOS") { ToolbarItems.Add(new ToolbarItem("Back", "", () => { Navigation.PopModalAsync(true); })); } if (Device.RuntimePlatform == "Android") { ToolbarItems.Add(new ToolbarItem("Back", "down.png", () => { Navigation.PopModalAsync(true); })); } if (InternetConnection) { Bind(eKyorType, StateName, CityName); } else { AskForRetry(eKyorType, StateName, CityName); } } catch (Exception ex) { DependencyService.Get <IMessage>().LongAlert(); } }
async void AskForRetry(eKyorType eKyorType, string StateName, string CityName) { var Retry = await DisplayAlert("No Connection", "Please Check Your Connection", "Retry", "Cancel"); if (Retry) { Bind(eKyorType, StateName, CityName); } }
void Bind(eKyorType eKyorType, string StateName, string CityName) { overlay.IsVisible = true; objStateCity = Task.Run(() => App.TodoManager.GetStateOrCity(eKyorType)).Result; List <string> lstState = objStateCity.data; lstState.Insert(0, "Any"); pkrState.ItemsSource = lstState; if (StateName != "") { pkrState.SelectedItem = StateName; } if (CityName != "") { pkrCity.SelectedItem = CityName; } overlay.IsVisible = false; }
/// <summary> /// EKyortype as enum BloodBank or emergency /// </summary> /// <param name="eKyorType">enum</param> /// <param name="StateName">Pass StateName to get city or leave to get statenames</param> /// <returns></returns> public Task <StateCity> GetStateOrCity(eKyorType eKyorType, string StateName = "") { return(restService.GetStatesOrCity(eKyorType, StateName)); }