private bool DownloadEvf() { // Do not download if pauseUpdate requested if (_pauseLiveViewRequested) { return(true); } if ((this.LiveViewDevice & EosLiveViewDevice.Host) == EosLiveViewDevice.None || _cancelLiveViewRequested) { return(false); } lock (_locker) { var memoryStream = IntPtr.Zero; try { Util.Assert(Edsdk.EdsCreateMemoryStream(0, out memoryStream), "Failed to create memory stream."); using (var image = EosLiveImage.CreateFromStream(memoryStream)) { Util.Assert(Edsdk.EdsDownloadEvfImage(this.Handle, image.Handle), "Failed to download evf image."); var converter = new EosConverter(); this.OnLiveViewUpdate( new EosLiveImageEventArgs(converter.ConvertImageStreamToBytes(memoryStream)) { Zoom = image.Zoom, ZommBounds = image.ZoomBounds, ImagePosition = image.ImagePosition, ImageSize = image.Size //Histogram = image.Histogram, }); } } catch (EosException eosEx) { //if (eosEx.EosErrorCode != EosErrorCode.DeviceBusy && eosEx.EosErrorCode != EosErrorCode.ObjectNotReady) // throw; } finally { if (memoryStream != IntPtr.Zero) { Edsdk.EdsRelease(memoryStream); } } } return(true); }
public bool DownloadEvfInternal() { var memoryStream = IntPtr.Zero; try { Edsdk.EdsCreateMemoryStream(0, out memoryStream); using (var image = EosLiveImage.CreateFromStream(memoryStream)) { Edsdk.EdsDownloadEvfImage(this.Handle, image.Handle); var converter = new EosConverter(); this.OnLiveViewUpdate( new EosLiveImageEventArgs(converter.ConvertImageStreamToBytes(memoryStream)) { Zoom = image.Zoom, ZommBounds = image.ZoomBounds, ImagePosition = image.ImagePosition, ImageSize = image.Size, //Histogram = image.Histogram, }); } } catch (EosException eosEx) { //if (eosEx.EosErrorCode != EosErrorCode.DeviceBusy && eosEx.EosErrorCode != EosErrorCode.ObjectNotReady) // throw; } finally { if (memoryStream != IntPtr.Zero) { Edsdk.EdsRelease(memoryStream); } } return(true); }