示例#1
0
        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;
        }
示例#2
0
        void Initialize()
        {
            _dlgView.Parent = Application.Current.MainPage;


            _renderer = Dialogs.CreateNativeView(_dlgView);

            if (_dlgView.CornerRadius > 0)
            {
                _renderer.NativeView.Layer.CornerRadius  = _dlgView.CornerRadius;
                _renderer.NativeView.Layer.MasksToBounds = true;
            }

            if (_dlgView.BorderWidth > 0)
            {
                _renderer.NativeView.Layer.BorderWidth = (float)_dlgView.BorderWidth;
                _renderer.NativeView.Layer.BorderColor = _dlgView.BorderColor.ToCGColor();
            }

            var measure = Dialogs.Measure(_dlgView);

            _renderer.SetElementSize(measure);

            _contentViewController = new UIViewController
            {
                View = _renderer.NativeView
            };


            _dialogController = new DialogPresentationController(_dlgView, _overlayView, _contentViewController, _viewController);
            _contentViewController.TransitioningDelegate = _dialogController;

            OnceInitializeAction = null;
        }