static void Main(string[] args) { // get all components from the ROT table IList <RunningObjectTableComponentInfo> ROTComponents = RunningObjectTable.GetComponentsFromROT(); Console.WriteLine("Component count: " + ROTComponents.Count.ToString()); // display all properties out of the found components foreach (RunningObjectTableComponentInfo ROTComponent in ROTComponents) { Console.WriteLine("Displayname: " + ROTComponent.DisplayName); Console.WriteLine("ClassID: " + ROTComponent.ClsID); Console.WriteLine("LastChanged: " + ROTComponent.LastChanged); Console.WriteLine("SizeMax: " + ROTComponent.SizeMax); Console.WriteLine("ComponentName: " + ROTComponent.ComponentName); Console.WriteLine("ComponentClassName: " + ROTComponent.ComponentClassName); Console.WriteLine("Component is running ? " + ROTComponent.IsRunning.ToString()); Console.WriteLine("Component is dirty ? " + ROTComponent.IsDirty.ToString()); Console.WriteLine(""); object comInstance = ROTComponent.GetInstance(); System.Threading.Thread.Sleep(500); System.Runtime.InteropServices.Marshal.ReleaseComObject(comInstance); System.Threading.Thread.Sleep(500); } Console.ReadLine(); }
// function to refresh the property values of an RunningObjectTableComponent object private void Refresh() { // set default values this._IsDirty = false; this._IsRunning = false; // refresh the properties of the component by a call to GetComponentsFromROT() foreach (RunningObjectTableComponentInfo RunningROTComponent in RunningObjectTable.GetComponentsFromROT()) { // if the object is still in the ROT table we refresh the property values if (RunningROTComponent.DisplayName == this.DisplayName) { // if the object is still in the ROT table and the refreshed property _IsRunning is still true we return true this._IsDirty = RunningROTComponent._IsDirty; // if the object is still in the ROT table and the refreshed property _IsRunning is still true we return true this._IsRunning = RunningROTComponent._IsRunning; // if the object is still in the ROT table we return the refreshed LastChanged DateTime this._LastChanged = RunningROTComponent._LastChanged; break; } } }