void Watch(PropertyManager PM, String path) { ManagedObjectReference vm = cb.getConnection().Service.FindByInventoryPath( cb.getConnection().ServiceContent.searchIndex, path); if (vm == null) { System.Console.WriteLine("Virtual Machine located at path: " + path + " not found."); return; } // Create a FilterSpec PropertySpec pSpec = new PropertySpec(); pSpec.type = vm.type; pSpec.pathSet = new String[] { "guest", "summary.quickStats", "summary.runtime.powerState" }; ObjectSpec oSpec = new ObjectSpec(); oSpec.obj = vm; oSpec.skip = false; oSpec.skipSpecified = true; PropertyFilterSpec pfSpec = new PropertyFilterSpec(); pfSpec.propSet = new PropertySpec[] { pSpec }; pfSpec.objectSet = new ObjectSpec[] { oSpec }; Console.WriteLine("Updates being displayed...Press Ctrl-Break to exit"); PM.Register(pfSpec, false, new PropertyFilterUpdateHandler(DisplayUpdates)); while (true) { System.Threading.Thread.Sleep(100); } }
void Watch() { PropertyManager PM = new PropertyManager(cb.getConnection(), cb.getConnection().ServiceContent); PM.ListenerException += new ListenerExceptionHandler(PM_ListenerException); PM.StartListening(); Watch(PM, cb.get_option("vmpath")); }
public TaskWaiter(PropertyManager pm, ManagedObjectReference task) { _task = task; _pm = pm; ObjectSpec oSpec = new ObjectSpec(); oSpec.obj = task; oSpec.skip = false; oSpec.skipSpecified = true; PropertySpec pSpec = new PropertySpec(); pSpec.all = false; pSpec.allSpecified = true; pSpec.pathSet = new String[] { "info.error", "info.state" }; pSpec.type = task.type; _pfSpec = new PropertyFilterSpec(); _pfSpec.objectSet = new ObjectSpec[] { oSpec }; _pfSpec.propSet = new PropertySpec[] { pSpec }; }