Comment ABL Toast Notifications

Cecil

19+ years progress programming and still learning.
I was exploring the possibility of using Windows' API of using Toast Notification and this is what I was able to create.


1713092288838.png


I've included some dirty code as a proof of concept.

Code:
using Microsoft.Toolkit.Uwp.Notifications.*.
using System.*.
using System.DateTimeOffset.*.

block-level on error undo, throw.

/* ********************  Preprocessor Definitions  ******************** */

DEFINE VARIABLE content  AS CLASS ToastContentBuilder.
    
    define variable uriAppLogo  as class System.Uri no-undo.
    define variable uriHeroLogo  as class System.Uri no-undo.


/* ***************************  Main Block  *************************** */


content  = NEW Microsoft.Toolkit.Uwp.Notifications.ToastContentBuilder().


    //content:AddToastActivationInfo("action=viewConversation&conversationId=5", ToastActivationType:Foreground).
    
    content:AddArgument("conversationId", 9813).
    content:AddArgument("action", "viewConversation").
    
    //content:SetBackgroundActivation().
    
    //content:AddHeroImage(new System.Uri("https://www.progresstalk.com/progresstalk_forum.png"), "", true).
    //content:AddInlineImage(new System.Uri("https://www.progresstalk.com/progresstalk_forum.png"), "", ?).
    
    uriHeroLogo = new System.Uri("C:\Users\james\Downloads\progresstalk-logo.jpg").
    uriAppLogo = new System.Uri("C:\Users\james\Downloads\2499.jpg").
    
    content:AddHeroImage(new System.Uri(uriHeroLogo:AbsoluteUri), "", true).
    content:AddAppLogoOverride(new System.Uri(uriAppLogo:AbsoluteUri), ToastGenericAppLogoCrop:Circle , "", ?).
    
    //this-object:Leave:Subscribe( this-object:Form1_Leave).
    
    content:SetBackgroundActivation().
    
    //Open as web page
    content:SetProtocolActivation(new System.Uri("https://www.progresstalk.com")).
    
    //content:AddHeader("abc123","OpenEdge ABL Toast Notification","apply").
    
    content:AddText("Hello, Progress Talk!",?,?,?,?,?,?).
    content:AddText("Check this out! ABL Toast Notifications",?,?,?,?,?,?).
    
    define variable deliveryTime as class System.DateTimeOffset no-undo.
    
    // Delay Start
    // deliveryTime = DateTimeOffset:Now:AddSeconds(10).
    // content:Schedule(deliveryTime).
    
   //Or show now.
    content:Show().

The part the that is setting me back is when the use clicks on the notification, I'm not quite sure how the callback will work with the ABL. Currently, I have that will open a webpage.
 

Cecil

19+ years progress programming and still learning.
A custom URI scheme could be a puzzle piece.

Disclaimer: I have never tried it.
I have some proof of concept working with custom URI sachems by executing a bat file.
But, what I was really looking for wa finding out how to trigger the "OnActive" event within the current ABL application.
I think I'm just gonna have to chalk this down to one of the limitations of the ABL language running in .NET CLI Runtime. .
 

TomBascom

Curmudgeon
For the ignorant among us (like me)... what the heck is a "Toast Notification" and why would I care? My friend Google seems to be telling me that it is, basically, a MESSAGE statement (presumably) for GUI apps? I'm guessing that it doesn't steal focus or demand user input? (Kind of like the classic MESSAGE statement before it got cluttered up with crap.)
 

Rob Fitzpatrick

ProgressTalk.com Sponsor
It's an OS notification mechanism where a small panel slowly pops up in the corner of the screen, in a manner reminiscent of a piece of toast popping up from a toaster; thus, "toast notification". The panel contains a short message and the name of the application or OS component that created it. Clicking on that panel can trigger an action, like opening a window for the originating application, to give you more information about the notification.

Why would you care? You wouldn't, because you don't use Windows, apart from brief moments of duress. ;)

You are correct, it doesn't steal focus or demand attention. It is non-modal and relatively inobtrusive. If the user thinks a notification is important, they can click on it. If they want to look at it later, they can click the notification bell icon in the system tray to see the list of recent notifications.
 

Cecil

19+ years progress programming and still learning.
For the ignorant among us (like me)... what the heck is a "Toast Notification" and why would I care? My friend Google seems to be telling me that it is, basically, a MESSAGE statement (presumably) for GUI apps? I'm guessing that it doesn't steal focus or demand user input? (Kind of like the classic MESSAGE statement before it got cluttered up with crap.)
Not being a Mac user, I think this is the equivalent to the Windows Toast Notification.

1713385547388.png
 
Top