AutoClosingMessageBox(string text, string caption, int timeout) { _caption = caption; _timeoutTimer = new System.Threading.Timer(OnTimerElapsed, null, timeout, System.Threading.Timeout.Infinite); using (_timeoutTimer) { // MessageBox.Show(text, caption); tf = new ToastForm(timeout); tf.FormBorderStyle = FormBorderStyle.None; tf.Text = caption; tf.label1.Text = text; //tf.label1.ic tf.StartPosition = FormStartPosition.Manual; tf.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - tf.Width, Screen.PrimaryScreen.WorkingArea.Height - tf.Height); tf.WindowState = FormWindowState.Minimized; //tf.Opacity = .5; tf.Show(); tf.WindowState = FormWindowState.Normal; Lerp l = new Lerp(tf.Opacity, 0, 1, 1000); l.SetForm(tf); } }
private void legacyPopup(String text, String caption, int duration) { ToastForm tf = new ToastForm(duration); tf.FormBorderStyle = FormBorderStyle.None; tf.Text = caption; tf.label1.Text = text; //tf.label1.ic tf.StartPosition = FormStartPosition.Manual; tf.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - tf.Width, Screen.PrimaryScreen.WorkingArea.Height - tf.Height); tf.WindowState = FormWindowState.Minimized; //tf.Opacity = .5; tf.Show(); tf.WindowState = FormWindowState.Normal; Lerp l = new Lerp(tf.Opacity, 0, 1, 1000); l.SetForm(tf); }