private void OpenCase(CaseListModel entry) { try { // Get the element (Case) touched var element = _mCellStackLayout.Children.FirstOrDefault(x => x == entry.Cell); if (element == null) { return; } entry.View.Animate("expand", x => { entry.View.IsVisible = true; entry.View.HeightRequest = entry.OriginalSize.Height; }, 16, AnimationDuration, Easing.SpringOut, (d, b) => { //Added by Gowtham to scroll the Caselist at the desired position in IOS if (Device.OS == TargetPlatform.iOS) { _mScrollView.ScrollToAsync(element, ScrollToPosition.MakeVisible, true); } // entry.View.IsVisible = true; }); if (Device.OS == TargetPlatform.Android) { SplitView.MapView?.ClearPin(); } } catch (Exception ex) { LogTracking.LogTrace(ex.ToString()); } }
/// ------------------------------------------------------------------------------------------------ /// ------------------------------------------------------------------------------------------------ #region Public Functions /// ------------------------------------------------------------------------------------------------ /// /// <summary> /// Add the specified Case and Inspection. /// </summary> /// <param name="Case">Case.</param> /// <param name="inspection">View.</param> public void Add(View Case, View inspection) { try { if (Case == null) { throw new ArgumentNullException(nameof(Case)); } if (inspection == null) { throw new ArgumentNullException(nameof(inspection)); } var entry = CaseEntry = new CaseListModel() { Cell = Case, View = inspection, OriginalSize = new Size(inspection.WidthRequest, inspection.HeightRequest) }; MEntries.Add(CaseEntry); _mCellStackLayout.Children.Add(CaseEntry.Cell); _mCellStackLayout.Children.Add(CaseEntry.View); var cellIndex = CaseEntry.Index = MEntries.Count - 1; // Commented for Issue in Android //var tapGestureRecognizer = new TapGestureRecognizer(); //Case.GestureRecognizers.Remove(tapGestureRecognizer); //if (CellTouched == null) //{ // tapGestureRecognizer.Tapped += (object sender, EventArgs e) => // { // OnCellTouchUpInside(cellIndex); // }; //} //else // tapGestureRecognizer.Tapped += (object sender, EventArgs e) => CellTouched(cellIndex); //Case.GestureRecognizers.Add(tapGestureRecognizer); } catch (Exception ex) { LogTracking.LogTrace(ex.ToString()); } }
private async void CloseCase(CaseListModel entry) { try { entry.View.Animate("colapse", x => { //var change = entry.OriginalSize.Height * x; //entry.View.HeightRequest = entry.OriginalSize.Height - change; entry.View.HeightRequest = 0; }, 0, AnimationDuration, Easing.SpringIn, (d, b) => { entry.View.IsVisible = false; }); await SplitView.Instace().Clear(); if (Device.OS == TargetPlatform.Android) { var formsMap = (AndroidMapView)SplitView.MapView; SplitView.Fullmapview.FindByName <Grid>("GlMapView").Children.Clear(); SplitView.Fullmapview.FindByName <Grid>("GlMapView").Children.Add(formsMap, 0, 0); SplitView.MapView.LoadPins(AppContext.AppContext.LstGooglePin); AndroidMapView.ChangeMapType(); } else { //Added to reload the Map pins WindowsMapView.ChangeMapType(); SplitView.MapView.ClearPin(); SplitView.MapView.LoadPins(AppContext.AppContext.LstCustomPin); SplitView.MapView.MoveToRegion(AppContext.AppContext.LstCustomPin?.FirstOrDefault().Pin.Position, Xamarin.Forms.Maps.Distance.FromKilometers(0.5)); } } catch (Exception ex) { LogTracking.LogTrace(ex.ToString()); } }