EventLogWatcher EventLogWatcher EventLogWatcher EventLogWatcher Class

定義

讓您訂閱內送事件。Allows you to subscribe to incoming events. 每次所需的事件發行至事件記錄檔時,就會引發 EventRecordWritten 事件,並會執行處理這個事件的方法。Each time a desired event is published to an event log, the EventRecordWritten event is raised, and the method that handles this event will be executed.

public ref class EventLogWatcher : IDisposable
public class EventLogWatcher : IDisposable
type EventLogWatcher = class
    interface IDisposable
Public Class EventLogWatcher
Implements IDisposable
繼承
EventLogWatcherEventLogWatcherEventLogWatcherEventLogWatcher
實作

範例

例如程式碼使用這個類別中,請參閱How to:訂閱事件記錄檔中的事件For example code using this class, see How to: Subscribe to Events in an Event Log.

備註

建立這個類別的執行個體EventLogQuery物件,指定的事件訂用帳戶的查詢。The instances of this class are created from EventLogQuery objects, which specify a query for the event subscription. 當所記錄之事件符合查詢中表示的準則時,就會引發 EventRecordWritten 事件。When an event is logged that matches the criteria expressed in the query, then the EventRecordWritten event is raised.

建構函式

EventLogWatcher(EventLogQuery) EventLogWatcher(EventLogQuery) EventLogWatcher(EventLogQuery) EventLogWatcher(EventLogQuery)

藉由指定事件查詢,初始化 EventLogWatcher 類別的新執行個體。Initializes a new instance of the EventLogWatcher class by specifying an event query.

EventLogWatcher(EventLogQuery, EventBookmark) EventLogWatcher(EventLogQuery, EventBookmark) EventLogWatcher(EventLogQuery, EventBookmark) EventLogWatcher(EventLogQuery, EventBookmark)

藉由指定事件查詢以及做為查詢開始位置的書籤,初始化 EventLogWatcher 類別的新執行個體。Initializes a new instance of the EventLogWatcher class by specifying an event query and a bookmark that is used as starting position for the query.

EventLogWatcher(EventLogQuery, EventBookmark, Boolean) EventLogWatcher(EventLogQuery, EventBookmark, Boolean) EventLogWatcher(EventLogQuery, EventBookmark, Boolean) EventLogWatcher(EventLogQuery, EventBookmark, Boolean)

藉由指定事件查詢、做為查詢開始位置的書籤,以及判斷是否要讀取事件記錄檔中現有事件的布林值,初始化 EventLogWatcher 類別的新執行個體。Initializes a new instance of the EventLogWatcher class by specifying an event query, a bookmark that is used as starting position for the query, and a Boolean value that determines whether to read the events that already exist in the event log.

EventLogWatcher(String) EventLogWatcher(String) EventLogWatcher(String) EventLogWatcher(String)

藉由指定事件記錄檔的名稱或路徑,初始化 EventLogWatcher 類別的新執行個體。Initializes a new instance of the EventLogWatcher class by specifying the name or path to an event log.

屬性

Enabled Enabled Enabled Enabled

取得或設定值,指出這個物件是否會開始傳遞事件至事件委派。Gets or sets a value that indicates whether this object starts delivering events to the event delegate.

方法

Dispose() Dispose() Dispose() Dispose()

釋放這個物件所使用的所有資源。Releases all the resources used by this object.

Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

釋放這個物件所使用的 Unmanaged 資源,並選擇性地釋放 Managed 資源。Releases the unmanaged resources used by this object, and optionally releases the managed resources.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)

事件

EventRecordWritten EventRecordWritten EventRecordWritten EventRecordWritten

允許設定委派 (事件處理常式方法),每次發行符合這個物件之事件查詢中所指定準則的事件時,都會呼叫這個委派。Allows setting a delegate (event handler method) that gets called every time an event is published that matches the criteria specified in the event query for this object.

適用於

另請參閱