예제 #1
0
        public static void Show(string Message, bool Success = true, String Title = "", bool Default = false)
        {
            ToastAppearance toastLayout = new ToastAppearance();

            if (Default)
            {
                toastLayout.Color = ColorExtensions.DefaultToast();
                Toast.MakeToast(Message).SetAppearance(toastLayout).Show();
            }
            else
            {
                if (Success)
                {
                    toastLayout.Color = ColorExtensions.SuccessToast();
                }
                else
                {
                    toastLayout.Color = ColorExtensions.ErrorToast();
                }
                if (string.IsNullOrEmpty(Title))
                {
                    Toast.MakeToast(Message).SetAppearance(toastLayout).Show();
                }
                else
                {
                    Toast.ShowToast(Message, Title).SetAppearance(toastLayout).Show();
                }
            }
        }
예제 #2
0
 /// <summary>
 /// Displays a toast message.
 /// </summary>
 /// <param name="title">The title for the toast message.</param>
 /// <param name="message">The message to display in the toast.</param>
 /// <param name="appearance">The appearance.</param>
 /// <param name="duration">The duration to display the toast.</param>
 /// <param name="position">The position for the toast to display.</param>
 public static void ShowToast(string title, string message, ToastAppearance appearance, double duration = 2.0, ToastPosition position = ToastPosition.Center) => Toast
 .MakeToast(message)
 .SetTitle(title)
 .SetAppearance(appearance)
 .SetPosition(position)
 .SetDuration(duration)
 .SetAutoDismiss(true)
 .Show();