This is a migrated thread and some comments may be shown as answers.

How to utilize launch argument in Editor

2 Answers 100 Views
ToastNotificationManager
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 14 Mar 2021, 11:42 PM

Hello,

I just recently discovered that this tool was added to the Telerik win UI toolbox and love the functionality. Within the editor it is possible to assign a launch argument value. However, after reviewing the documentation I'm not entirely sure how to go about referencing that argument within the toast template, as well as passing in the value for that argument at run time.

I've attached a screenshot of what I'm trying to accomplish within the toast notification editor. Two questions:

1) What's the correct syntax to reference the launch argument variable value within the toast notification editor?

2) Is there a method to assign the variable value prior to calling the .ShowToastNotification(index) method?

 

Thanks!

2 Answers, 1 is accepted

Sort by
0
Stoyan
Telerik team
answered on 15 Mar 2021, 12:07 PM

Hi Eric,

I am glad to see that you are trying our new Toast Notification Manager out. 

The launch argument is not a local variable that you can reference in the toast notification. It is a string that you provide and you can later use to identify the toast itself. This can be done via the static event RadToastActivated. Here is a link to an article, where you can see how to use the event. The Arguments property of the RadToastActivatedEventArgs will contain the launch argument that you provide.

About your second question, you can edit the xml of the RadToastNotification itself. The toast is actually a xml, which you can edit, prior calling Show method. Here is a small code snippet that is showing how:

string userNameArg = "Peter Jackson";
radToastNotificationManager1.ToastNotifications[0].Xml = radToastNotificationManager1.ToastNotifications[0].Xml.Replace("{userName}", userNameArg);

I assume the screenshot that you send me and use {userName} as a placeholder, which you can replace later on. So in the snippet, I replace the placeholder {userName} with the value of userNameArg in the first toast notification in our collection radToastNotificationManager1.ToastNotifications.

I hope I have answered your questions. If there is something unclear, do not hesitate to contact me.

Regards,
Stoyan
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

0
Eric
Top achievements
Rank 1
answered on 16 Mar 2021, 03:02 AM

Hi Stoyan,

Thank you for the quick turnaround and providing the exact answers I needed. It's now functioning exactly the way I needed.

Thank you,

Eric

Tags
ToastNotificationManager
Asked by
Eric
Top achievements
Rank 1
Answers by
Stoyan
Telerik team
Eric
Top achievements
Rank 1
Share this question
or