public ManagerAssetView(ViewAsset Viewasset, ScanResponce scanResponce) { InitializeComponent(); var tapGestureRecognizer = new TapGestureRecognizer(); tapGestureRecognizer.Tapped += (s, e) => { try { MasterDetailPage ParentPage = (MasterDetailPage)this.Parent; ParentPage.IsPresented = (ParentPage.IsPresented == false) ? true : false; } catch (Exception ex) { var msg = ex.Message; } }; img.GestureRecognizers.Add(tapGestureRecognizer); // AssetEntry.Text = ScanResponce.assetId; if (Viewasset != null) { AssetEntry.Text = Viewasset.assetId; DescriptionEntry.Text = Viewasset.description; StatusEntry.Text = Viewasset.status; timeScannedEntry.Text = Viewasset.timeLastScanned; timeUpdatedEntry.Text = Viewasset.timeLastUpdated; commentsEntry.Text = Viewasset.comment; if (Viewasset.assignee != null) { //String[] Stringbreak = Viewasset.assignee.Split('#'); AsigneeEntry.Text = Viewasset.assignee; assign.Text = "Return Asset"; lstview.IsVisible = false; } else { } } if (scanResponce != null) { AssetEntry.Text = scanResponce.assetId; DescriptionEntry.Text = scanResponce.description; StatusEntry.Text = scanResponce.status; timeScannedEntry.Text = scanResponce.timeLastScanned; timeUpdatedEntry.Text = scanResponce.timeLastUpdated; commentsEntry.Text = scanResponce.comment; if (scanResponce.assignee != null) { String[] Stringbreak = scanResponce.assignee.Split('#'); AsigneeEntry.Text = Stringbreak[1]; assign.Text = "Return Asset"; lstview.IsVisible = false; } else { } } lstview.ItemSelected += async(object sender, SelectedItemChangedEventArgs e) => { if (e.SelectedItem == null) { return; } Users item = (Users)e.SelectedItem; AsigneeEntry.Text = item.email; lstview.IsVisible = false; if (Validate = true) { DateTime now = DateTime.Now.ToLocalTime(); Dictionary <string, string> dict = new Dictionary <string, string>(); dict["asset"] = AssetEntry.Text; dict["assignee"] = AsigneeEntry.Text; dict["time"] = now.ToString(); var isSuccess = await cloudStore.AssignAsset(dict); if (isSuccess) { await DisplayAlert("Success", "Asset Assigned Successfully.", "Ok"); App.Current.MainPage = new MainViewAssetPage(); //AssetEntry.Text = string.Empty; //DescriptionEntry.Text = string.Empty; } else { await DisplayAlert("Error", "Assignment Failed. Please try Again.", "Ok"); //AssetEntry.Text = string.Empty; //DescriptionEntry.Text = string.Empty; } Validate = false; } ((ListView)sender).SelectedItem = null; }; if (AsigneeEntry.Text == null) { AsigneeEntry.Focused += async(sender, e) => { try { var isSuccess = await cloudStore.GetUsers(); if (isSuccess != null) { lstview.ItemsSource = isSuccess; lstview.IsVisible = true; } else { await DisplayAlert("Error", "No Assignee", "Cancel", "Ok"); } } catch (Exception ex) { } }; } else { } }