private static void AddIndexedPropertyChildNodes(TreeviewBranchViewModel parentNode, object comObj, PropertyInfo propInfo) { ParameterInfo[] parameters = propInfo.GetIndexParameters(); if ((parameters.Length == 1) && (parameters[0].ParameterType == typeof(int))) { bool stop = false; for (int index = 0; !stop; index++) { try { object value = propInfo.GetValue(comObj, new object[] { index }); stop = value == null; if ((value != null) && value.GetType().IsCOMObject) { ComObjectViewModel child = new ComObjectViewModel( parentNode, value, propInfo.PropertyType, string.Format(".{0}[{1:000}]", propInfo.Name, index)); parentNode.Children.Add(child); } } catch (Exception) { stop = true; } } } }
public void CreatePropertyChildNodes(TreeviewBranchViewModel parentNode, object comObj, Type typ) { PropertyInfo[] propertyInfos = typ.GetProperties(BindingFlags.Public | BindingFlags.Instance); foreach (PropertyInfo propInfo in propertyInfos) { try { if (!propInfo.CanRead || !propInfo.PropertyType.IsInterface) { continue; } if (!IsIndexedProperty(propInfo)) { AddPropertyChildNode(parentNode, comObj, propInfo); } else { AddIndexedPropertyChildNodes(parentNode, comObj, propInfo); } } catch (Exception ex) { // do not add to list, continue string error = ex.Message; } } }
private static void AddPropertyChildNode(TreeviewBranchViewModel parentNode, object comObj, PropertyInfo propInfo) { object value = propInfo.GetValue(comObj, null); if ((value != null) && value.GetType().IsCOMObject) { ComObjectViewModel child = new ComObjectViewModel(parentNode, value, propInfo.PropertyType, "." + propInfo.Name); parentNode.Children.Add(child); } }
public void CreatePropertyChildNodes(TreeviewBranchViewModel parentNode, object comObj, Type typ) { IEnumDatasetName enumDatasetName = comObj as IEnumDatasetName; foreach (IDatasetName value in ArcmapUtils.EnumerateDatasetNames(enumDatasetName, false)) { if ((value != null) && (value.GetType().IsCOMObject)) { ComObjectViewModel child = new ComObjectViewModel(parentNode, value, typeof(IDatasetName), ".Next()"); parentNode.Children.Add(child); } } }
public void CreatePropertyChildNodes(TreeviewBranchViewModel parentNode, object comObj, Type typ) { IEnumDataset enumDataset = comObj as IEnumDataset; foreach (IDataset value in enumDataset.Enumerate()) { if ((value != null) && (value.GetType().IsCOMObject)) { ComObjectViewModel child = new ComObjectViewModel(parentNode, value, typeof(IDataset), ".Next()"); parentNode.Children.Add(child); } } }
public void CreatePropertyChildNodes(TreeviewBranchViewModel parentNode, object comObj, Type typ) { IEnumSegment comEnum = comObj as IEnumSegment; foreach (ICurve enumValue in comEnum.Enumerate()) { if ((enumValue != null) && (enumValue.GetType().IsCOMObject)) { ComObjectViewModel child = new ComObjectViewModel(parentNode, enumValue, typeof(ICurve), ".Next()"); parentNode.Children.Add(child); } } }
public void CreatePropertyChildNodes(TreeviewBranchViewModel parentNode, object comObj, Type typ) { IArray arr = comObj as IArray; int index = 0; foreach (object value in arr.Enumerate()) { if ((value != null) && (value.GetType().IsCOMObject)) { ComObjectViewModel child = new ComObjectViewModel(parentNode, value, typeof(object), "[" + index + "]"); parentNode.Children.Add(child); } index++; } }