private void SetPropertyValues(PropertyValue pv, IEnumerable <string> values) { pv.Clear(); foreach (var v in values) { pv.Add(v); } }
protected override void InitIso() { lock (Locker) { NormalIsoNumber = new PropertyValue <long>(); NormalIsoNumber.Name = "IsoNumber"; NormalIsoNumber.SubType = typeof(int); NormalIsoNumber.ValueChanged += IsoNumber_ValueChanged; NormalIsoNumber.Clear(); try { DeviceReady(); MTPDataResponse result = ExecuteReadDataEx(CONST_CMD_GetDevicePropDesc, CONST_PROP_ExposureIndex); //IsoNumber.IsEnabled = result.Data[4] == 1; //From the D600 documentation this is a uint16 not uint32. //Oddly the MovieExposureIndex DOES use uint32 UInt16 defval = BitConverter.ToUInt16(result.Data, 7); for (int i = 0; i < result.Data.Length - 12; i += 2) { UInt16 val = BitConverter.ToUInt16(result.Data, 12 + i); NormalIsoNumber.AddValues(_isoTable.ContainsKey(val) ? _isoTable[val] : val.ToString(), val); } NormalIsoNumber.ReloadValues(); NormalIsoNumber.SetValue(defval, false); IsoNumber = NormalIsoNumber; } catch (Exception) { NormalIsoNumber.IsEnabled = false; } MovieIsoNumber = new PropertyValue <long>(); MovieIsoNumber.Name = "IsoNumber"; MovieIsoNumber.SubType = typeof(int); MovieIsoNumber.ValueChanged += MovieIsoNumber_ValueChanged; MovieIsoNumber.Clear(); try { MTPDataResponse result = ExecuteReadDataEx(CONST_CMD_GetDevicePropDesc, CONST_PROP_MovieExposureIndex); //IsoNumber.IsEnabled = result.Data[4] == 1; //Uses uint32 but exposureIndex use uint16 UInt32 defval = BitConverter.ToUInt32(result.Data, 9); for (int i = 0; i < result.Data.Length - 16; i += 4) { UInt32 val = BitConverter.ToUInt32(result.Data, 16 + i); MovieIsoNumber.AddValues(_isoTable.ContainsKey(val) ? _isoTable[val] : val.ToString(CultureInfo.InvariantCulture), val); } MovieIsoNumber.ReloadValues(); MovieIsoNumber.SetValue(defval, false); } catch (Exception) { MovieIsoNumber.IsEnabled = false; } } }
private void InitIso() { lock (Locker) { NormalIsoNumber = new PropertyValue<int>(); NormalIsoNumber.Name = "IsoNumber"; NormalIsoNumber.ValueChanged += IsoNumber_ValueChanged; NormalIsoNumber.Clear(); try { DeviceReady(); MTPDataResponse result = ExecuteReadDataEx(CONST_CMD_GetDevicePropDesc, CONST_PROP_ExposureIndex); //IsoNumber.IsEnabled = result.Data[4] == 1; UInt16 defval = BitConverter.ToUInt16(result.Data, 7); for (int i = 0; i < result.Data.Length - 12; i += 2) { UInt16 val = BitConverter.ToUInt16(result.Data, 12 + i); NormalIsoNumber.AddValues(_isoTable.ContainsKey(val) ? _isoTable[val] : val.ToString(), val); } NormalIsoNumber.ReloadValues(); NormalIsoNumber.SetValue(defval, false); IsoNumber = NormalIsoNumber; } catch (Exception) { NormalIsoNumber.IsEnabled = false; } MovieIsoNumber = new PropertyValue<int>(); MovieIsoNumber.Name = "IsoNumber"; MovieIsoNumber.ValueChanged += MovieIsoNumber_ValueChanged; MovieIsoNumber.Clear(); try { MTPDataResponse result = ExecuteReadDataEx(CONST_CMD_GetDevicePropDesc, CONST_PROP_MovieExposureIndex); //IsoNumber.IsEnabled = result.Data[4] == 1; UInt16 defval = BitConverter.ToUInt16(result.Data, 7); for (int i = 0; i < result.Data.Length - 12; i += 2) { UInt16 val = BitConverter.ToUInt16(result.Data, 12 + i); MovieIsoNumber.AddValues(_isoTable.ContainsKey(val) ? _isoTable[val] : val.ToString(CultureInfo.InvariantCulture), val); } MovieIsoNumber.ReloadValues(); MovieIsoNumber.SetValue(defval, false); } catch (Exception) { MovieIsoNumber.IsEnabled = false; } } }