Bloom.MiscUI.ToastNotifier.Show C# (CSharp) Method

Show() public method

Show the toast
public Show ( string message, string callToAction, int seconds ) : void
message string
callToAction string Text of the hyperlink
seconds int How long to show before it goes back down
return void
        public void Show(string message, string callToAction, int seconds)
        {
            //avoid showing a blizzard of the same message
            if(message == _currentMessage)
                return;
            _currentMessage = message;
            _message.Text = message;
            _callToAction.Text = callToAction;
            if (seconds < 0)
            {
                _stayUp = true; //just leave it up permanently
            }
            else
            {
                _pauseTimer.Interval = 1000 * seconds;
            }
            Show();
        }

Usage Example

 private static void ShowToast(string shortUserLevelMessage, Exception exception, string fullDetailedMessage)
 {
     var formForSynchronizing = Application.OpenForms.Cast<Form>().Last();
     if (formForSynchronizing.InvokeRequired)
     {
         formForSynchronizing.BeginInvoke(new Action(() =>
         {
             ShowToast(shortUserLevelMessage, exception, fullDetailedMessage);
         }));
         return;
     }
     var toast = new ToastNotifier();
     toast.ToastClicked +=
         (s, e) => { SIL.Reporting.ErrorReport.ReportNonFatalExceptionWithMessage(exception, fullDetailedMessage); };
     toast.Image.Image = ToastNotifier.WarningBitmap;
     toast.Show(shortUserLevelMessage, "Report", 5);
 }