public static void Dispose() { if (toast != null) { try { toast.Close(); } catch { } } toast = null; }
public static void Show(string says) { Toast.says = says; Log.AddLog("ui", "显示了一条吐司:" + Toast.says); App.Current.Dispatcher.Invoke((Action) delegate { toast = new Toast(); toastList.TrimToSize(); toast.Owner = Application.Current.MainWindow; toast.WindowStartupLocation = WindowStartupLocation.CenterOwner; toast.Show(); }); Thread.Sleep(2000); if (!MainWindow.readyExit) { App.Current.Dispatcher.Invoke((Action) delegate { toast.Close(); }); } }