Ejemplo n.º 1
0
 private void ReInitShutterSpeed()
 {
     lock (Locker)
     {
         try
         {
             //byte datasize = 4;
             ShutterSpeed.Clear();
             foreach (KeyValuePair <uint, string> keyValuePair in _shutterTable)
             {
                 ShutterSpeed.AddValues(keyValuePair.Value, keyValuePair.Key);
             }
             //byte[] result = StillImageDevice.ExecuteReadData(CONST_CMD_GetDevicePropDesc, CONST_PROP_EOS_ShutterSpeed);
             //int type = BitConverter.ToInt16(result, 2);
             //byte formFlag = result[(2 * datasize) + 5];
             //UInt32 defval = BitConverter.ToUInt32(result, datasize + 5);
             //for (int i = 0; i < result.Length - ((2 * datasize) + 6 + 2); i += datasize)
             //{
             //    UInt32 val = BitConverter.ToUInt32(result, ((2 * datasize) + 6 + 2) + i);
             //    ShutterSpeed.AddValues(_shutterTable.ContainsKey(val) ? _shutterTable[val] : val.ToString(), val);
             //}
             //ShutterSpeed.SetValue(defval);
         }
         catch (Exception ex)
         {
             Log.Debug("EOS Shutter speed init", ex);
         }
     }
 }
Ejemplo n.º 2
0
        private void ReInitShutterSpeed()
        {
            lock (Locker)
            {
                try
                {
                    ShutterSpeed.Clear();
                    var data = Camera.GetPropertyDescription(Edsdk.PropID_Tv);
                    foreach (KeyValuePair <uint, string> keyValuePair in _shutterTable)
                    {
                        if (data.NumElements > 0)
                        {
                            if (ArrayContainValue(data.PropDesc, keyValuePair.Key))
                            {
                                ShutterSpeed.AddValues(keyValuePair.Value, keyValuePair.Key);
                            }
                        }
                        else
                        {
                            ShutterSpeed.AddValues(keyValuePair.Value, keyValuePair.Key);
                        }
                    }

                    long value = Camera.GetProperty(Edsdk.PropID_Tv);
                    if (value == 0)
                    {
                        ShutterSpeed.IsEnabled = false;
                    }
                    else
                    {
                        ShutterSpeed.IsEnabled = true;
                        ShutterSpeed.SetValue(Camera.GetProperty(Edsdk.PropID_Tv), false);
                    }
                }
                catch (Exception ex)
                {
                    Log.Debug("EOS Shutter speed init", ex);
                }
            }
        }