EventLog.EnableRaisingEvents プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > EventLog.EnableRaisingEvents プロパティの意味・解説 

EventLog.EnableRaisingEvents プロパティ

EventLog が EntryWritten イベント通知受信するかどうかを示す値を取得または設定します

名前空間: System.Diagnostics
アセンブリ: System (system.dll 内)
構文構文

Public Property EnableRaisingEvents As
 Boolean
Dim instance As EventLog
Dim value As Boolean

value = instance.EnableRaisingEvents

instance.EnableRaisingEvents = value
public bool EnableRaisingEvents { get;
 set; }
public:
property bool EnableRaisingEvents {
    bool get ();
    void set (bool value);
}
/** @property */
public boolean get_EnableRaisingEvents ()

/** @property */
public void set_EnableRaisingEvents (boolean
 value)
public function get EnableRaisingEvents
 () : boolean

public function set EnableRaisingEvents
 (value : boolean)

プロパティ
エントリがログ書き込まれたときに EventLog通知受信する場合trueそれ以外場合false

解説解説

エントリがログ書き込まれたときに EventLogイベント発生させるかどうかは、EnableRaisingEvents プロパティによって決定されます。このプロパティtrue のとき、Log プロパティ指定されログにエントリが書き込まれるたびに EntryWritten イベント受信するコンポーネント通知受け取りますEnableRaisingEventsfalse のときはイベント発生しません。

使用例使用例

EntryWritten イベント処理する例を次に示します

Option Strict
Option Explicit

Imports System
Imports System.Diagnostics
Imports System.Threading

Class MySample
    Public Shared Sub Main()
        
        Dim myNewLog As New
 EventLog()
        myNewLog.Log = "MyCustomLog"
        
        AddHandler myNewLog.EntryWritten, AddressOf
 MyOnEntryWritten
        myNewLog.EnableRaisingEvents = True
        
        
        Console.WriteLine("Press 'q' to quit.")
        ' Wait for the EntryWrittenEvent or a quit command.
        While Char.ToLower(Convert.ToChar(Console.Read()))<>"q"
            ' Wait.
        End While 
    End Sub ' Main
    
    Public Shared Sub MyOnEntryWritten(source
 As Object, e As EntryWrittenEventArgs)
        Console.WriteLine(("Written: " + e.Entry.Message))
    End Sub ' MyOnEntryWritten
End Class ' MySample
using System;
using System.Diagnostics;
using System.Threading;
              
class MySample{


    public static void Main(){
    
        EventLog myNewLog = new EventLog();
        myNewLog.Log = "MyCustomLog";                      
        
        myNewLog.EntryWritten += new EntryWrittenEventHandler(MyOnEntryWritten);
        myNewLog.EnableRaisingEvents = true;
        
        
        Console.WriteLine("Press \'q\' to quit.");
        // Wait for the EntryWrittenEvent or a quit command.
        while(Console.Read() != 'q'){
            // Wait.
        }                                                                       
                                                  
    }       

    public static void MyOnEntryWritten(Object
 source, EntryWrittenEventArgs e){
        Console.WriteLine("Written: " + e.Entry.Message);
    }
}

#using <System.dll>

using namespace System;
using namespace System::Diagnostics;
using namespace System::Threading;
ref class MySample
{
public:
   static void MyOnEntryWritten( Object^ /*source*/,
 EntryWrittenEventArgs^ e )
   {
      Console::WriteLine( "Written: {0}", e->Entry->Message );
   }

};

int main()
{
   EventLog^ myNewLog = gcnew EventLog;
   myNewLog->Log = "MyCustomLog";
   myNewLog->EntryWritten += gcnew EntryWrittenEventHandler( MySample::MyOnEntryWritten
 );
   myNewLog->EnableRaisingEvents = true;
   Console::WriteLine( "Press \'q\' to quit." );
   
   // Wait for the EntryWrittenEvent or a quit command.
   while ( Console::Read() != 'q' )
   {
      
      // Wait.
   }
}

import System.*;
import System.Diagnostics.*;
import System.Threading.*;

class MySample
{
    public static void main(String[]
 args)
    {
        EventLog myNewLog = new EventLog();
        myNewLog.set_Log("MyCustomLog");
        myNewLog.add_EntryWritten(new EntryWrittenEventHandler(
            MyOnEntryWritten));
        myNewLog.set_EnableRaisingEvents(true);
        Console.WriteLine("Press \'q\' to quit.");

        // Wait for the EntryWrittenEvent or a quit command.
        while (Console.Read() != 'q') {
            // Wait.
        } 
    } //main

    private static void
 MyOnEntryWritten(Object source, EntryWrittenEventArgs e)
    {
        Console.WriteLine("Written: " + e.get_Entry().get_Message());
    } //MyOnEntryWritten
} //MySample
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「EventLog.EnableRaisingEvents プロパティ」の関連用語

EventLog.EnableRaisingEvents プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



EventLog.EnableRaisingEvents プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS