using existing helper classes you will create a desktop Windows application that sends and receives local app notifications, also known as toast notifications/
and for SendToast Method we can use Existing payloads:
1 2 3 4
publicboolSendToast() { return ScenarioHelper.SendToastWithAvatar(1, "Send Local Toast with Avatar", "Hi, This is a Local Toast", "Open my App", "OpenApp", "Icon.png"); }
OR
1 2 3 4
publicboolSendToast() { return ScenarioHelper.SendToastWithTextBox(1, "textBoxReplyId", "Send Local Toast with TextBox", "Hi, This is a Local Toast", "Reply", "Pleaser Answer Here...", "Reply", "Icon.png"); }
if you are using SendToastWithTextBox you can get textbox input text in NotificationReceived method like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
publicvoidNotificationReceived(AppNotificationActivatedEventArgs notificationActivatedEventArgs) { // In a real-life scenario, this type of action would usually be processed in the background. Your App would process the payload in // the background (sending the payload back to your App Server) without ever showing the App's UI. // This is not something that can easily be demonstrated in a sample such as this one, as we need to show the UI to demonstrate how // the payload is routed internally
var input = notificationActivatedEventArgs.UserInput; var text = input[textboxReplyId];
publicApp() { this.InitializeComponent(); AppDomain.CurrentDomain.ProcessExit += new EventHandler(OnProcessExit); var c_notificationHandlers = new Dictionary<int, Action<AppNotificationActivatedEventArgs>>(); c_notificationHandlers.Add(ToastWithAvatar.Instance.ScenarioId, ToastWithAvatar.Instance.NotificationReceived); notificationManager = new NotificationManager(c_notificationHandlers); }
publicboolSendToast() { // The ScenarioIdToken uniquely identify a scenario and is used to route the response received when the user clicks on a toast to the correct scenario. var ScenarioIdToken = NotificationHelper.MakeScenarioIdToken(ScenarioId);
publicvoidNotificationReceived(AppNotificationActivatedEventArgs notificationActivatedEventArgs) { var input = notificationActivatedEventArgs.UserInput; var text = input[textboxReplyId];