); } After the previous function, add the following function which serves as a callback function for the push notification calls: (Code Snippet Using Push Notifications MainWindow.xaml.cs – – – OnMessageSent function) C# private void OnMessageSent(NotificationType type, MessageSendResult result) { PushNotificationsLogMsg msg = new PushNotificationsLogMsg(type, result); Dispatcher.BeginInvoke((Action)(() => { trace.Add(msg); })); } Locate the Private functionality region and add the following function (this function updates the WPF client application’s UI): (Code Snippet Using Push Notifications MainWindow.xaml.cs UpdateStatus – – – function) C# private void UpdateStatus() { int activeSubscribers = bool isReady = (activeSubscribers > 0); txtActiveConnections.Text = activeSubscribers.ToString(); txtStatus.Text = isReady ? "Ready" : "Waiting for connection..."; } Locate the sendHttp function and add the following code. This function will get the list of connected clients, prepare the payload from UI inputs and send it asynchronously using a rawPushNotificationMessage field: (Code Snippet Using Push Notifications MainWindow.xaml.cs sendHttp – – – function body) C#
); } After the previous function, add the following function which serves as a callback function for the push notification calls: (Code Snippet – Using Push Notifications – MainWindow.xaml.cs – OnMessageSent function) C# private void OnMessageSent(NotificationType type, MessageSendResult result) { PushNotificationsLogMsg msg = new PushNotificationsLogMsg(type, result); Dispatcher.BeginInvoke((Action)(() => { trace.Add(msg); })); } Locate the Private functionality region and add the following function (this function updates the WPF client application’s UI): (Code Snippet – Using Push Notifications – MainWindow.xaml.cs – UpdateStatus function) C# private void UpdateStatus() { int activeSubscribers = bool isReady = (activeSubscribers > 0); txtActiveConnections.Text = activeSubscribers.ToString(); txtStatus.Text = isReady ? "Ready" : "Waiting for connection..."; } Locate the sendHttp function and add the following code. This function will get the list of connected clients, prepare the payload from UI inputs and send it asynchronously using a rawPushNotificationMessage field: (Code Snippet – Using Push Notifications – MainWindow.xaml.cs – sendHttp function body) C#