/// <summary> /// 显示消息 /// </summary> /// <param name="message">消息</param> /// <param name="msgType">类型</param> public void Show(string message, ToastBoxNotification.MsgType msgType = ToastBoxNotification.MsgType.Info) { if (string.IsNullOrWhiteSpace(message)) { return; } var options = new MessageOptions { FreezeOnMouseEnter = true, UnfreezeOnMouseLeave = true, NotificationClickAction = n => { n.Close(); } }; notifier.ShowToastAsync(message, msgType, options); }
public static async void ShowToastAsync(this Notifier notifier, string message, ToastBoxNotification.MsgType msgType, MessageOptions messageOptions = null) { await Application.Current.Dispatcher.InvokeAsync(() => notifier.Notify(() => new ToastBoxNotification(message, msgType, messageOptions))); }