private async void YY_Picker_SelectedIndexChanged(object sender, EventArgs e) { List <StaffSubjectClass> lsc = new List <StaffSubjectClass>(); try { var client = new HttpClient(); client.DefaultRequestHeaders.UserAgent.ParseAdd("Mozilla/5.0 (compatible; AcmeInc/1.0)"); var uri = $"https://api.medmee.in/Subject/GetStaff_Subjects?SID={Application.Current.Properties["UID"].ToString()}&Branch={Branch_Picker.SelectedItem.ToString()}&YY={YY_Picker.SelectedItem.ToString()}"; var result = await client.GetStringAsync(uri); var JSON_DATA = JsonConvert.DeserializeObject <List <StaffSubjectClass> >(result); var COUNT = JSON_DATA.Count; for (int i = 0; i < COUNT; i++) { StaffSubjectClass SC = new StaffSubjectClass() { SUBNAME = JSON_DATA[i].SUBNAME, }; //lsc.Add(SC); Subject_Picker.Items.Add(SC.SUBNAME); } //Subject_Picker.ItemsSource = lsc; } catch (Exception ee) { await DisplayAlert("Message", "No Data To Show", "Ok"); } }
public async void GetAllYears() { List <StaffSubjectClass> lsc = new List <StaffSubjectClass>(); try { var client = new HttpClient(); client.DefaultRequestHeaders.UserAgent.ParseAdd("Mozilla/5.0 (compatible; AcmeInc/1.0)"); var uri = $"https://api.medmee.in/Subject/GetAllYears?STID={Application.Current.Properties["UID"].ToString()}"; var result = await client.GetStringAsync(uri); var JSON_DATA = JsonConvert.DeserializeObject <List <StaffSubjectClass> >(result); var COUNT = JSON_DATA.Count; for (int i = 0; i < COUNT; i++) { StaffSubjectClass ssc = new StaffSubjectClass() { YY = JSON_DATA[i].YY }; YY_Picker.Items.Add(ssc.YY); } } catch (Exception ee) { await DisplayAlert("Message", "No Data To Show", "Ok"); } }