Ejemplo n.º 1
0
        public static async Task <IAsyncResult <View> > Show(string text, int fontSize = 36, float duration = 3f, bool fly = true, Action callback = null)
        {
            if (toastContent == null)
            {
                toastContent = await UIManager.Ins.OpenAsync <ToastContent>() as ToastContent;
            }
            else if (toastContent.Go == null)
            {
                toastContent = await UIManager.Ins.OpenAsync <ToastContent>() as ToastContent;
            }
            var result = toastContent.AddSubView <ToastView>();

            result.Callbackable().OnCallback(progressResult =>
            {
                ToastView view = progressResult.Result as ToastView;
                if (view == null)
                {
                    throw new FileNotFoundException("Not found the \"ToastView\".");
                }

                Toast toast = new Toast(view, text, fontSize, duration, fly, callback);
                toast.Show();
            });
            return(result);
        }
Ejemplo n.º 2
0
 protected Toast(ToastView view, string text, float duration = 3, Action callback = null, bool autoHide = true)
 {
     this.view     = view;
     this.text     = text;
     this.duration = duration;
     this.callback = callback;
     this.autoHide = autoHide;
 }
Ejemplo n.º 3
0
 private Toast(ToastView view, string text, int fontSize, float duration, bool fly, Action callback = null, bool autoHide = true)
 {
     this.fontSize = fontSize;
     this.view     = view;
     this.text     = text;
     this.fly      = fly;
     this.duration = duration;
     this.callback = callback;
     this.autoHide = autoHide;
 }
Ejemplo n.º 4
0
        public static async Task <Toast> Show(string text, float duration = 3f, Action callback = null)
        {
            UIManager locator = GetUIViewLocator();
            ToastView view    = await locator.OpenAsync <ToastView>();

            if (view == null)
            {
                throw new FileNotFoundException("Not found the \"ToastView\".");
            }

            Toast toast = new Toast(view, text, duration);

            toast.Show();
            return(toast);
        }