Пример #1
0
        public static void ShowToastMessage(ToastMessageType type, string message)
        {
            var icon = string.Empty;

            System.Drawing.Color color = System.Drawing.Color.FromArgb(0, 188, 212);

            switch (type)
            {
            case ToastMessageType.Success:
                icon = "ic_check_white_24dp.png";
                break;

            case ToastMessageType.Error:
                icon  = "ic_error.png";
                color = System.Drawing.Color.Red;
                break;
            }

            var toastConfig = new ToastConfig(message);

            toastConfig.SetDuration(2000);
            toastConfig.SetBackgroundColor(color);
            toastConfig.SetIcon(icon);
            UserDialogs.Instance.Toast(toastConfig);
        }
Пример #2
0
        //
        // Summary:
        //     Static method for sending the user toast-like notifications
        //
        public static void SendToast(string message, string icon = null)
        {
            var toastConfig = new ToastConfig(message);

            toastConfig.SetDuration(3000);
            toastConfig.SetIcon(icon);
            toastConfig.SetBackgroundColor(Color.Accent);

            UserDialogs.Instance.Toast(toastConfig);
        }
Пример #3
0
        public static void GreenToast(string mensagem)
        {
            ToastConfig toastConfig = new ToastConfig(mensagem);

            toastConfig.SetPosition(ToastPosition.Bottom);
            toastConfig.SetDuration(3000);
            toastConfig.SetBackgroundColor(Xamarin.Forms.Color.Green);
            toastConfig.SetIcon("ic_check_circle_white_18dp.png");

            UserDialogs.Instance.Toast(toastConfig);
        }
Пример #4
0
        public void ShowToast(string message, int duration, bool topPosition, string image, string textColor, string backgroundColor)
        {
            var toastConfig = new ToastConfig(message);

            toastConfig.SetDuration(duration);
            toastConfig.SetMessageTextColor(textColor.ToColor());
            toastConfig.SetBackgroundColor(backgroundColor.ToColor());
            if (!string.IsNullOrWhiteSpace(image))
            {
                toastConfig.SetIcon(image);
            }
            toastConfig.Position = topPosition ? ToastPosition.Top : ToastPosition.Bottom;
            UserDialogs.Instance.Toast(toastConfig);
        }
Пример #5
0
        private static IDisposable CallToast(string message, TimeSpan exibTime, Color?backgroundColor = null,
                                             Color?fontColor = null, string icon = null)
        {
            var toast = new ToastConfig(message);

            toast.SetDuration(exibTime);
            if (backgroundColor.HasValue)
            {
                toast.SetBackgroundColor(backgroundColor.Value);
            }
            if (fontColor.HasValue)
            {
                toast.SetMessageTextColor(fontColor.Value);
            }
            if (icon == string.Empty)
            {
                toast.SetIcon(icon);
            }
            return(UserDialogs.Instance.Toast(toast));
        }