| Visual Basic (Declaration) | |
|---|---|
Public Property ServiceType As ServiceType | |
| Visual Basic (Usage) | Copy Code |
|---|---|
Dim instance As WebNotification Dim value As ServiceType instance.ServiceType = value value = instance.ServiceType | |
| C# | |
|---|---|
public ServiceType ServiceType {get; set;} | |
WebNotification provides two types ServiceType. They are WebForm ServiceType and WebService ServiceType.
- WebForm ServiceType.
This is the default value for ServiceType property. WebForm mode is recommended when the data provider is private and does not need to be exposed. With this mode, you need to set the WebForm (aspx) page which the control will invoke. You can set the ServiceUrl to either the current caller page or another WebForm page in the application. - WebService ServiceType.
This type allows you to retrieve Notifications data from a web service (asmx) page. When set to this mode, you set the ServiceUrl to the web service page containing the method required by WebNotification control. The WebService mode is the recommended data provider setting when the methods need to be exposed for other usage. Note that both WebForm and WebService have similar method signature and returned object type. This allows you to easily switch between WebForm and WebService as necessary in certain phase of development.
The following example shows you the WebNotification that use WebService engine as its ServiceType is set to WebService (default). The WebNotification control will look for 'GetNotifications' method in the specified webservice page (WebNotificationService3.asmx
in this example). For better understanding please refer to 'WebFormType.aspx' in WebDesktopSamples.
| C# | Copy Code |
|---|---|
[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; } | |
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2