private async void TapGestureRecognizer_Action_Tapped_1(object sender, EventArgs e) { try { var button = sender as Grid; if (button != null) { var childlbl = (Label)button.Children[1]; if (childlbl != null) { var clicked = childlbl.Text.Trim();; var Response = Application.Current.Properties.ContainsKey("AcLoadResponse") ? Application.Current.Properties["AcLoadResponse"] as string : ""; List <string> act = new List <string>(); SD_RootObject response = JsonConvert.DeserializeObject <SD_RootObject>(Response); foreach (var li in response.Details) { act = li.Action.Split(',').Length > 0 ? li.Action.Split(',').ToList() : null; } bool isselected = false; List <ACtionList> ActionList = new List <ACtionList>(); foreach (var a in act) { if (string.IsNullOrEmpty(a.Trim())) { continue; } ACtionList ad = new ACtionList(); ad.Action = a.Trim(); if ((!isselected) && (a.ToLower().TrimStart() == clicked.ToLower().TrimStart())) { ad.ImageName = "radio.png"; isselected = true; } else { ad.ImageName = "unradio.png"; } ActionList.Add(ad); } lvaclist.ItemsSource = ActionList; Application.Current.Properties["ActionClicked"] = clicked; } } } catch (Exception ex) { await DisplayAlert("", ex.Message, "OK"); } }
public async void LoadActionList(string Response) { try { List <string> act = new List <string>(); SD_RootObject response = JsonConvert.DeserializeObject <SD_RootObject>(Response); string status = ""; foreach (var li in response.Details) { act = li.Action.Split(',').Length > 0 ? li.Action.Split(',').ToList() : null; status = li.Status.Trim().TrimStart(); } List <ACtionList> ActionList = new List <ACtionList>(); bool isselect = false; foreach (var a in act) { if (string.IsNullOrEmpty(a.Trim())) { continue; } ACtionList ad = new ACtionList(); ad.Action = a.Trim().TrimStart(); if ((!isselect) && (ad.Action == status)) { ad.ImageName = "radio.png"; isselect = true; } else { ad.ImageName = "unradio.png"; } ActionList.Add(ad); } if (ActionList.Count > 0) { lvaclist.ItemsSource = ActionList; } else { btnsave.IsEnabled = false; btnreset.IsEnabled = false; } } catch (Exception ex) { await DisplayAlert("", ex.Message, "OK"); } }