Ejemplo n.º 1
0
        public DeviceValue(DeviceValueStatus status)
        {
            if (status == DeviceValueStatus.Obtained)
            {
                throw new ArgumentException($"Необходимо установить значения при выбранном статусе");
            }

            Status = status;
            Value  = default(T);
        }
        public static StoredDeviceValueStatusV1 ToStored(this DeviceValueStatus status)
        {
            switch (status)
            {
            case DeviceValueStatus.Unknown:
                return(StoredDeviceValueStatusV1.Unknown);

            case DeviceValueStatus.NotObtained:
                return(StoredDeviceValueStatusV1.NotObtained);

            case DeviceValueStatus.Obtained:
                return(StoredDeviceValueStatusV1.Obtained);

            case DeviceValueStatus.ErrorOccured:
                return(StoredDeviceValueStatusV1.ErrorOccured);

            default:
                throw new ArgumentOutOfRangeException(nameof(status), status, null);
            }
        }
Ejemplo n.º 3
0
 public DeviceValue(T value, DeviceValueStatus status)
 {
     Value  = value;
     Status = status;
 }