public CameraProperties(Camera camera) { this.Camera = camera; InitializeComponent(); init(); }
/// <summary> /// Unlocks the UI of the camera /// </summary> /// <param name="camera">The camera whose UI to unlock</param> internal static void UnlockUI(Camera camera) { uint error = EDSDK.EdsSendStatusCommand(camera.CameraDevice, EDSDK.CameraState_UIUnLock, 0); if (EDSDK.EDS_ERR_OK != error) { throw new CameraUILockException("Unable to unlock the UI!", error); } }
void camera_OnNewItemCreated(Camera sender, CanonCameraAppLib.Events.NewItemCreatedEventArgs e) { if (chbPreview.Checked) { PhotoPreview preview = new PhotoPreview(e.Item, true); preview.Show(); } }
/// <summary> /// Set a series of properties /// </summary> /// <param name="camera">Camera device</param> /// <param name="properties">Key value pair of a PropertyType and int value</param> /// <returns>Collection of PropertyType/error code pairs from the camera</returns> internal static Dictionary<PropertyType, uint> SetProperty(Camera camera, Dictionary<PropertyType, uint> properties) { LockUI(camera); Dictionary<PropertyType, uint> returnCodes = new Dictionary<PropertyType, uint>(properties.Count); foreach (KeyValuePair<PropertyType, uint> property in properties) { uint error = SetProperty(camera, new Property(property.Key, property.Value)); returnCodes.Add((PropertyType)property.Key, error); } UnlockUI(camera); return returnCodes; }
void camera_OnNewItemCreated(Camera sender, CanonCameraAppLib.Events.NewItemCreatedEventArgs e) { if (chbPreview.Checked) { if (i % 2 == 0) { DateTime dt1 = DateTime.Now; System.IO.File.WriteAllBytes(@"c:\imageStorage\test_" + i / 2 + ".cr2", e.Item.Image); DateTime dt2 = DateTime.Now; TimeSpan ts = dt2 - dt1; System.Console.WriteLine("Data Transmission Time = " + ts.Milliseconds); sender.deleteCapturedItem(e.Item.Ptr); } else { DateTime dt1 = DateTime.Now; System.IO.File.WriteAllBytes(@"c:\imageStorage\full_" + i / 2 + ".jpg", e.Item.Image); DateTime dt2 = DateTime.Now; TimeSpan ts = dt2 - dt1; System.Console.WriteLine("Data Transmission Time = " + ts.Milliseconds); //takePhotograph(0); //SmallPic(@"c:\imageStorage\full_" + i / 2 + ".jpg", @"c:\imageStorage\display_" + i / 2 + ".jpg",1872,1248); //SmallPic(@"c:\imageStorage\display_" + i / 2 + ".jpg", @"c:\imageStorage\thumbnail_" + i / 2 + ".jpg", 156, 104); sender.deleteCapturedItem(e.Item.Ptr); UdpClient udpClient = new UdpClient(); udpClient.Connect("localhost", 60005); Byte[] sendBytes = Encoding.ASCII.GetBytes(@"c:\imageStorage\full_" + i / 2 + ".jpg"); int sentLength = udpClient.Send(sendBytes, sendBytes.Length); if (sentLength > 0) udpClient.Close(); System.Console.WriteLine("Size = " + ts.Milliseconds); } i++; //PhotoPreview preview = new PhotoPreview(e.Item, true); //preview.Show(); } }
/// <summary> /// Set a property /// </summary> /// <param name="camera">Camera device</param> /// <param name="property">Property to change</param> /// <param name="value">Value of the property to change</param> /// <returns>Error code from the camera</returns> internal static uint SetProperty(Camera camera, Property property) { return EDSDK.EdsSetPropertyData(camera.CameraDevice, (uint)property.PropertyType, 0, 0, property.UintValue); }
internal static Property getProperty(Camera camera, PropertyType propertyType) { //EDSDK.EdsGetPropertyData( throw new NotImplementedException(); }