Click or drag to resize

ProcessDataInfoPushProvider Class

Processor Data Information Provider - Push.
Inheritance Hierarchy
SystemObject
  Xcalibur.WMI.FrameworkWmiModelBaseIProcessDataInfo, ProcessDataInfo
    Xcalibur.WMI.FrameworkWmiPushModelBaseIProcessDataInfo, ProcessDataInfo
      Xcalibur.WMI.ProcessesProcessDataInfoPushProvider

Namespace:  Xcalibur.WMI.Processes
Assembly:  Xcalibur.WMI (in Xcalibur.WMI.dll) Version: 3.0.0.0 (3.0.1.0)
Syntax
public sealed class ProcessDataInfoPushProvider : WmiPushModelBase<IProcessDataInfo, ProcessDataInfo>, 
	IProcessDataInfoPushProvider, IWmiPushModelBase<IProcessDataInfo>, IWmiModelBase<IProcessDataInfo>, 
	IDisposable

The ProcessDataInfoPushProvider type exposes the following members.

Constructors
  NameDescription
Public methodCode exampleProcessDataInfoPushProvider
Initializes a new instance of the ProcessDataInfoPushProvider class.
Top
Properties
Methods
  NameDescription
Public methodCreateWatcher
Creates the event watcher.
(Inherited from WmiPushModelBaseTData, TDataModel.)
Public methodDispose
Implement IDisposable. Do not make this method virtual. A derived class should not be able to override this method.
(Inherited from WmiModelBaseTData, TDataModel.)
Public methodDispose(Boolean)
Dispose(bool disposing) executes in two distinct scenarios. If disposing equals true, the method has been called directly or indirectly by a user's code. Managed and unmanaged resources can be disposed. If disposing equals false, the method has been called by the runtime from inside the finalizer and you should not reference other objects. Only unmanaged resources can be disposed.
(Inherited from WmiPushModelBaseTData, TDataModel.)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGet
Gets the specified object.
(Inherited from WmiModelBaseTData, TDataModel.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodStart
Starts this instance.
(Inherited from WmiPushModelBaseTData, TDataModel.)
Public methodStop
Stops this instance.
(Inherited from WmiPushModelBaseTData, TDataModel.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodUpdate(Int32)
Updates this instance.
(Inherited from WmiPushModelBaseTData, TDataModel.)
Public methodUpdateTConfig(TConfig, Int32)
Updates the specified configuration.
(Inherited from WmiModelBaseTData, TDataModel.)
Top
Events
Examples
C#
  1// Main
  2private static void Main()
  3{
  4    // Make a connection to the local machine
  5    const string computer = ".";
  6    var managementScope = new ManagementScope($@"\\{computer}\root\cimv2", new ConnectionOptions
  7    {
  8        Impersonation = ImpersonationLevel.Impersonate,
  9        Authentication = AuthenticationLevel.Connect
 10    });
 11    managementScope.Connect();
 12
 13    // Process data configuration
 14    // We need to specify what we want to retrieve
 15    var config = new ProcessDataConfig
 16    {
 17        ProcessId = true,
 18        Name = true,
 19        KernelModeTime = true,
 20        UserModeTime = true
 21    };
 22
 23    // Process data information on a 1-second polling cycle for Process ID: 23100
 24    var provider = new ProcessDataInfoPushProvider(managementScope, config, 1000, 23100);
 25
 26    // Items Added
 27    provider.ItemsAdded += (item, e) =>
 28    {
 29        Console.WriteLine("Event: Item Added");
 30        Console.WriteLine($"{item.ProcessId}: \t{item.Name}");
 31        Console.WriteLine("");
 32    };
 33
 34    // Items Modified
 35    provider.ItemsModified += (item, e) =>
 36    {
 37        Console.WriteLine("Event: Item Modified");
 38        Console.WriteLine($"{item.ProcessId}: \t{item.Name}");
 39
 40        // We chose these values because we know they will constantly increase
 41        Console.WriteLine($"User Mode Time: \t{item.UserModeTime}");
 42        Console.WriteLine($"Kernel Mode Time: \t{item.KernelModeTime}");
 43        Console.WriteLine("");
 44    };
 45
 46    // Items Deleted
 47    provider.ItemsDeleted += (item, e) =>
 48    {
 49        Console.WriteLine("Event: Item Deleted");
 50        Console.WriteLine($"{item.ProcessId}: \t{item.Name}");
 51        Console.WriteLine("");
 52    };
 53
 54    // Read
 55    Console.Read();
 56}
 57
 58/* Results: 
 59 * 
 60 * Event: Item Added
 61 * 23100:  WindowsDashboard.exe
 62 * 
 63 * Event: Item Modified
 64 * 23100:  WindowsDashboard.exe
 65 * User Mode Time:         2235468750
 66 * Kernel Mode Time:       764843750
 67 * 
 68 * Event: Item Modified
 69 * 23100:  WindowsDashboard.exe
 70 * User Mode Time:         2238437500
 71 * Kernel Mode Time:       766093750
 72 * 
 73 * Event: Item Modified
 74 * 23100:  WindowsDashboard.exe
 75 * User Mode Time:         2239375000
 76 * Kernel Mode Time:       766093750
 77 * 
 78 * Event: Item Modified
 79 * 23100:  WindowsDashboard.exe
 80 * User Mode Time:         2242656250
 81 * Kernel Mode Time:       766406250
 82 * 
 83 * Event: Item Modified
 84 * 23100:  WindowsDashboard.exe
 85 * User Mode Time:         2243593750
 86 * Kernel Mode Time:       766718750
 87 * 
 88 * Event: Item Modified
 89 * 23100:  WindowsDashboard.exe
 90 * User Mode Time:         2244843750
 91 * Kernel Mode Time:       767500000
 92 * 
 93 * Event: Item Modified
 94 * 23100:  WindowsDashboard.exe
 95 * User Mode Time:         2247343750
 96 * Kernel Mode Time:       768281250
 97 * 
 98 * Event: Item Modified
 99 * 23100:  WindowsDashboard.exe
100 * User Mode Time:         2248906250
101 * Kernel Mode Time:       768906250
102 * 
103 * Event: Item Modified
104 * 23100:  WindowsDashboard.exe
105 * User Mode Time:         2250781250
106 * Kernel Mode Time:       769531250
107 * 
108 * Event: Item Modified
109 * 23100:  WindowsDashboard.exe
110 * User Mode Time:         2252812500
111 * Kernel Mode Time:       769843750
112 * 
113 * Event: Item Modified
114 * 23100:  WindowsDashboard.exe
115 * User Mode Time:         2255781250
116 * Kernel Mode Time:       770468750
117 * 
118 * Event: Item Modified
119 * 23100:  WindowsDashboard.exe
120 * User Mode Time:         2256718750
121 * Kernel Mode Time:       770937500
122 * 
123 */
See Also