本文整理汇总了C#中PropertyValue.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# PropertyValue.SetValue方法的具体用法?C# PropertyValue.SetValue怎么用?C# PropertyValue.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropertyValue
的用法示例。
在下文中一共展示了PropertyValue.SetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitCompressionSetting
protected override void InitCompressionSetting()
{
try
{
byte datasize = 1;
CompressionSetting = new PropertyValue<int>();
CompressionSetting.ValueChanged += CompressionSetting_ValueChanged;
byte[] result = StillImageDevice.ExecuteReadData(CONST_CMD_GetDevicePropDesc, CONST_PROP_CompressionSetting);
byte defval = result[datasize + 5];
for (int i = 0; i < result.Length - ((2 * datasize) + 6 + 2); i += datasize)
{
byte val = result[((2 * datasize) + 6 + 2) + i];
CompressionSetting.AddValues(_csTable.ContainsKey(val) ? _csTable[val] : val.ToString(), val);
}
CompressionSetting.SetValue(defval);
}
catch (Exception)
{
}
}
示例2: InitFocalLength
protected virtual PropertyValue<long> InitFocalLength()
{
PropertyValue<long> res = new PropertyValue<long>()
{
Name = "Focal Length",
IsEnabled = true,
Code = 0x5008,
SubType = typeof(UInt32)
};
res.AddValues("3500", 0x0DAC);
res.AddValues("4600", 0x11F8);
res.AddValues("5300", 0x14B4);
res.AddValues("6100", 0x17D4);
res.AddValues("7300", 0x1C84);
res.AddValues("8600", 0x2198);
res.AddValues("10500", 0x2904);
res.SetValue(StillImageDevice.ExecuteReadData(CONST_CMD_GetDevicePropValue,
res.Code), false);
res.ReloadValues();
res.ValueChanged +=
(sender, key, val) => SetProperty(CONST_CMD_SetDevicePropValue, BitConverter.GetBytes(val), res.Code);
return res;
}
示例3: InitCompression
private void InitCompression()
{
CompressionSetting = new PropertyValue<int>();
CompressionSetting.AddValues("Jpeg", (int) EosImageFormat.Jpeg);
CompressionSetting.AddValues("Crw", (int) EosImageFormat.Crw);
CompressionSetting.AddValues("Cr2", (int) EosImageFormat.Cr2);
CompressionSetting.SetValue((int) Camera.ImageQuality.PrimaryImageFormat);
CompressionSetting.ValueChanged +=
new PropertyValue<int>.ValueChangedEventHandler(CompressionSetting_ValueChanged);
}
示例4: InitCompression
private void InitCompression()
{
var data = GetSettingsList(Edsdk.PropID_ImageQuality);
CompressionSetting = new PropertyValue<int>();
CompressionSetting.AddValues("Large Fine JPEG", (int) new EosImageQuality(){PrimaryCompressLevel = EosCompressLevel.Fine,PrimaryImageFormat = EosImageFormat.Jpeg,PrimaryImageSize = EosImageSize.Large,SecondaryCompressLevel = EosCompressLevel.Unknown,SecondaryImageFormat = EosImageFormat.Unknown, SecondaryImageSize = EosImageSize.Unknown}.ToBitMask());
CompressionSetting.AddValues("Large Normal JPEG", (int)new EosImageQuality() { PrimaryCompressLevel = EosCompressLevel.Normal, PrimaryImageFormat = EosImageFormat.Jpeg, PrimaryImageSize = EosImageSize.Large, SecondaryCompressLevel = EosCompressLevel.Unknown, SecondaryImageFormat = EosImageFormat.Unknown, SecondaryImageSize = EosImageSize.Unknown }.ToBitMask());
CompressionSetting.AddValues("Medium Fine JPEG", (int)new EosImageQuality() { PrimaryCompressLevel = EosCompressLevel.Fine, PrimaryImageFormat = EosImageFormat.Jpeg, PrimaryImageSize = EosImageSize.Middle, SecondaryCompressLevel = EosCompressLevel.Unknown, SecondaryImageFormat = EosImageFormat.Unknown, SecondaryImageSize = EosImageSize.Unknown }.ToBitMask());
CompressionSetting.AddValues("Medium Normal JPEG", (int)new EosImageQuality() { PrimaryCompressLevel = EosCompressLevel.Normal, PrimaryImageFormat = EosImageFormat.Jpeg, PrimaryImageSize = EosImageSize.Middle, SecondaryCompressLevel = EosCompressLevel.Unknown, SecondaryImageFormat = EosImageFormat.Unknown, SecondaryImageSize = EosImageSize.Unknown }.ToBitMask());
CompressionSetting.AddValues("Small Fine JPEG", (int)new EosImageQuality() { PrimaryCompressLevel = EosCompressLevel.Fine, PrimaryImageFormat = EosImageFormat.Jpeg, PrimaryImageSize = EosImageSize.Small2, SecondaryCompressLevel = EosCompressLevel.Unknown, SecondaryImageFormat = EosImageFormat.Unknown, SecondaryImageSize = EosImageSize.Unknown }.ToBitMask());
CompressionSetting.AddValues("Small Normal JPEG", (int)new EosImageQuality() { PrimaryCompressLevel = EosCompressLevel.Normal, PrimaryImageFormat = EosImageFormat.Jpeg, PrimaryImageSize = EosImageSize.Small2, SecondaryCompressLevel = EosCompressLevel.Unknown, SecondaryImageFormat = EosImageFormat.Unknown, SecondaryImageSize = EosImageSize.Unknown }.ToBitMask());
CompressionSetting.AddValues("Smaller JPEG", (int)new EosImageQuality() { PrimaryCompressLevel = EosCompressLevel.Fine, PrimaryImageFormat = EosImageFormat.Jpeg, PrimaryImageSize = EosImageSize.Small3, SecondaryCompressLevel = EosCompressLevel.Unknown, SecondaryImageFormat = EosImageFormat.Unknown, SecondaryImageSize = EosImageSize.Unknown }.ToBitMask());
CompressionSetting.AddValues("Tiny JPEG", (int)new EosImageQuality() { PrimaryCompressLevel = EosCompressLevel.Fine, PrimaryImageFormat = EosImageFormat.Jpeg, PrimaryImageSize = EosImageSize.Small4, SecondaryCompressLevel = EosCompressLevel.Unknown, SecondaryImageFormat = EosImageFormat.Unknown, SecondaryImageSize = EosImageSize.Unknown }.ToBitMask());
CompressionSetting.AddValues("RAW + Large Fine JPEG", (int)new EosImageQuality() {PrimaryImageFormat =EosImageFormat.Cr2,PrimaryCompressLevel = EosCompressLevel.Lossless, PrimaryImageSize = EosImageSize.Large, SecondaryImageSize =EosImageSize.Large,SecondaryCompressLevel = EosCompressLevel.Fine, SecondaryImageFormat = EosImageFormat.Jpeg }.ToBitMask());
CompressionSetting.AddValues("RAW", (int)new EosImageQuality() { PrimaryImageFormat = EosImageFormat.Cr2, PrimaryCompressLevel = EosCompressLevel.Lossless, PrimaryImageSize = EosImageSize.Large, SecondaryCompressLevel = EosCompressLevel.Unknown, SecondaryImageFormat = EosImageFormat.Unknown, SecondaryImageSize = EosImageSize.Unknown}.ToBitMask());
CompressionSetting.Filter(data);
CompressionSetting.SetValue((int) Camera.ImageQuality.ToBitMask());
CompressionSetting.ValueChanged += CompressionSetting_ValueChanged;
}
示例5: InitExposureMeteringMode
public void InitExposureMeteringMode()
{
try
{
DeviceReady();
byte datasize = 2;
ExposureMeteringMode = new PropertyValue<int>();
ExposureMeteringMode.Name = "ExposureMeteringMode";
ExposureMeteringMode.ValueChanged += ExposureMeteringMode_ValueChanged;
MTPDataResponse result = ExecuteReadDataEx(CONST_CMD_GetDevicePropDesc, CONST_PROP_ExposureMeteringMode);
UInt16 defval = BitConverter.ToUInt16(result.Data, datasize + 5);
for (int i = 0; i < result.Data.Length - ((2*datasize) + 6 + 2); i += datasize)
{
UInt16 val = BitConverter.ToUInt16(result.Data, ((2*datasize) + 6 + 2) + i);
ExposureMeteringMode.AddValues(_emmTable.ContainsKey(val) ? _emmTable[val] : val.ToString(), val);
}
ExposureMeteringMode.ReloadValues();
ExposureMeteringMode.SetValue(defval, false);
}
catch (Exception)
{
}
}
示例6: InitExposureCompensation
public void InitExposureCompensation()
{
try
{
DeviceReady();
byte datasize = 2;
NormalExposureCompensation = new PropertyValue<int>();
NormalExposureCompensation.Name = "ExposureCompensation";
NormalExposureCompensation.ValueChanged += ExposureCompensation_ValueChanged;
MTPDataResponse result = ExecuteReadDataEx(CONST_CMD_GetDevicePropDesc,
CONST_PROP_ExposureBiasCompensation);
Int16 defval = BitConverter.ToInt16(result.Data, datasize + 5);
for (int i = 0; i < result.Data.Length - ((2*datasize) + 6 + 2); i += datasize)
{
Int16 val = BitConverter.ToInt16(result.Data, ((2*datasize) + 6 + 2) + i);
decimal d = val;
string s = Decimal.Round(d/1000, 1).ToString("0.0", CultureInfo.CreateSpecificCulture("en-US"));
if (d > 0)
s = "+" + s;
NormalExposureCompensation.AddValues(s, val);
}
NormalExposureCompensation.ReloadValues();
NormalExposureCompensation.SetValue(defval, false);
ExposureCompensation = NormalExposureCompensation;
}
catch (Exception)
{
}
try
{
DeviceReady();
byte datasize = 2;
MovieExposureCompensation = new PropertyValue<int>();
MovieExposureCompensation.Name = "ExposureCompensation";
MovieExposureCompensation.ValueChanged += MovieExposureCompensation_ValueChanged;
MTPDataResponse result = ExecuteReadDataEx(CONST_CMD_GetDevicePropDesc,
CONST_PROP_MovieExposureBiasCompensation);
Int16 defval = BitConverter.ToInt16(result.Data, datasize + 5);
for (int i = 0; i < result.Data.Length - ((2 * datasize) + 6 + 2); i += datasize)
{
Int16 val = BitConverter.ToInt16(result.Data, ((2 * datasize) + 6 + 2) + i);
decimal d = val;
string s = Decimal.Round(d / 1000, 1).ToString("0.0", CultureInfo.CreateSpecificCulture("en-US"));
if (d > 0)
s = "+" + s;
MovieExposureCompensation.AddValues(s, val);
}
MovieExposureCompensation.ReloadValues();
MovieExposureCompensation.SetValue(defval, false);
}
catch (Exception)
{
}
}
示例7: InitOther
private void InitOther()
{
LiveViewImageZoomRatio = new PropertyValue<int> {Name = "LiveViewImageZoomRatio"};
LiveViewImageZoomRatio.AddValues("All", 1);
LiveViewImageZoomRatio.AddValues("5x", 5);
LiveViewImageZoomRatio.AddValues("10x", 10);
LiveViewImageZoomRatio.SetValue("All");
LiveViewImageZoomRatio.ValueChanged += LiveViewImageZoomRatio_ValueChanged;
}
示例8: InitMetering
private void InitMetering()
{
ExposureMeteringMode = new PropertyValue<int>();
ExposureMeteringMode.ValueChanged += ExposureMeteringMode_ValueChanged;
try
{
foreach (KeyValuePair<uint, string> keyValuePair in _meteringTable)
{
ExposureMeteringMode.AddValues(keyValuePair.Value, (int) keyValuePair.Key);
}
ExposureMeteringMode.IsEnabled = true;
ExposureMeteringMode.SetValue((int) Camera.GetProperty(Edsdk.PropID_MeteringMode), false);
}
catch (Exception exception)
{
Log.Debug("Error get metering", exception);
}
}
示例9: InitMode
private void InitMode()
{
try
{
DeviceReady();
byte datasize = 2;
Mode = new PropertyValue<uint>();
Mode.Name = "Mode";
Mode.IsEnabled = false;
Mode.ValueChanged += Mode_ValueChanged;
var result = StillImageDevice.ExecuteReadData(CONST_CMD_GetDevicePropDesc,
CONST_PROP_ExposureProgramMode);
int type = BitConverter.ToInt16(result.Data, 2);
byte formFlag = result.Data[(2 * datasize) + 5];
UInt16 defval = BitConverter.ToUInt16(result.Data, datasize + 5);
for (int i = 0; i < result.Data.Length - ((2 * datasize) + 6 + 2); i += datasize)
{
UInt16 val = BitConverter.ToUInt16(result.Data, ((2 * datasize) + 6 + 2) + i);
Mode.AddValues(_exposureModeTable.ContainsKey(val) ? _exposureModeTable[val] : val.ToString(), val);
}
Mode.ReloadValues();
Mode.SetValue(defval);
}
catch (Exception)
{
}
}
示例10: InitIso
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;
}
}
}
示例11: InitImageSize
protected virtual PropertyValue<long> InitImageSize()
{
var res = new PropertyValue<long>() {Name = "Image Size", IsEnabled = true, Code = CONST_PROP_ImageSize};
res.ValueChanged += ImageSize_ValueChanged;
MTPDataResponse result = ExecuteReadDataEx(CONST_CMD_GetDevicePropDesc, res.Code);
//ErrorCodes.GetException(result.ErrorCode);
if (result.Data != null && result.Data.Length > 112)
{
res.AddValues(Encoding.Unicode.GetString(result.Data, 51, 20), 0);
res.AddValues(Encoding.Unicode.GetString(result.Data, 72, 20), 0);
res.AddValues(Encoding.Unicode.GetString(result.Data, 93, 20), 0);
res.SetValue(Encoding.Unicode.GetString(result.Data, 27, 20), false);
}
res.ReloadValues();
return res;
}
示例12: InitCompressionSetting
protected virtual void InitCompressionSetting()
{
try
{
DeviceReady();
byte datasize = 1;
CompressionSetting = new PropertyValue<int>();
CompressionSetting.Name = "CompressionSetting ";
CompressionSetting.ValueChanged += CompressionSetting_ValueChanged;
var result = StillImageDevice.ExecuteReadData(CONST_CMD_GetDevicePropDesc,
CONST_PROP_CompressionSetting);
if(result.Data.Length==0)
return;
int type = BitConverter.ToInt16(result.Data, 2);
byte formFlag = result.Data[(2 * datasize) + 5];
byte defval = result.Data[datasize + 5];
for (int i = 0; i < result.Data.Length - ((2 * datasize) + 6 + 2); i += datasize)
{
byte val = result.Data[((2 * datasize) + 6 + 2) + i];
CompressionSetting.AddValues(_csTable.ContainsKey(val) ? _csTable[val] : val.ToString(), val);
}
CompressionSetting.ReloadValues();
CompressionSetting.SetValue(defval, false);
}
catch (Exception)
{
}
}
示例13: SetTo
public void SetTo(PropertyValue<long> value, string name)
{
if (value == null)
return;
foreach (ValuePair valuePair in Values)
{
// set the value only if the value is different from current value
if (valuePair.Name == name && value.IsEnabled && value.Value != valuePair.Value)
{
value.SetValue(valuePair.Value);
return;
}
}
}
示例14: InitEc
private void InitEc()
{
var data = GetSettingsList(Edsdk.PropID_ExposureCompensation);
ExposureCompensation = new PropertyValue<int>();
ExposureCompensation.ValueChanged += ExposureCompensation_ValueChanged;
try
{
foreach (KeyValuePair<uint, string> keyValuePair in _ec)
{
if (data.Count == 0)
{
ExposureCompensation.AddValues(keyValuePair.Value, (int)keyValuePair.Key);
}
else
{
if (data.Contains((int)keyValuePair.Key))
ExposureCompensation.AddValues(keyValuePair.Value, (int)keyValuePair.Key);
}
}
ExposureCompensation.ReloadValues();
ExposureCompensation.IsEnabled = true;
ExposureCompensation.SetValue((int) Camera.GetProperty(Edsdk.PropID_ExposureCompensation), false);
}
catch (Exception exception)
{
Log.Debug("Error get EC", exception);
}
}
示例15: InitEc
private void InitEc()
{
ExposureCompensation = new PropertyValue<int>();
ExposureCompensation.ValueChanged += ExposureCompensation_ValueChanged;
try
{
foreach (KeyValuePair<uint, string> keyValuePair in _ec)
{
ExposureCompensation.AddValues(keyValuePair.Value, (int) keyValuePair.Key);
}
ExposureCompensation.IsEnabled = true;
ExposureCompensation.SetValue((int) Camera.GetProperty(Edsdk.PropID_ExposureCompensation), false);
}
catch (Exception exception)
{
Log.Debug("Error get EC", exception);
}
}