public PropertyFilterUpdateEventArgs(PropertyFilterUpdate filterUpdate) { _filterUpdate = filterUpdate; }
/// <summary> /// Handle Updates for a single object. /// waits till expected values of properties to check are reached /// Destroys the ObjectFilter when done. /// </summary> /// <param name="objmor">MOR of the Object to wait for</param> /// <param name="filterProps">Properties list to filter</param> /// <param name="endWaitProps"> /// Properties list to check for expected values /// these be properties of a property in the filter properties list /// </param> /// <param name="expectedVals">values for properties to end the wait</param> /// <returns>true indicating expected values were met, and false otherwise</returns> public object[] WaitForValues( ManagedObjectReference objmor, string[] filterProps, string[] endWaitProps, object[][] expectedVals ) { // version string is initially null string version = ""; object[] endVals = new object[endWaitProps.Length]; object[] filterVals = new object[filterProps.Length]; PropertyFilterSpec spec = new PropertyFilterSpec(); spec.objectSet = new ObjectSpec[] { new ObjectSpec() }; spec.objectSet[0].obj = objmor; spec.propSet = new PropertySpec[] { new PropertySpec() }; spec.propSet[0].pathSet = filterProps; spec.propSet[0].type = objmor.type; spec.objectSet[0].selectSet = null; spec.objectSet[0].skip = false; spec.objectSet[0].skipSpecified = true; ManagedObjectReference filterSpecRef = _connection.Service.CreateFilter( _connection.PropCol, spec, true ); bool reached = false; UpdateSet updateset = null; PropertyFilterUpdate[] filtupary = null; PropertyFilterUpdate filtup = null; ObjectUpdate[] objupary = null; ObjectUpdate objup = null; PropertyChange[] propchgary = null; PropertyChange propchg = null; while (!reached) { updateset = _connection.Service.WaitForUpdates( _connection.PropCol, version ); version = updateset.version; if (updateset == null || updateset.filterSet == null) { continue; } // Make this code more general purpose when PropCol changes later. filtupary = updateset.filterSet; filtup = null; for (int fi = 0; fi < filtupary.Length; fi++) { filtup = filtupary[fi]; objupary = filtup.objectSet; objup = null; propchgary = null; for (int oi = 0; oi < objupary.Length; oi++) { objup = objupary[oi]; // TODO: Handle all "kind"s of updates. if (objup.kind == ObjectUpdateKind.modify || objup.kind == ObjectUpdateKind.enter || objup.kind == ObjectUpdateKind.leave ) { propchgary = objup.changeSet; for (int ci = 0; ci < propchgary.Length; ci++) { propchg = propchgary[ci]; UpdateValues(endWaitProps, endVals, propchg); UpdateValues(filterProps, filterVals, propchg); } } } } object expctdval = null; // Check if the expected values have been reached and exit the loop if done. // Also exit the WaitForUpdates loop if this is the case. for (int chgi = 0; chgi < endVals.Length && !reached; chgi++) { for (int vali = 0; vali < expectedVals[chgi].Length && !reached; vali++) { expctdval = expectedVals[chgi][vali]; reached = expctdval.Equals(endVals[chgi]) || reached; } } } // Destroy the filter when we are done. _connection.Service.DestroyPropertyFilter(filterSpecRef); return(filterVals); }