locked
TOAST NOTIFICATION WITHOUT UWP RRS feed

  • Question

  • It occurred to me that it would be the Bee's Knees if I could add a toast notification function to my not-UWP C# application.  There are more than too many flaming hoops to jump through to create a UWP application, which includes programming in XAML.  Some people fell in love with XAML.  I didn't.   

    MARK D ROCKMAN

    • Changed type Naomi N Sunday, June 21, 2020 7:25 PM question
    Saturday, June 20, 2020 1:22 AM

Answers

  • Clone or download the following from GitHub. Build and run, does this meet your needs? If so but the notification window colors perhaps are not to your liking change the style. This all works with Windows Forms no XAML.

    Basic usage

    var toastNotification = new Notification(
        textBoxTitle.Text, 
        textBoxBody.Text, 
        duration, 
        animationMethod, 
        animationDirection);
    
    PlayNotificationSound(comboBoxSound.Text);
    toastNotification.Show();


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    • Proposed as answer by Naomi N Sunday, June 21, 2020 7:25 PM
    • Marked as answer by F7H2fw Monday, June 22, 2020 1:25 AM
    Saturday, June 20, 2020 11:24 AM
  • If it's a Windows Forms application, then before you get into anything too complex, try this:

    1. drop the NotifyIcon onto your main form

    2. call it like this:

    myNotifyIcon.Icon = System.Drawing.SystemIcons.Information;
    myNotifyIcon.Visible = true;
    myNotifyIcon.ShowBalloonTip(20000, yourAppName, yourMessage, ToolTipIcon.Info);

    Agree with you about xaml and the flaming hoops - don't know how people think this is easier than regular code.


    Convert between VB, C#, C++, & Java (http://www.tangiblesoftwaresolutions.com)
    Instant C# - VB to C# Converter
    Instant VB - C# to VB Converter

    • Proposed as answer by Naomi N Sunday, June 21, 2020 7:26 PM
    • Marked as answer by F7H2fw Monday, June 22, 2020 1:25 AM
    Saturday, June 20, 2020 1:36 PM
  • Hi F7H2fw,

    It seems that your problem has been solved. Please click "Mark as answer" to the appropriate answer, so that it will help other members to find the solution quickly if they face a similar issue.

    Best Regards,

    Timon


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by F7H2fw Monday, June 22, 2020 1:27 AM
    Monday, June 22, 2020 1:14 AM

All replies

  • Clone or download the following from GitHub. Build and run, does this meet your needs? If so but the notification window colors perhaps are not to your liking change the style. This all works with Windows Forms no XAML.

    Basic usage

    var toastNotification = new Notification(
        textBoxTitle.Text, 
        textBoxBody.Text, 
        duration, 
        animationMethod, 
        animationDirection);
    
    PlayNotificationSound(comboBoxSound.Text);
    toastNotification.Show();


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    • Proposed as answer by Naomi N Sunday, June 21, 2020 7:25 PM
    • Marked as answer by F7H2fw Monday, June 22, 2020 1:25 AM
    Saturday, June 20, 2020 11:24 AM
  • Thank you Ms. Payne.   The documentary web pages that mention toast notifications, in my experience, in every instance, mention UWP.  I suppose that is because toast notifications are an essential function of UWP whereas the method you describe is based on custom C++ COM code InterOp.  The sample you reference, downloadable from GitHub, works perfectly.   They don't cover these technical thingies at University.  As my French teacher for 3 years often said:  "I put an E on you."   She was a pip.   

    MARK D ROCKMAN

    Saturday, June 20, 2020 1:30 PM
  • If it's a Windows Forms application, then before you get into anything too complex, try this:

    1. drop the NotifyIcon onto your main form

    2. call it like this:

    myNotifyIcon.Icon = System.Drawing.SystemIcons.Information;
    myNotifyIcon.Visible = true;
    myNotifyIcon.ShowBalloonTip(20000, yourAppName, yourMessage, ToolTipIcon.Info);

    Agree with you about xaml and the flaming hoops - don't know how people think this is easier than regular code.


    Convert between VB, C#, C++, & Java (http://www.tangiblesoftwaresolutions.com)
    Instant C# - VB to C# Converter
    Instant VB - C# to VB Converter

    • Proposed as answer by Naomi N Sunday, June 21, 2020 7:26 PM
    • Marked as answer by F7H2fw Monday, June 22, 2020 1:25 AM
    Saturday, June 20, 2020 1:36 PM
  • Thank you, Dave.

    It works great!


    MARK D ROCKMAN

    Saturday, June 20, 2020 6:45 PM
  • Simple is better, if simple works!  (Should be Windows Forms motto).


    Convert between VB, C#, C++, & Java (http://www.tangiblesoftwaresolutions.com)
    Instant C# - VB to C# Converter
    Instant VB - C# to VB Converter

    Saturday, June 20, 2020 6:58 PM
  • Hi F7H2fw,

    It seems that your problem has been solved. Please click "Mark as answer" to the appropriate answer, so that it will help other members to find the solution quickly if they face a similar issue.

    Best Regards,

    Timon


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by F7H2fw Monday, June 22, 2020 1:27 AM
    Monday, June 22, 2020 1:14 AM