Like a notification ballon, but more reliable "toast" because it slowly goes up, then down. Subscribe to the Click event to know if the user clicked on it. Note: currently clicking on the image or text invoke the click event, not just the action link. Note: don't use a lot of these. They hang around off-screen. (See comment in GoDownTimerTick.) It's primarily intended for something like "updates are available" that happens once per run of the program. Usage: var notifier = new ToastNotifier(); notifier.Image.Image = {some small Image, about 32x32}; notifier.ToastClicked += (sender, args) => {do something}; notifier.Show("You should know this", "Something you might do about it", {some # of seconds}); You should NOT dispose of the notifier, since we haven't found a safe time to even close it.
Inheritance: System.Windows.Forms.Form
Ejemplo n.º 1
0
 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);
 }