public IDialog CreateDialog(Xamarin.Forms.View contentView, IDialogMsg dialogMsg, DialogConfig config)
        {
            if (contentView == null)
            {
                throw new ArgumentException($"dialog contentView is null");
            }
            if (config == null)
            {
                config = new DialogConfig();
            }
            IDialogResult dialogResult            = null;
            TaskCompletionSource <string> mission = null;

            if (contentView is IDialogElement)
            {
                DialogResultManager manager = new DialogResultManager();
                manager.Build();
                dialogResult = manager.GetDialogResult();
                mission      = manager.GetResultMission();
            }
            var dialogFragment = new BaseDialogFragment2(_activity, contentView, config, dialogMsg, dialogResult);
            var dialogDroid    = new DialogInstance(dialogFragment, _fragmentManager, contentView, mission);

            return(dialogDroid);
        }
Esempio n. 2
0
        public void OnCreated(IDialogMsg dialogMsg)
        {
            var confirmMsg = dialogMsg as ConfirmMsg;

            this.msg.Text   = dialogMsg.Msg;
            this.noBtn.Text = confirmMsg.NoBtn;
            this.okBtn.Text = confirmMsg.OkBtn;
        }
Esempio n. 3
0
 public BaseDialogFragment(Context context, Xamarin.Forms.View view,
                           DialogConfig dialogConfig, IDialogMsg dialogMsg)
 {
     _xfView       = view;
     _mContext     = context;
     _dialogConfig = dialogConfig;
     _iDialogMsg   = dialogMsg;
     if (view is IDialogElement)
     {
         _dialogElement = view as IDialogElement;
     }
 }
 public BaseDialogFragment2(Activity activity, Xamarin.Forms.View contentView,
                            DialogConfig dialogConfig, IDialogMsg dialogMsg, IDialogResult dialogResult = null)
 {
     _context      = activity;
     _dialogConfig = dialogConfig;
     _iDialogMsg   = dialogMsg;
     _contentView  = contentView;
     _dialogResult = dialogResult;
     if (contentView is IDialogElement dialogElement)
     {
         _dialogElement = contentView as IDialogElement;
     }
 }
 public ToastDialogUtil(Activity context, Xamarin.Forms.View view, DialogConfig dialogConfig
                        , IDialogMsg dialogMsg, bool isLong, bool isNative)
 {
     _toastView    = view;
     _mContext     = context;
     _dialogConfig = dialogConfig;
     _dialogMsg    = dialogMsg;
     _isLong       = isLong;
     _isNative     = isNative;
     if (_toastView == null)
     {
         _isNative = true;
     }
 }
        public void Toast(IDialogMsg dialogMsg, DialogConfig config = null, bool islong = false, bool isNative = false)
        {
            Xamarin.Forms.View toastView = isNative ? null : _dialogsInitize.GetInitToastView();
            if (config == null)
            {
                config = new DialogConfig()
                {
                    DialogPosition = DialogPosition.ToastDefault
                };
            }
            ToastDialogUtil toastDialog = new ToastDialogUtil(_activity, toastView, config
                                                              , dialogMsg, islong, isNative);
            var toast = toastDialog.Builder();

            if (toast != null)
            {
                toast.Show();
            }
        }
        public IDialog CreateDialog(DialogType dialogType, IDialogMsg dialogMsg, DialogConfig config = null)
        {
            var contentView = _dialogsInitize.GetInitDialogContentView(dialogType);

            if (contentView == null)
            {
                throw new Exception($"{dialogType} not map");
            }
            if (config == null)
            {
                config = _dialogsInitize.GetInitDialogConfig(dialogType);
            }
            DialogResultManager manager = new DialogResultManager();

            manager.Build();
            var dialogFragment = new BaseDialogFragment2(_activity, contentView, config, dialogMsg,
                                                         manager.GetDialogResult());
            var dialogDroid = new DialogInstance(dialogFragment, _fragmentManager, contentView,
                                                 manager.GetResultMission());

            return(dialogDroid);
        }
        /// <summary>
        /// PopupView
        /// </summary>
        /// <param name="baseView"></param>
        /// <param name="popupView"></param>
        /// <param name="dialogMsg"></param>
        /// <param name="config"></param>
        /// <returns></returns>
        public IDialog PopupView(Xamarin.Forms.View baseView, Xamarin.Forms.View popupView, IDialogMsg dialogMsg, DialogConfig config)
        {
            if (baseView == null || popupView == null)
            {
                throw new ArgumentException($"dialog contentView is null");
            }

            if (config == null)
            {
                config = new DialogConfig()
                {
                    DialogPosition = DialogPosition.Buttom
                };
            }
            IDialogResult dialogResult            = null;
            TaskCompletionSource <string> mission = null;

            if (popupView is IDialogElement)
            {
                DialogResultManager manager = new DialogResultManager();
                manager.Build();
                dialogResult = manager.GetDialogResult();
                mission      = manager.GetResultMission();
            }
            var rect           = GetBaseViewRect(baseView);
            var dialogFragment = new PopupDialogFragment(_activity, popupView, config, dialogMsg, rect, dialogResult);
            var dialogDroid    = new DialogInstance(dialogFragment, _fragmentManager, popupView, mission);

            return(dialogDroid);
        }
 public void OnCreated(IDialogMsg dialogMsg)
 {
     this.lbl.Text = dialogMsg.Msg;
 }
 public PopupDialogFragment(Activity activity, Xamarin.Forms.View contentView, DialogConfig dialogConfig, IDialogMsg dialogMsg,
                            BaseViewRect baseViewRect, IDialogResult dialogResult = null)
     : base(activity, contentView, dialogConfig, dialogMsg, dialogResult)
 {
     this._baseViewRect = baseViewRect;
 }