public static async Task <IEntityValue> CreateUIPropertyValueValueAsync(IEntityRuntimeModel runtimeModel, EntityIdentity id, ProjectConfiguration configuration, ProjectSystem.Properties.IProperty property, IUIPropertyValuePropertiesAvailableStatus requestedProperties) { Requires.NotNull(property, nameof(property)); var newUIPropertyValue = new UIPropertyValueValue(runtimeModel, id, new UIPropertyValuePropertiesAvailableStatus()); if (requestedProperties.UnevaluatedValue) { if (property is IEvaluatedProperty evaluatedProperty) { newUIPropertyValue.UnevaluatedValue = await evaluatedProperty.GetUnevaluatedValueAsync(); } else { newUIPropertyValue.UnevaluatedValue = await property.GetValueAsync() as string; } } if (requestedProperties.EvaluatedValue) { newUIPropertyValue.EvaluatedValue = property switch { IBoolProperty boolProperty => await boolProperty.GetValueAsBoolAsync(), IStringProperty stringProperty => await stringProperty.GetValueAsStringAsync(), IIntProperty intProperty => await intProperty.GetValueAsIntAsync(), IEnumProperty enumProperty => (await enumProperty.GetValueAsIEnumValueAsync())?.Name, IStringListProperty stringListProperty => await stringListProperty.GetValueAsStringCollectionAsync(), _ => await property.GetValueAsync() }; } ((IEntityValueFromProvider)newUIPropertyValue).ProviderState = new PropertyValueProviderState(configuration, property); return(newUIPropertyValue); }
public ChannelProperties(IDDK ddk, IChannel channel) { if (ddk == null) { throw new ArgumentNullException("ddk"); } if (channel == null) { throw new ArgumentNullException("channel"); } ITypeDouble typeDouble = Property.CreateDoubleType(ddk, UnitConversion.PhysUnitEnum.PhysUnit_Hertz, 0.1, 1000, 1); Rate = channel.CreateProperty("Rate", "The data collection rate in " + typeDouble.Unit, typeDouble); Rate.Update(100); typeDouble = Property.CreateDoubleType(ddk, UnitConversion.PhysUnitEnum.PhysUnit_NanoMeter, 200, 400, 1); Wavelength = channel.CreateStandardProperty(StandardPropertyID.Wavelength, typeDouble); AcquisitionTimeOn = Property.CreateString(ddk, channel, "AcquisitionTime_1_On"); AcquisitionTimeOff = Property.CreateString(ddk, channel, "AcquisitionTime_2_Off"); AcquisitionTimeDiff = Property.CreateString(ddk, channel, "AcquisitionTime_3_Diff"); // Make the property available as a report variable. This is stored with the signal as meta data. channel.AddPropertyToChannelInfo(Rate); channel.AddPropertyToChannelInfo(Wavelength); }
internal IDevice Create(IDDK cmDDK, string name) { // Create our IDevice object m_MyCmDevice = cmDDK.CreateDevice(name, "Nelson NCI 900 Master Device"); // Create our properties // ModelNo m_ModelNoProperty = m_MyCmDevice.CreateStandardProperty(StandardPropertyID.ModelNo, cmDDK.CreateString(20)); // DebugCommand ITypeString tString = cmDDK.CreateString(255); m_DebugCommand = m_MyCmDevice.CreateProperty("DebugCommand", "For internal use only.", tString); m_DebugCommand.AuditLevel = AuditLevel.Message; m_DebugCommand.OnSetProperty += new SetPropertyEventHandler(OnDebugCommand); ITypeDouble tDouble = cmDDK.CreateDouble(0, 100, 1); tDouble.Unit = "%"; IProperty dblProp = m_MyCmDevice.CreateProperty("DoubleProp", "DoubleHelp", tDouble); return(m_MyCmDevice); }
// Token: 0x06000F94 RID: 3988 RVA: 0x000590D4 File Offset: 0x000572D4 protected override void InternalCopyFrom(IProperty srcProperty) { IStringProperty stringProperty = srcProperty as IStringProperty; if (stringProperty == null) { throw new UnexpectedTypeException("IStringProperty", srcProperty, base.AirSyncTagNames[0]); } string text = stringProperty.StringData; bool flag = string.Equals(base.AirSyncTagNames[0], "Location"); if (PropertyState.Modified == srcProperty.State) { if (string.IsNullOrEmpty(text) && !flag) { AirSyncDiagnostics.TraceInfo <string>(ExTraceGlobals.AirSyncTracer, this, "Node={0} String data is null or empty.", base.AirSyncTagNames[0]); this.InternalSetToDefault(srcProperty); return; } if (text.Length > 32000) { text = text.Substring(0, 32000); } base.CreateAirSyncNode(text, flag); } }
// Token: 0x0600138C RID: 5004 RVA: 0x00070908 File Offset: 0x0006EB08 public override void CopyFrom(IProperty srcProperty) { IStringProperty stringProperty = srcProperty as IStringProperty; if (stringProperty == null) { throw new UnexpectedTypeException("IStringProperty", srcProperty); } if (this.entry == null) { throw new ConversionException("Haven't been bound to an item yet! Element is: " + this.element); } switch (this.element) { case RecipientInfoCacheEntryElements.EmailAddress: throw new NotImplementedException("Can't change the email address!"); case RecipientInfoCacheEntryElements.DisplayName: this.entry.DisplayName = stringProperty.StringData; return; case RecipientInfoCacheEntryElements.Alias: this.entry.Alias = stringProperty.StringData; return; default: return; } }
/// Create our Dionex.Chromeleon.Symbols.IDevice and our Properties and Commands internal IDevice Create(IDDK cmDDK, string name) { // Create our Dionex.Chromeleon.Symbols.IDevice m_MyCmDevice = cmDDK.CreateDevice(name, "This is a preflight test device."); // create the standard Property containing our model number m_ModelNoProperty = m_MyCmDevice.CreateStandardProperty(StandardPropertyID.ModelNo, cmDDK.CreateString(20)); m_someProperty = m_MyCmDevice.CreateBooleanProperty("Test", "Use this property to watch all preflight events.", "Off", "On"); m_someProperty.OnPreflightSetProperty += new SetPropertyEventHandler(OnPfTest); m_someProperty.OnSetProperty += new SetPropertyEventHandler(OnTest); m_MyCmDevice.OnPreflightBegin += new PreflightEventHandler(OnPfBegin); m_MyCmDevice.OnPreflightEnd += new PreflightEventHandler(OnPfEnd); m_MyCmDevice.OnPreflightLatch += new PreflightEventHandler(OnPfLatch); m_MyCmDevice.OnPreflightSync += new PreflightEventHandler(OnPfSync); m_MyCmDevice.OnPreflightBroadcast += new BroadcastEventHandler(OnPfBroadcast); m_MyCmDevice.OnTransferPreflightToRun += new PreflightEventHandler(OnTransferPfToRun); ICommand command = m_MyCmDevice.CreateCommand("DoAbort", "This command sends an abort error."); command.OnCommand += new CommandEventHandler(OnDoAbort); command = m_MyCmDevice.CreateCommand("DoError", "This command sends an error."); command.OnCommand += new CommandEventHandler(OnDoError); return(m_MyCmDevice); }
public static object RetrieveGameStateParameter(IGameState state, string parameter_path, params object[] input_values) { try { string[] parameters = parameter_path.Split('/'); object val = null; IStringProperty property_object = state as IStringProperty; int index_pos = 0; for (int x = 0; x < parameters.Count(); x++) { if (property_object == null) { return(val); } string param = parameters[x]; //Following needs validation //If next param is placeholder then take the appropriate input value from the input_values array val = property_object.GetValueFromString(param); if (val == null) { throw new ArgumentNullException($"Failed to get value {parameter_path}, failed at '{param}'"); } Type property_type = property_object.GetType(); Type temp = null; if (x < parameters.Length - 1 && (property_type.IsArray || property_type.GetInterfaces().Any(t => { return(t == typeof(IEnumerable) || t == typeof(IList) || (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(IEnumerable <>) && (temp = t.GenericTypeArguments[0]) != null)); })) && int.TryParse(parameters[x + 1], out index_pos)) { x++; Type child_type = temp ?? property_type.GetElementType(); IEnumerable <object> array = (IEnumerable <object>)property_object; if (array.Count() > index_pos) { val = array.ElementAt(index_pos); } else { val = Activator.CreateInstance(child_type); } } property_object = val as IStringProperty; } return(val); } catch (Exception exc) { Global.logger.Error($"Exception: {exc}"); return(null); } }
/// <summary> /// Create our Dionex.Chromeleon.Symbols.IDevice and our Properties and Commands /// </summary> /// <param name="cmDDK">The DDK instance</param> /// <param name="name">The name for our device</param> /// <returns>our IDevice object</returns> internal IDevice Create(IDDK cmDDK, string name) { m_MyCmDDK = cmDDK; // Create our Dionex.Chromeleon.Symbols.IDevice m_MyCmDevice = cmDDK.CreateDevice(name, "Autosampler device."); ITypeDouble tVolume = cmDDK.CreateDouble(0.1, 10.0, 1); tVolume.Unit = "µL"; ITypeInt tPosition = cmDDK.CreateInt(1, 10); for (int i = 1; i <= 10; i++) { tPosition.AddNamedValue("RA" + i.ToString(), i); } tPosition.NamedValuesOnly = false; m_InjectHandler = m_MyCmDevice.CreateInjectHandler(tVolume, tPosition); m_InjectHandler.PositionProperty.OnSetProperty += new SetPropertyEventHandler(OnSetPosition); m_InjectHandler.VolumeProperty.OnSetProperty += new SetPropertyEventHandler(OnSetVolume); m_InjectHandler.InjectCommand.OnCommand += new CommandEventHandler(OnInject); ICommand simulateVialNotFoundCommand = m_MyCmDevice.CreateCommand("SimulateVialNotFound", "Simulate a vial not found error"); simulateVialNotFoundCommand.OnCommand += new CommandEventHandler(simulateVialNotFoundCommand_OnCommand); ICommand modifyPositionTypeCommand = m_MyCmDevice.CreateCommand("ModifyPositionType", "Changes the data type of the Position property and the Inject.Position parameter"); modifyPositionTypeCommand.OnCommand += new CommandEventHandler(modifyPositionTypeCommand_OnCommand); ICommand modifyVolumeTypeCommand = m_MyCmDevice.CreateCommand("ModifyVolumeType", "Changes the data type of the Volume property and the Inject.Volume parameter"); modifyVolumeTypeCommand.OnCommand += new CommandEventHandler(modifyVolumeTypeCommand_OnCommand); ITypeString tTrayDescription = cmDDK.CreateString(500); // ensure length is sufficient, but don't be too generous m_TrayDesciptionProperty = m_MyCmDevice.CreateStandardProperty(StandardPropertyID.TrayDescription, tTrayDescription); m_TrayDesciptionProperty.AuditLevel = AuditLevel.Service; m_TrayDesciptionProperty.Update(GenerateTrayDescription()); // In this example driver, simulating the injection process // is handled by a timer started by the Inject command. // When the timer has elapsed the inject response is generated. m_InjectionTimer.Elapsed += new System.Timers.ElapsedEventHandler(m_InjectionTimer_Elapsed); m_InjectionTimer.AutoReset = false; return(m_MyCmDevice); }
internal void Create(IDDK cmDDK, string deviceName) { m_DDK = cmDDK; m_Device = m_DDK.CreateDevice(deviceName, "Pump device"); IStringProperty typeProperty = m_Device.CreateProperty("DeviceType", "The DeviceType property tells us which component we are talking to.", m_DDK.CreateString(20)); typeProperty.Update("Pump"); // A data type for our pump flow ITypeDouble tFlow = m_DDK.CreateDouble(0, 10, 1); tFlow.Unit = "ml/min"; // Create our flow handler. The flow handler creates a Flow.Nominal, // a Flow.Value and 4 eluent component properties for us. m_FlowHandler = m_Device.CreateFlowHandler(tFlow, 4, 2); m_FlowHandler.FlowNominalProperty.OnSetProperty += OnSetFlow; // initialize the flow m_FlowHandler.FlowNominalProperty.Update(0); // initialize the components m_FlowHandler.ComponentProperties[0].Update(100.0); m_FlowHandler.ComponentProperties[1].Update(0); m_FlowHandler.ComponentProperties[2].Update(0); m_FlowHandler.ComponentProperties[3].Update(0); // A type for our pump pressure ITypeDouble tPressure = m_DDK.CreateDouble(0, 400, 1); tPressure.Unit = "bar"; // We create a struct for the pressure with Value, LowerLimit and UpperLimit m_PressureStruct = m_Device.CreateStruct("Pressure", "The pump pressure."); m_PressureValue = m_PressureStruct.CreateStandardProperty(StandardPropertyID.Value, tPressure); m_PressureLowerLimit = m_PressureStruct.CreateStandardProperty(StandardPropertyID.LowerLimit, tPressure); m_PressureLowerLimit.OnSetProperty += new SetPropertyEventHandler(OnSetPressureLowerLimit); m_PressureLowerLimit.Update(0.0); m_PressureUpperLimit = m_PressureStruct.CreateStandardProperty(StandardPropertyID.UpperLimit, tPressure); m_PressureUpperLimit.OnSetProperty += new SetPropertyEventHandler(OnSetPressureUpperLimit); m_PressureUpperLimit.Update(400.0); m_PressureStruct.DefaultGetProperty = m_PressureValue; m_Device.OnTransferPreflightToRun += new PreflightEventHandler(OnTransferPreflightToRun); }
public static void PropertyChanged(string callerId, IStringProperty property, string callerMethodName = null) { if (callerMethodName == null) { callerMethodName = CallerMethodName; } string displayValue = property.Value == null ? "Null" : "\"" + property.Value + "\""; WriteLinePropertyChanged(callerId, property.Name, displayValue, callerMethodName); }
public static IStringProperty GetString(IPage page, string name) { IProperty property = GetProperty(page, name); IStringProperty result = property as IStringProperty; if (result == null) { throw new InvalidOperationException("Property " + property.Name + " type " + property.GetType().FullName + " is not the expected " + typeof(IStringProperty).FullName); } return(result); }
internal void Create(IDDK cmDDK, string deviceName) { m_DDK = cmDDK; m_Device = m_DDK.CreateDevice(deviceName, "LCSystem device. This is our master device."); IStringProperty typeProperty = m_Device.CreateProperty("DeviceType", "The DeviceType property tells us which component we are talking to.", m_DDK.CreateString(20)); typeProperty.Update("LCSystem"); }
/// Create our Dionex.Chromeleon.Symbols.IDevice and our Property internal IDevice Create(IDDK cmDDK, string name) { // Create our Dionex.Chromeleon.Symbols.IDevice m_MyCmDevice = cmDDK.CreateDevice(name, "SendReceive DDK Example."); // Create the standard Property containing our model number // There are standard properties with a special meaning for CM and a simplified // syntax. For details, see the documentation. m_ModelNoProperty = m_MyCmDevice.CreateStandardProperty(StandardPropertyID.ModelNo, cmDDK.CreateString(20)); return(m_MyCmDevice); }
public override void CopyFrom(IProperty srcProperty) { if (base.EntityPropertyDefinition.Setter == null) { throw new ConversionException("Unable to set data of type " + base.EntityPropertyDefinition.Type.FullName); } IStringProperty stringProperty = srcProperty as IStringProperty; if (stringProperty != null) { base.EntityPropertyDefinition.Setter(base.Item, stringProperty.StringData); } }
private ClientSetting SettingToClientSetting(SettingElement setting) { IStringProperty property = SettingToProperty(setting); if (property == null) { Debug.Fail("Shouldn't be converting a null element to a ClientSetting."); return(null); } else { return(new ClientSetting(property.Name, property.Value, SettingsLocation)); } }
public DemoProperties(IDriverEx driver, IDDK ddk, Config.Demo config, IDevice device) { if (ddk == null) { throw new ArgumentNullException("ddk"); } if (config == null) { throw new ArgumentNullException("config"); } if (device == null) { throw new ArgumentNullException("device"); } LogInFile = Property.CreateBool(ddk, device, "LogInFile"); LogInFile.Writeable = true; LogInFile.AuditLevel = AuditLevel.Service; LogInFile.Update(Property.GetBoolNumber(true)); // Can be configurable = config.LogInFile m_IsSimulated = Property.CreateBool(ddk, device, "IsSimulated"); m_IsSimulated.Update(Property.GetBoolNumber(driver.IsSimulated)); if (driver.IsSimulated != config.IsSimulated) { Device.DebuggerBreak(); } FirmwareUsbAddress = Property.CreateString(ddk, device, "FirmwareUsbAddress"); FirmwareUsbAddress.Update(driver.FirmwareUsbAddress); FirmwareVersion = Property.CreateString(ddk, device, "FirmwareVersion"); FirmwareVersion.Update(driver.FirmwareVersion); SerialNo = device.CreateStandardProperty(StandardPropertyID.SerialNo, ddk.CreateString(100)); SerialNo.Update(driver.SerialNo); TaskName = Property.CreateString(ddk, device, "TaskName", driver.TaskName); TaskNamePrevious = Property.CreateString(ddk, device, "TaskNamePrevious", driver.TaskNamePrevious); TaskPreviousErrorText = Property.CreateString(ddk, device, "TaskPreviousErrorText", driver.TaskPreviousErrorText); CommunicationState = Property.CreateEnum(ddk, device, "CommunicationState", driver.CommunicationState, null); BehaviorStatePrev = Property.CreateEnum(ddk, device, "BehaviorStatePrev", driver.BehaviorStatePrev); BehaviorState = Property.CreateEnum(ddk, device, "BehaviorState", driver.BehaviorState); ProcessStep = Property.CreateInt(ddk, device, "ProcessStep"); ProcessStep.Update(0); }
public DeviceProperties(IDDK ddk, IDevice device, string deviceId, string deviceType, string deviceName) { if (ddk == null) { throw new ArgumentNullException("ddk"); } if (device == null) { throw new ArgumentNullException("device"); } if (string.IsNullOrEmpty(deviceType)) { throw new ArgumentNullException("deviceType"); } if (string.IsNullOrEmpty(deviceName)) { throw new ArgumentNullException("deviceName"); } if (deviceName.Length != deviceName.Trim().Length) { throw new ArgumentException("Device Name is invalid - it starts or ends with space"); } // ModelNo is used to identify the device in the instrument method editor plug-in Debug.Assert(StandardPropertyID.ModelNo.ToString() == Property.ConstantName.ModelNo); IStringProperty stringProperty = device.CreateStandardProperty(StandardPropertyID.ModelNo, ddk.CreateString(100)); stringProperty.Update(deviceType); stringProperty = Property.CreateString(ddk, device, Property.ConstantName.InternalName); stringProperty.Update(deviceId); stringProperty.AuditLevel = AuditLevel.Expert; stringProperty = Property.CreateString(ddk, device, Property.ConstantName.DeviceType); stringProperty.Update(deviceType); stringProperty = Property.CreateString(ddk, device, "DeviceName"); stringProperty.Update(deviceName); Description = Property.CreateString(ddk, device, "DeviceDescription"); Description.Update("Description for " + deviceId); // Description.Writeable = true; - not needed, because of m_Properties.DeviceDesription.OnSetProperty += OnPropertyDeviceDesriptionSet; Language = Property.CreateString(ddk, device, "DeviceLanguage"); Language.Update("Language for " + deviceId); }
/// <summary> /// Create our Dionex.Chromeleon.Symbols.IDevice and our Properties and Commands /// </summary> /// <param name="cmDDK">The DDK instance</param> /// <param name="name">The name for our device</param> /// <returns>our IDevice object</returns> internal IDevice Create(IDDK cmDDK, string name) { // Load the help text from the resource string deviceHelpText = Properties.Resources.LocalizedDevice_HelpText; // Create our Dionex.Chromeleon.Symbols.IDevice m_MyCmDevice = cmDDK.CreateDevice(name, deviceHelpText); // Load the help text from the resource string statusPropertyText = Properties.Resources.StatusProperty_HelpText; // create a test Property containing a string m_statusProperty = m_MyCmDevice.CreateProperty("Status", statusPropertyText, cmDDK.CreateString(20)); m_statusProperty.Update("Disconnected."); return(m_MyCmDevice); }
protected override void InternalCopyFromModified(IProperty srcProperty) { MessageItem messageItem = (MessageItem)base.XsoItem; messageItem.ReplyTo.Clear(); IStringProperty stringProperty = (IStringProperty)srcProperty; string stringData = stringProperty.StringData; char[] separator = new char[] { ',', ';' }; foreach (string text in stringData.Split(separator)) { if (!string.IsNullOrEmpty(text)) { messageItem.ReplyTo.Add(EmailAddressConverter.CreateParticipant(text)); } } }
// Token: 0x0600152B RID: 5419 RVA: 0x0007BF24 File Offset: 0x0007A124 protected override void InternalCopyFromModified(IProperty srcProperty) { IStringProperty stringProperty = (IStringProperty)srcProperty; byte[] array = base.XsoItem.TryGetProperty(base.PropertyDef) as byte[]; if (array == null) { array = new GlobalObjectId(stringProperty.StringData).Bytes; base.XsoItem[CalendarItemBaseSchema.GlobalObjectId] = array; base.XsoItem[CalendarItemBaseSchema.CleanGlobalObjectId] = array; return; } GlobalObjectId globalObjectId = new GlobalObjectId(array); if (globalObjectId.Uid != stringProperty.StringData) { AirSyncDiagnostics.TraceDebug <string, string>(ExTraceGlobals.XsoTracer, this, "Client overwrote Uid from {0} to {1}", globalObjectId.Uid, stringProperty.StringData); } array = new GlobalObjectId(stringProperty.StringData).Bytes; base.XsoItem[CalendarItemBaseSchema.GlobalObjectId] = array; base.XsoItem[CalendarItemBaseSchema.CleanGlobalObjectId] = array; }
public override void Visit(IStringProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute) { base.Visit(type, propertyInfo, attribute); var wsaf = propertyInfo.GetCustomAttribute <WantsStandardAnalysisField>(); if (wsaf != null) { type.Index = FieldIndexOption.NotAnalyzed; type.Fields = new Properties { { "standard", new StringProperty { Index = FieldIndexOption.Analyzed, Analyzer = "standard" } } }; } }
internal void Create(IDDK cmDDK, string deviceName) { m_DDK = cmDDK; m_Device = m_DDK.CreateDevice(deviceName, "Sampler device"); IStringProperty typeProperty = m_Device.CreateProperty("DeviceType", "The DeviceType property tells us which component we are talking to.", m_DDK.CreateString(20)); typeProperty.Update("Sampler"); ITypeDouble tVolume = m_DDK.CreateDouble(0.1, 10.0, 1); ITypeInt tPosition = m_DDK.CreateInt(1, 10); m_InjectHandler = m_Device.CreateInjectHandler(tVolume, tPosition); m_InjectHandler.PositionProperty.OnSetProperty += new SetPropertyEventHandler(OnSetPosition); m_InjectHandler.VolumeProperty.OnSetProperty += new SetPropertyEventHandler(OnSetVolume); m_InjectHandler.InjectCommand.OnCommand += new CommandEventHandler(OnInject); //Create ready property ITypeInt tReady = m_DDK.CreateInt(0, 1); //Add named values tReady.AddNamedValue("NotReady", 0); tReady.AddNamedValue("Ready", 1); m_ReadyProperty = m_Device.CreateStandardProperty(StandardPropertyID.Ready, tReady); m_ReadyProperty.Update(1); m_Device.OnBroadcast += new BroadcastEventHandler(OnBroadcast); }
/// <summary> /// Create our Dionex.Chromeleon.Symbols.IDevice and our Properties and Commands /// </summary> /// <param name="cmDDK">The DDK instance</param> /// <param name="name">The name for our device</param> /// <returns>our IDevice object</returns> internal IDevice Create(IDDK cmDDK, string name) { // Create our Dionex.Chromeleon.Symbols.IDevice m_MyCmDevice = cmDDK.CreateDevice(name, "This is my first DDK device."); m_MyStringProperty = m_MyCmDevice.CreateProperty("MyStringProperty", "A string property", cmDDK.CreateString(5)); m_MyStringProperty.OnSetProperty += new SetPropertyEventHandler(m_MyStringProperty_OnSetProperty); m_MyStringProperty.OnPreflightSetProperty += m_MyStringProperty_OnPreflightSetProperty; // Create a Property of type double. m_MyDoubleProperty = m_MyCmDevice.CreateProperty("MyDoubleProperty", "This is my first property", cmDDK.CreateDouble(0, 20, 2)); // Set the property to writable. m_MyDoubleProperty.Writeable = true; // And provide a handler that gets called when the property is assigned. m_MyDoubleProperty.OnSetProperty += new SetPropertyEventHandler(m_MyDoubleProperty_OnSetProperty); // Update all properties that have to be readable before the device is connected. m_MyDoubleProperty.Update(20.0); // Create a Property of type int. m_MyIntProperty = m_MyCmDevice.CreateProperty("MyIntProperty", "This is my second property", cmDDK.CreateInt(-1, 2)); // Set the property to read-only. m_MyIntProperty.Writeable = false; // No value known until the device is connected. m_MyIntProperty.Update(null); CreateMoreProperties(cmDDK); return(m_MyCmDevice); }
internal void Create(IDDK cmDDK, string deviceName) { m_DDK = cmDDK; ITypeInt tSignal = m_DDK.CreateInt(0, 1000); tSignal.Unit = "mAU"; m_Channel = m_DDK.CreateChannel(deviceName, "Detector device", tSignal); IStringProperty typeProperty = m_Channel.CreateProperty("DeviceType", "The DeviceType property tells us which component we are talking to.", m_DDK.CreateString(20)); typeProperty.Update("Detector"); m_Channel.AcquisitionOffCommand.OnCommand += new CommandEventHandler(OnAcqOff); m_Channel.AcquisitionOnCommand.OnCommand += new CommandEventHandler(OnAcqOn); ITypeDouble tWavelength = m_DDK.CreateDouble(200, 400, 1); tWavelength.Unit = "nm"; m_WavelengthProperty = m_Channel.CreateStandardProperty(StandardPropertyID.Wavelength, tWavelength); m_WavelengthProperty.OnSetProperty += new SetPropertyEventHandler(OnSetWaveLength); // We want to have the wavelength available as a report variable and therefore add it to the channel info. m_Channel.AddPropertyToChannelInfo(m_WavelengthProperty); m_WavelengthProperty.Update(m_WaveLength); // What do we actually measure? m_Channel.PhysicalQuantity = "Absorbance"; m_Timer.Elapsed += new ElapsedEventHandler(OnTimedEvent); }
public static void BuildProperty(IStringProperty property, TypeBuilder type, PropertyBuilder propertyBuilder, Dictionary <IBusinessObjectBase, TypeBuilder> definedTypes) { var p = propertyBuilder; if (property.RowCount.HasValue) { p.ModelDefault("RowCount", property.RowCount.Value.ToString()); } if (property.Size != 0) { p.ModelDefault("Size", property.Size.ToString()); } if (property.IsPassword.HasValue) { p.ModelDefault("IsPassword", property.IsPassword.Value.ToString()); } if (!string.IsNullOrEmpty(property.PredefinedValues)) { p.ModelDefault("PredefinedValues", property.PredefinedValues); } }
#pragma warning disable 618 public virtual void Visit(IStringProperty property) { }
public AutoSampler(IDriverEx driver, IDDK ddk, Config.AutoSampler config, string id) : base(driver, ddk, typeof(AutoSampler).Name, id, config.Name) { Log.TaskBegin(Id); try { m_Properties = new AutoSamplerProperties(m_DDK, m_Device); ITypeDouble volumeType = m_DDK.CreateDouble(0.1, 30, 3); volumeType.Unit = UnitConversionEx.PhysUnitName(UnitConversion.PhysUnitEnum.PhysUnit_MicroLiter); // µl int positionMax = m_RackInfos.Sum(item => item.TubeColumnsCount * item.TubeRowsCount); ITypeInt positionType = m_DDK.CreateInt(1, positionMax); positionType.NamedValuesOnly = false; int position = positionType.Minimum.GetValueOrDefault() - 1; foreach (RackInfo rack in m_RackInfos) { int tubeNumber = rack.TubeFirstNumber - 1; for (int row = 1; row <= rack.TubeRowsCount; row++) { for (int col = 1; col <= rack.TubeColumnsCount; col++) { position++; tubeNumber++; string positionName = rack.TubePositionNamePrefix + tubeNumber.ToString(); positionType.AddNamedValue(positionName, tubeNumber); } } } m_InjectHandler = m_Device.CreateInjectHandler(volumeType, positionType); m_RackDesciptionProperty = m_Device.CreateStandardProperty(StandardPropertyID.TrayDescription, m_DDK.CreateString(1000)); m_RackDesciptionProperty.AuditLevel = AuditLevel.Service; string rackDescription = GetRackDescription(); if (m_RackDesciptionProperty.DataType.Length < rackDescription.Length) { throw new InvalidOperationException("m_RackDesciptionProperty length " + m_RackDesciptionProperty.DataType.Length + " is less than the needed " + rackDescription.Length.ToString()); } m_RackDesciptionProperty.Update(rackDescription); m_Position = -1; m_VolumeUnitName = m_InjectHandler.VolumeProperty.DataType.Unit; // µl m_VolumeUnit = UnitConversionEx.PhysUnitFindName(m_VolumeUnitName); m_InjectHandler.PositionProperty.OnSetProperty += OnPropertyPositionSet; m_InjectHandler.VolumeProperty.OnSetProperty += OnPropertyVolumeSet; m_InjectHandler.InjectCommand.OnCommand += OnCommandInjectHandlerInject; m_Device.OnBatchPreflightBegin += OnDeviceBatchPreflightBegin; m_Device.OnPreflightEnd += OnDevicePreflightEnd; m_Device.OnTransferPreflightToRun += OnDeviceTransferPreflightToRun; m_Device.OnSequenceStart += OnDeviceSequenceStart; m_Device.OnSequenceChange += OnDeviceSequenceChange; m_Device.OnSequenceEnd += OnDeviceSequenceEnd; m_Device.OnBroadcast += OnDeviceBroadcast; m_Driver.OnConnected += OnDriverConnected; m_Driver.OnDisconnected += OnDriverDisconnected; Log.TaskEnd(Id); } catch (Exception ex) { Log.TaskEnd(Id, ex); throw; } }
#pragma warning disable 618 public virtual void Visit(IStringProperty property ) { }
public HeaterProperties(IDDK ddk, Config.Heater config, IDevice device) { if (ddk == null) { throw new ArgumentNullException("ddk"); } if (config == null) { throw new ArgumentNullException("config"); } if (device == null) { throw new ArgumentNullException("device"); } Ready = Property.CreateReady(ddk, device); m_Product = device.CreateStruct("Product", "Product Help Text"); m_ProductName = Property.CreateString(ddk, m_Product, "Name"); m_ProductName.Writeable = true; m_ProductName.Update("Product Name"); m_ProductDescription = Property.CreateString(ddk, m_Product, "Description"); m_ProductDescription.Update(config.ProductDescription); // Set the default read and write properties for the structure - optional m_Product.DefaultGetProperty = m_ProductName; m_Product.DefaultSetProperty = m_ProductName; Power = Property.CreateDouble(ddk, device, "Power", UnitConversion.PhysUnitEnum.PhysUnit_Watt, null, 0); // the unit W is localized // Temperature.Control - On/Off // Temperature.LowerLimit // Temperature.UpperLimit // Temperature.Nominal // Temperature.Value m_Temperature = device.CreateStruct("Temperature", "Heater Temperature"); TemperatureControl = Property.CreateEnum(ddk, m_Temperature, "Control", Heater.TemperatureControl.Off); TemperatureControl.Writeable = true; string temperatureUnit = UnitConversionEx.PhysUnitName(UnitConversion.PhysUnitEnum.PhysUnit_Celsius); // °C - localized const int temperaturePrecision = 1; ITypeDouble temperatureType = ddk.CreateDouble(0, 100, temperaturePrecision); temperatureType.Unit = temperatureUnit; TemperatureMin = m_Temperature.CreateStandardProperty(StandardPropertyID.LowerLimit, temperatureType); TemperatureMin.Writeable = true; TemperatureMin.Update(20); TemperatureMax = m_Temperature.CreateStandardProperty(StandardPropertyID.UpperLimit, temperatureType); TemperatureMax.Writeable = true; TemperatureMax.Update(80); TemperatureNominal = m_Temperature.CreateStandardProperty(StandardPropertyID.Nominal, temperatureType); // Desired (requested) temperature TemperatureNominal.Writeable = true; TemperatureNominal.Update(50); temperatureType = ddk.CreateDouble(double.MinValue, double.MaxValue, temperaturePrecision); temperatureType.Unit = temperatureUnit; TemperatureValue = m_Temperature.CreateStandardProperty(StandardPropertyID.Value, temperatureType); TemperatureValue.Update(40); // Set the default read and write properties for the structure m_Temperature.DefaultGetProperty = TemperatureValue; m_Temperature.DefaultSetProperty = TemperatureNominal; }
public virtual void Visit(IStringProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttribute attribute) { }
#pragma warning disable 618 public virtual void Visit(IStringProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute) { }
#pragma warning disable 618 public void Visit(IStringProperty mapping) { Increment("string"); }