Ejemplo n.º 1
0
        public IXFPopupCtrl CreateDropDown(Xamarin.Forms.View anchor, Xamarin.Forms.View drop)
        {
            CustomPopup dlg = null;

            //first try to get the PopupHolderRenderer
            //first try to get the PopupHolderRenderer
            if (anchor == null || drop == null)
            {
                return(null);
            }

            var anchorRender = anchor.GetValue(RendererProperty) as UIView;

            if (anchorRender == null)
            {
                return(null);
            }

            var render = Convert(drop, anchor);

            if (render == null)
            {
                return(null);
            }

            if (render != null)
            {
                var size   = drop.GetSizeRequest(anchorRender.Bounds.Width, XFPopupConst.SCREEN_HEIGHT);
                var width  = anchorRender.Bounds.Width;
                var height = (int)size.Request.Height;
                if (height > (XFPopupConst.SCREEN_HEIGHT * 3 / 4))
                {
                    height = (int)(XFPopupConst.SCREEN_HEIGHT * 3 / 4);
                }

                //important
                drop.Layout(new Xamarin.Forms.Rectangle(0, 0, width - 2 * padding, height));

                var native = render as UIKit.UIView;
                native.Frame = new CoreGraphics.CGRect(padding, padding, width - 2 * padding, height);

                dlg = new CustomPopup(native, true, width, height + 2 * padding, ShowType.DropDown, anchorRender);
            }
            return(dlg);
        }
Ejemplo n.º 2
0
        public IXFPopupCtrl CreateDialog(Page page, Xamarin.Forms.View content, bool cancelable)
        {
            CustomPopup dlg = null;

            if (content != null)
            {
                var render = Convert(content, page);

                if (render != null)
                {
                    var size = content.GetSizeRequest(XFPopupConst.SCREEN_WIDTH, XFPopupConst.SCREEN_HEIGHT);

                    var width  = (int)size.Request.Width;
                    var height = (int)size.Request.Height;


                    if (width > XFPopupConst.SCREEN_WIDTH)
                    {
                        width = (int)(XFPopupConst.SCREEN_WIDTH * 3 / 4);
                    }

                    if (height > (XFPopupConst.SCREEN_HEIGHT * 3 / 4))
                    {
                        height = (int)(XFPopupConst.SCREEN_HEIGHT * 3 / 4);
                    }

                    //important
                    content.Layout(new Xamarin.Forms.Rectangle(0, 0, width, height));

                    var native = render as UIKit.UIView;

                    native.Frame = new CoreGraphics.CGRect(padding, padding, width, height);

                    dlg = new CustomPopup(native, cancelable, width + 2 * padding, height + 2 * padding, ShowType.Dialog);
                }
            }
            return(dlg);
        }
Ejemplo n.º 3
0
        public IXFPopupCtrl CreateLoading(string loading = "Loading...")
        {
            var vwMain = new UIView();

            //get the center
            vwMain.BackgroundColor  = UIColor.White;
            vwMain.AutoresizingMask = UIViewAutoresizing.All;

            var activitySpinner = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.Gray);

            vwMain.Frame = new CGRect(0, 0, XFPopupConst.SCREEN_WIDTH * 0.75f, activitySpinner.Frame.Height * 2);

            activitySpinner.AutoresizingMask = UIViewAutoresizing.All;
            activitySpinner.Center           = new CGPoint(activitySpinner.Frame.Width, vwMain.Frame.Height / 2);

            vwMain.AddSubview(activitySpinner);
            activitySpinner.StartAnimating();

            // create and configure the "Loading Data" label
            var loadingLabel = new UILabel(new CGRect(
                                               activitySpinner.Frame.Width * 2,
                                               0,
                                               (XFPopupConst.SCREEN_WIDTH * 3 / 4 - activitySpinner.Frame.Width * 2),
                                               activitySpinner.Frame.Height * 2
                                               ));

            loadingLabel.TextColor        = UIColor.Black;
            loadingLabel.Text             = loading;
            loadingLabel.TextAlignment    = UITextAlignment.Center;
            loadingLabel.AutoresizingMask = UIViewAutoresizing.All;
            vwMain.Frame = new CGRect(padding, padding, XFPopupConst.SCREEN_WIDTH * 0.75f, activitySpinner.Frame.Width * 2);
            vwMain.AddSubview(loadingLabel);

            CustomPopup dlg = new CustomPopup(vwMain, false, XFPopupConst.SCREEN_WIDTH * 0.75f + 2 * padding, activitySpinner.Frame.Width * 2 + 2 * padding, ShowType.Dialog);

            return(dlg);
        }
