WebService-based Notification

This sample demonstrates the basic WebNotification usage with default styles and configurations. In this sample, the WebNotification is using following settings:

- ServiceType: WebService
- ServiceUrl: WebNotificationService3.asmx

Summary:
WebNotification control will call the specified ServiceUrl periodically on every 5 seconds (the default value of Interval property). In this sample, the WebNotification will use WebService engine as its ServiceType is set to WebService (default).

The WebNotification control will look for "GetNotifications" method in the specified webservice page. The codes look like in the following:

[WebMethod]
public WebNotificationEventCollection GetNotifications(WebNotificationEventArgs e)
{
         WebNotificationEventCollection collection = new WebNotificationEventCollection();
         WebNotificationEvent evnt = new WebNotificationEvent();
       
         evnt.CaptionText = "Samples";
         evnt.ContentText = "Hello world from WebNotification!\nCurrent time is:" + DateTime.Now.ToLongTimeString();

         collection.Notifications = new WebNotificationEvent[] { evnt };
         return collection;
}

The simple codes above describe that basically the function should return the "collection of events" which type is WebNotificationEventCollection. In this sample, we only return single event which is passed to the Notifications property of the collection object.

Results:
You should be able to see the WebNotification popup in the right bottom (DisplayPosition property) of the WebDesktopWindow. The WebNotification will popup in every 5 seconds (Interval property) and will be displayed in 5 seconds (DisplayLatency property) before the WebNotification begin to fade out.


r