private void LoadData() { var type = fanuc.CurPmcBom.GetType(); foreach (PropertyInfo item in type.GetProperties()) { var attributes = item.GetCustomAttribute <DisplayAttribute>(); if (attributes != null && (attributes.GetAutoGenerateField() ?? true)) { var limit = item.GetValue(fanuc.CurPmcBom) as PmcBomItem; if (limit == null) { continue; } var node = new SystemPmcItemViewModel() { PropertyName = item.Name, Title = attributes.Name, Adr = limit.Adr, Bit = limit.Bit, ConversionFactor = limit.ConversionFactor ?? 0.0, DataType = limit.DataType }; node.OpenDialogEvent += Node_OpenDialogEvent; PmcNodes.Add(node); } } }
private void Node_OpenDialogEvent(SystemPmcItemViewModel arg1, string arg2) { var prop = arg1.GetType().GetProperty(arg2); OpenDialogWindowEvent?.Invoke(arg1, arg2, prop.GetValue(arg1, null)?.ToString()); }