Ejemplo n.º 4
0
        public IXFPopupCtrl CreateLoading(string loading = "Loading...")
        {
            var vwMain = new UIView();

            //get the center
            vwMain.BackgroundColor = UIColor.White;
            vwMain.AutoresizingMask = UIViewAutoresizing.All;

            var activitySpinner = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.Gray);
            vwMain.Frame = new CGRect (0, 0, XFPopupConst.SCREEN_WIDTH * 0.75f, activitySpinner.Frame.Height*2);

            activitySpinner.AutoresizingMask = UIViewAutoresizing.All;
            activitySpinner.Center = new CGPoint (activitySpinner.Frame.Width, vwMain.Frame.Height/2);

            vwMain.AddSubview (activitySpinner);
            activitySpinner.StartAnimating ();

            // create and configure the "Loading Data" label
            var loadingLabel = new UILabel(new CGRect (
                activitySpinner.Frame.Width * 2,
                0 ,
                (XFPopupConst.SCREEN_WIDTH * 3/4 - activitySpinner.Frame.Width * 2),
                activitySpinner.Frame.Height * 2
            ));

            loadingLabel.TextColor = UIColor.Black;
            loadingLabel.Text = loading;
            loadingLabel.TextAlignment = UITextAlignment.Center;
            loadingLabel.AutoresizingMask = UIViewAutoresizing.All;
            vwMain.Frame = new CGRect(padding, padding, XFPopupConst.SCREEN_WIDTH * 0.75f, activitySpinner.Frame.Width * 2);
            vwMain.AddSubview (loadingLabel);

            CustomPopup dlg = new CustomPopup(vwMain,false,XFPopupConst.SCREEN_WIDTH*0.75f + 2*padding,activitySpinner.Frame.Width * 2 + 2*padding,ShowType.Dialog);
            return dlg;
        }
Ejemplo n.º 5
0
        public IXFPopupCtrl CreateDropDown(Xamarin.Forms.View anchor, Xamarin.Forms.View drop)
        {
            CustomPopup dlg = null;
            //first try to get the PopupHolderRenderer
            //first try to get the PopupHolderRenderer
            if(anchor == null || drop == null){
                return null;
            }

            var anchorRender = anchor.GetValue(RendererProperty) as UIView;
            if (anchorRender == null) {
                return null;
            }

            var render = Convert(drop, anchor);

            if (render == null) {
                return null;
            }

            if (render != null) {

                var size = drop.GetSizeRequest(anchorRender.Bounds.Width, XFPopupConst.SCREEN_HEIGHT);
                var width = anchorRender.Bounds.Width;
                var height = (int)size.Request.Height;
                if (height > (XFPopupConst.SCREEN_HEIGHT * 3/ 4))
                {
                    height = (int)(XFPopupConst.SCREEN_HEIGHT * 3/ 4);
                }

                //important
                drop.Layout(new Xamarin.Forms.Rectangle(0, 0, width - 2*padding, height));

                var native = render as UIKit.UIView;
                native.Frame = new CoreGraphics.CGRect (padding, padding, width - 2*padding, height);

                dlg = new CustomPopup(native, true, width, height + 2*padding, ShowType.DropDown,anchorRender);

            }
            return dlg;
        }
Ejemplo n.º 6
0
        public IXFPopupCtrl CreateDialog(Page page, Xamarin.Forms.View content,bool cancelable)
        {
            CustomPopup dlg = null;

            if (content != null) {

                var render = Convert(content, page);

                if (render != null) {

                    var size = content.GetSizeRequest(XFPopupConst.SCREEN_WIDTH, XFPopupConst.SCREEN_HEIGHT);

                    var width = (int)size.Request.Width;
                    var height = (int)size.Request.Height;

                    if (width > XFPopupConst.SCREEN_WIDTH)
                    {
                        width = (int)(XFPopupConst.SCREEN_WIDTH * 3 / 4);
                    }

                    if (height > (XFPopupConst.SCREEN_HEIGHT * 3/ 4))
                    {
                        height = (int)(XFPopupConst.SCREEN_HEIGHT * 3/ 4);
                    }

                    //important
                    content.Layout(new Xamarin.Forms.Rectangle(0, 0, width, height));

                    var native = render as UIKit.UIView;

                    native.Frame = new CoreGraphics.CGRect (padding, padding, width, height);

                    dlg = new CustomPopup(native,cancelable,width + 2*padding,height + 2*padding,ShowType.Dialog);

                }

            }
            return dlg;
        }