public void Dispose() { _dlgView.Destroy(); _dlgView.Parent = null; Dialogs.DisposeModelAndChildrenRenderers(_dlgView); _dlgView.BindingContext = null; _dlgView = null; var tapGesture = _overlayView.GestureRecognizers.FirstOrDefault(); _overlayView.RemoveGestureRecognizer(tapGesture); tapGesture?.Dispose(); _overlayView.RemoveFromSuperview(); _overlayView.Dispose(); _overlayView = null; _contentViewController.TransitioningDelegate = null; _contentViewController.Dispose(); _contentViewController = null; _dialogController.Dispose(); _dialogController = null; _renderer = null; }
public void Show(ToastView view, object viewModel = null) { if (viewModel != null) { view.BindingContext = viewModel; } view.Parent = Application.Current.MainPage; var renderer = Dialogs.CreateNativeView(view); var measure = Dialogs.Measure(view); renderer.SetElementSize(measure); renderer.NativeView.Alpha = 0; if (view.CornerRadius > 0) { renderer.NativeView.Layer.CornerRadius = view.CornerRadius; renderer.NativeView.Layer.MasksToBounds = true; } if (view.BorderWidth > 0) { renderer.NativeView.Layer.BorderWidth = (float)view.BorderWidth; renderer.NativeView.Layer.BorderColor = view.BorderColor.ToCGColor(); } SetView(view, renderer.NativeView, renderer); view.Parent = null; view.RunPresentationAnimation(); UIView.Animate( 0.25, () => renderer.NativeView.Alpha = (System.nfloat)view.Opacity ); Device.StartTimer(TimeSpan.FromMilliseconds(Math.Max(view.Duration - 250, 0)), () => { view.RunDismissalAnimation(); UIView.Animate( 0.25, () => renderer.NativeView.Alpha = 0, () => { view.Parent = null; renderer.NativeView.RemoveConstraints(renderer.NativeView.Constraints); Dialogs.DisposeModelAndChildrenRenderers(view); renderer = null; view.Destroy(); view.BindingContext = null; view = null; } ); return(false); }); }
public override void Dispose() { _loadingView.Parent = null; Dialogs.DisposeModelAndChildrenRenderers(_loadingView); _renderer = null; _loadingView.Destroy(); _loadingView.BindingContext = null; _loadingView = null; base.Dispose(); }