Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- switch (response.StatusCode) {
- //200
- case (System.Net.HttpStatusCode.OK):
- HttpContent content = response.Content;
- string xjson = await content.ReadAsStringAsync();
- try {
- //List<Table_Loc> loc_list = JsonConvert.DeserializeObject<List<Table_Loc>>(xjson);
- lbl_res.Text = "Ordenes Pendientes";
- Root myobject = JsonConvert.DeserializeObject < Root > (xjson);
- //var T1count = myobject.tablas.Table1.Count;
- if (myobject.tablas.Table1.Count == 0) {
- PasajeAereo.IsEnabled = false;
- } else {
- PasajeAereo.IsEnabled = true;
- }
- } catch (Exception ex) {
- await DisplayAlert("", "" + ex.ToString(), "ok");
- return;
- }
- break;
- }
- //Model ...
- public class DatosEnvio
- {
- }
- public class DatosEnvioJson
- {
- }
- public class Table1
- {
- public string aerolinea { get; set; }
- public string vuelo { get; set; }
- public string salida { get; set; }
- public DateTime sFecha { get; set; }
- public string sHora { get; set; }
- public string regreso { get; set; }
- public DateTime rFecha { get; set; }
- public string rHora { get; set; }
- public string motivo { get; set; }
- public int idOrden { get; set; }
- }
- public class Tablas
- {
- public List<Table1> Table1 { get; set; }
- }
- public class Root
- {
- public DatosEnvio DatosEnvio { get; set; }
- public DatosEnvioJson DatosEnvioJson { get; set; }
- public Tablas tablas { get; set; }
- public string bandera { get; set; }
- public string mensaje { get; set; }
- }
- if (myobject != null && myobject.tablas != null && myobject.tablas.Table1 != null && myobject.tablas.Table1.Count == 0) {
- PasajeAereo.IsEnabled = false;
- } else {
- PasajeAereo.IsEnabled = true;
- }
- if (myobject?.tablas?.Table1?.Count == (int?)0) {
- PasajeAereo.IsEnabled = false;
- }
- else {
- PasajeAereo.IsEnabled = true;
- }
- PasajeAereo.IsEnabled = myobject?.tablas?.Table1?.Count == (int?)0;
Add Comment
Please, Sign In to add comment