EventArrivedEventArgs クラスとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > EventArrivedEventArgs クラスの意味・解説 

EventArrivedEventArgs クラス

EventArrived イベントイベント データ保持します

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

Public Class EventArrivedEventArgs
    Inherits ManagementEventArgs
Dim instance As EventArrivedEventArgs
public class EventArrivedEventArgs : ManagementEventArgs
public ref class EventArrivedEventArgs : public
 ManagementEventArgs
public class EventArrivedEventArgs extends
 ManagementEventArgs
public class EventArrivedEventArgs extends
 ManagementEventArgs
解説解説

次に示す非同期の例は、イベント毎秒発生させるように WMI タイマ設定して不要になったときに WMI タイマ削除します。ManagementEventWatcher は、WMI イベント配信されたときに発生する複数.NET Framework イベント定義します受信データ処理するために、これらのイベントデリゲートが結びつけられます。

Imports System
Imports System.Management

' This example shows asynchronous consumption of events.
' In this example you are listening for timer events.
' The first part of the example sets up the timer.

Public Class EventWatcherAsync

    Public Sub New()
        ' Set up a timer to raise events every 1 second
        '=============================================
        Dim timerClass As New
 ManagementClass( _
            "__IntervalTimerInstruction")
        Dim timer As ManagementObject = _
            timerClass.CreateInstance()
        timer("TimerId") = "Timer1"
        timer("IntervalBetweenEvents") = 1000
        timer.Put()

        ' Set up the event consumer
        '==========================
        ' Create event query to receive timer events
        Dim query As New
 WqlEventQuery("__TimerEvent", _
            "TimerId=""Timer1""")

        ' Initialize an event watcher and subscribe to 
        ' events that match this query
        Dim watcher As New
 ManagementEventWatcher(query)

        ' Set up a listener for events
        AddHandler watcher.EventArrived, _
            AddressOf Me.HandleEvent

        ' Start listening
        watcher.Start()

        ' Do something in the meantime
        System.Threading.Thread.Sleep(10000)

        ' Stop listening
        watcher.Stop()

    End Sub

    Private Sub HandleEvent(ByVal
 sender As Object, _
        ByVal e As EventArrivedEventArgs)

        Console.WriteLine("Event arrived !")
    End Sub

    Public Overloads Shared
 Function _
            Main(ByVal args() As String)
 As Integer

        'start the event watcher
        Dim eventWatcher As New
 EventWatcherAsync

        Return 0

    End Function

End Class
using System;
using System.Management;

// This example shows asynchronous consumption of events.
// In this example you are listening for timer events.
// The first part of the example sets up the timer.
public class EventWatcherAsync 
{
    public EventWatcherAsync()
    {
        // Set up a timer to raise events every 1 second
        //=============================================
        ManagementClass timerClass = 
            new ManagementClass("__IntervalTimerInstruction");
        ManagementObject timer = timerClass.CreateInstance();
        timer["TimerId"] = "Timer1";
        timer["IntervalBetweenEvents"] = 1000;
        timer.Put();

        // Set up the event consumer
        //==========================
        // Create event query to receive timer events
        WqlEventQuery query = 
            new WqlEventQuery("__TimerEvent",
            "TimerId=\"Timer1\"");

        // Initialize an event watcher and 
        // subscribe to timer events 
        ManagementEventWatcher watcher = 
            new ManagementEventWatcher(query);

        // Set up a listener for events
        watcher.EventArrived += 
            new EventArrivedEventHandler(
            this.HandleEvent);

        // Start listening
        watcher.Start();

        // Do something in the meantime
        System.Threading.Thread.Sleep(10000);
      
        // Stop listening
        watcher.Stop();
        
    }


    private void HandleEvent(object sender
,
        EventArrivedEventArgs e)   
    {
        Console.WriteLine("Event arrived !");
    }

    public static void Main(string[]
 args) 
    {
        // start the event watcher
        EventWatcherAsync eventWatcher = new
            EventWatcherAsync();
    }
}
継承階層継承階層
System.Object
   System.EventArgs
     System.Management.ManagementEventArgs
      System.Management.EventArrivedEventArgs
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

「EventArrivedEventArgs クラス」の関連用語

EventArrivedEventArgs クラスのお隣キーワード
検索ランキング

   

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



EventArrivedEventArgs クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS