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); }
// // 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); }
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); }
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); }
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)); }