ProcessDataInfoPushProvider Class |
Namespace: Xcalibur.WMI.Processes
The ProcessDataInfoPushProvider type exposes the following members.
Name | Description | |
---|---|---|
ProcessDataInfoPushProvider |
Initializes a new instance of the
ProcessDataInfoPushProvider class.
|
Name | Description | |
---|---|---|
Id |
Gets or sets the id.
(Inherited from WmiModelBaseTData, TDataModel.) | |
QueryBuilder |
Gets or sets the query items.
Note: This is only used for Pull implementations.
(Inherited from WmiModelBaseTData, TDataModel.) | |
Results |
List of results from GetResults or GetResultsAsync.
This has been made public in the event that an alternate method will be used
outside of this class.
(Inherited from WmiModelBaseTData, TDataModel.) | |
WmiClass |
WMI class that corresponds to the searcher.
(Inherited from WmiModelBaseTData, TDataModel.) |
Name | Description | |
---|---|---|
CreateWatcher |
Creates the event watcher.
(Inherited from WmiPushModelBaseTData, TDataModel.) | |
Dispose |
Implement IDisposable.
Do not make this method virtual.
A derived class should not be able to override this method.
(Inherited from WmiModelBaseTData, TDataModel.) | |
Dispose(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.) | |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Get |
Gets the specified object.
(Inherited from WmiModelBaseTData, TDataModel.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
Start |
Starts this instance.
(Inherited from WmiPushModelBaseTData, TDataModel.) | |
Stop |
Stops this instance.
(Inherited from WmiPushModelBaseTData, TDataModel.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
Update(Int32) |
Updates this instance.
(Inherited from WmiPushModelBaseTData, TDataModel.) | |
UpdateTConfig(TConfig, Int32) |
Updates the specified configuration.
(Inherited from WmiModelBaseTData, TDataModel.) |
Name | Description | |
---|---|---|
ItemsAdded |
Occurs when [items added].
(Inherited from WmiPushModelBaseTData, TDataModel.) | |
ItemsDeleted |
Occurs when [items deleted].
(Inherited from WmiPushModelBaseTData, TDataModel.) | |
ItemsModified |
Occurs when [items modified].
(Inherited from WmiPushModelBaseTData, TDataModel.) |
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 */