Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PrototypeBackend.MeasurementCombination"/> class.
        /// </summary>
        /// <param name="info">Info.</param>
        /// <param name="context">Context.</param>
        public MeasurementCombination(SerializationInfo info, StreamingContext context)
        {
            Pins = new List<APin> ();
            Pins = (List<APin>)info.GetValue ("Pins", Pins.GetType ());

            Name = info.GetString ("Name");
            Unit = info.GetString ("Unit");
            Color = new Gdk.Color (info.GetByte ("RED"), info.GetByte ("GREEN"), info.GetByte ("BLUE"));
            MeanValuesCount = info.GetInt32 ("Interval");

            OperationString = info.GetString ("OperationString");
            if (!string.IsNullOrEmpty (OperationString) && Pins.Count > 0 && Pins.All (o => o != null))
            {
                try
                {
                    Operation = OperationCompiler.CompileOperation (OperationString, Pins.Select (o => o.DisplayNumberShort).ToArray<string> ());
                } catch (Exception e)
                {
                    throw e;
                }
            }

            Values = new List<DateTimeValue> ();
        }