Exemplo n.º 1
0
        public Sensor(string name, int index, bool defaultHidden,
            SensorType sensorType, Hardware hardware,
            ParameterDescription[] parameterDescriptions, ISettings settings)
        {
            this.index = index;
            this.defaultHidden = defaultHidden;
            this.sensorType = sensorType;
            this.hardware = hardware;
            Parameter[] parameters = new Parameter[parameterDescriptions == null ?
              0 : parameterDescriptions.Length];
            for (int i = 0; i < parameters.Length; i++)
                parameters[i] = new Parameter(parameterDescriptions[i], this, settings);
            this.parameters = parameters;

            this.settings = settings;
            this.defaultName = name;
            this.name = settings.GetValue(
              new Identifier(Identifier, "name").ToString(), name);

            GetSensorValuesFromSettings();

            hardware.Closing += delegate (IHardware h)
            {
                SetSensorValuesToSettings();
            };
        }
Exemplo n.º 2
0
 public Sensor(string name, int index, SensorType sensorType,
     Hardware hardware, ParameterDescription[] parameterDescriptions,
     ISettings settings)
     : this(name, index, false, sensorType, hardware,
     parameterDescriptions, settings)
 {
 }
Exemplo n.º 3
0
 public Parameter(ParameterDescription description, ISensor sensor, 
     ISettings settings)
 {
     this.sensor = sensor;
       this.description = description;
       this.settings = settings;
       this.isDefault = !settings.Contains(Identifier.ToString());
       this.value = description.DefaultValue;
       if (!this.isDefault) {
     if (!float.TryParse(settings.GetValue(Identifier.ToString(), "0"),
       NumberStyles.Float,
       CultureInfo.InvariantCulture,
       out this.value))
       this.value = description.DefaultValue;
       }
 }