本文整理匯總了VB.NET中System.Web.Management.WebBaseEventCollection類的典型用法代碼示例。如果您正苦於以下問題:VB.NET WebBaseEventCollection類的具體用法?VB.NET WebBaseEventCollection怎麽用?VB.NET WebBaseEventCollection使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了WebBaseEventCollection類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: SampleWebBaseEventCollection
' 導入命名空間
Imports System.Text
Imports System.Web
Imports System.Web.Management
Imports System.Collections
' Implements a custom WebBaseEvent class.
' Everytime this class is instantiated a WebBaseEvent is
' created. This event object is then added to the static
' simulatedEvents array list.
Public Class SampleWebBaseEventCollection
Inherits System.Web.Management.WebBaseEvent
Private customCreatedMsg As String
Private Shared simulatedEvents As New ArrayList()
Private Shared events _
As System.Web.Management.WebBaseEventCollection
' Create a new WebBaseEvent and add it to the
' static array list simulatedEvents.
Public Sub New(ByVal msg As String, ByVal eventSource As Object, _
ByVal eventCode As Integer)
MyBase.New(msg, eventSource, eventCode)
customCreatedMsg = String.Format("Event created at: {0}", _
DateTime.Now.TimeOfDay.ToString())
simulatedEvents.Add(Me)
End Sub
' Get the event with the specified index.
Public Shared Function GetItem(ByVal index _
As Integer) As WebBaseEvent
Return events(index)
End Function 'GetItem
' Get the index of the specified event.
Public Shared Function GetIndexOf(ByVal ev _
As WebBaseEvent) As Integer
Return events.IndexOf(ev)
End Function 'GetIndexOf
' Chek if the specified event is in the collection.
Public Shared Function ContainsEvent(ByVal ev _
As WebBaseEvent) As Boolean
Return events.Contains(ev)
End Function 'ContainsEvent
' Create an event collection.
' Add to it the created simulatedEvents.
Public Shared Sub AddEvents()
events = _
New System.Web.Management.WebBaseEventCollection(simulatedEvents)
End Sub
' Display the events contained in the collection.
Public Overrides Sub FormatCustomEventDetails(ByVal formatter _
As WebEventFormatter)
MyBase.FormatCustomEventDetails(formatter)
' Add custom data.
formatter.AppendLine("")
formatter.IndentationLevel += 1
formatter.AppendLine("**SampleWebBaseEventCollection Data Start **")
Dim ev As WebBaseEvent
For Each ev In events
formatter.AppendLine(String.Format("Message: {0}", _
ev.Message))
formatter.AppendLine(String.Format("Source: {0}", _
ev.EventSource.ToString()))
formatter.AppendLine(String.Format("Code: {0}", _
ev.EventCode.ToString()))
Next ev
formatter.AppendLine("**SampleWebBaseEventCollection Data End **")
formatter.IndentationLevel -= 1
End Sub
End Class