| 18 | |
| 19 | // A Helper function for showing notifications |
| 20 | function showNotification(title, text, onActiviation, onDismissal) { |
| 21 | |
| 22 | var toastXml = new xml.XmlDocument(); |
| 23 | toastXml.loadXml(util.format(msgTemplate, title, text)); |
| 24 | var toast = new notifications.ToastNotification(toastXml); |
| 25 | |
| 26 | toast.on("activated", function (sender, eventArgs) { |
| 27 | onActiviation(); |
| 28 | }); |
| 29 | |
| 30 | toast.on("dismissed", function () { |
| 31 | onDismissal(); |
| 32 | }); |
| 33 | |
| 34 | notifications.ToastNotificationManager.createToastNotifier(appId).show(toast); |
| 35 | } |
| 36 | |
| 37 | showNotification('Hello NodeRT!', 'Please click here', function() { |
| 38 | console.info('got event: toast activated!'); |