public ModelElement ConstructElement(string name, ArgMap parameters, AceModelRestricted model) { ModelElement element = null; Dictionary <string, string> rawProperties = ApiDataRepresentation.ArgMapToPropertyDictionary(parameters); string id = rawProperties[Ace2ApiConstants.PersistentId_Parameter]; if (name.StartsWith(Consts.SAMPLE_INSTRUMENT) || name.Contains("::")) { element = ConstructDevice(id, rawProperties); } else { element = ConstructInterface(id, rawProperties); } if (element != null && element.Parent == null && element.ParentId.Length > 0) { element.Parent = model.FindElementById(element.ParentId); } return(element); }
private ArgMap GetElementRepresentation(ModelElement element) { var argmap = new ArgMap(); if (element != null) { Dictionary <string, string> properties = null; if (element is ModelDeviceSample) { var device = element as ModelDevice; var deviceData = CreateDeviceRepresentation(device); properties = deviceData.Properties; } else if (element is ModelInterfaceSample) { var intfc = element as ModelInterface; var intfcData = CreateInterfaceRepresentation(intfc); properties = intfcData.Properties; } argmap = ApiDataRepresentation.PropertyDictionaryToArgMap(properties); } return(argmap); }