public void UpdateSelNode(ElementProperties elementProperties, string imagePath) { TreeNode selectNode = _treeObjects.SelectedNode; TestObjectNurse TONurse = null; if (selectNode == null) { RaiseUpdateNodePropertyCompleteEvent(ResultType.NoSelectedNode); return; } if (null == (TONurse = selectNode.Tag as TestObjectNurse)) { RaiseUpdateNodePropertyCompleteEvent(ResultType.NoSelectedNode); return; } if (!TONurse.ControlTypeString.Equals(elementProperties.ControlTypeString)) { RaiseUpdateNodePropertyCompleteEvent(ResultType.NotSameControlType); return; } ITestObject TO = TONurse.TestObject; TONurse.CachedProperties.Clear(); TONurse.ImageFile = imagePath; foreach (KeyValuePair <string, string> pair in elementProperties.NoneEmptyProperties) { TONurse.CachedProperties.Add(pair.Key, pair.Value); if (TO.Properties.ContainsKey(pair.Key)) { TO.Properties[pair.Key] = pair.Value; } } //foreach (KeyValuePair<string, string> pair in elementProperties.SelectedProperties) //{ // if (TO.Properties.ContainsKey(pair.Key)) // { // TO.Properties[pair.Key] = pair.Value; // } //} //TODO : temporarily convert to UIATestObject. Should use TestObjectBase or ITestObject directly (TO as UIATestObject).AutomationElement = elementProperties.AutomationElement; (TO as UIATestObject).ControlType = elementProperties.ControlType; (TO as UIATestObject).NodeName = elementProperties.DerivedName; TONurse.RefreshName(); RaiseUpdateNodePropertyCompleteEvent(ResultType.OK); }