public ToastBox() { InitializeComponent(); Instance = this; this.FormClosed += (o, e) => { Instance = null; }; this.Width = 300; this.Top = 0; this.Left = Screen.PrimaryScreen.WorkingArea.Width - 300; this.Height = Screen.PrimaryScreen.WorkingArea.Height; datas = new List <Toast>(); backgroundWorker1.RunWorkerAsync(); }
public static void show(string text, int mode = 1, int time = 5000) { var n = new Toast(text, mode, time); n.Width = 300; if (ToastBox.Instance == null) { ToastBox.init(); ToastBox.Instance.flowLayoutPanel1.Controls.Add(n); } else { ToastBox.Instance.flowLayoutPanel1.Controls.Add(n); } }