Esempio n. 1
0
        private uint DownloadImage(uint inEvent, IntPtr inRef, IntPtr inContext)
        {
            _cameraNotifications.Log(string.Format("Camera event: {0}", SDKHelper.DecodeEvent(inEvent)));

            lock (_synchronizationObject)
            {
                try
                {
                    if (inEvent == EDSDK.ObjectEvent_DirItemRequestTransfer)
                    {
                        if (_imageHandler != null)
                        {
                            _imageHandler.Handle(GetImageFile(inRef, _folder));
                        }
                        _cameraNotifications.CameraDone();
                    }
                    if (inEvent == EDSDK.ObjectEvent_DirItemCreated)
                    {
                        _cameraNotifications.CameraDone();
                    }
                }
                finally
                {
                    if (inRef != IntPtr.Zero)
                    {
                        SDKHelper.CheckError(EDSDK.EdsRelease(inRef));
                    }
                }
                return(0);
            }
        }
Esempio n. 2
0
        private uint CameraPropertyChanged(uint inEvent, uint inPropertyID, uint inParam, IntPtr inContext)
        {
            _cameraNotifications.Log(string.Format("Camera property changed: {0}, {1}, {2}", SDKHelper.DecodeEvent(inEvent), SDKHelper.DecodeProperty(inPropertyID), inParam));

            lock (_eventHandlersSync)
            {
                foreach (CameraEvent cameraEvent in _eventHandlers)
                {
                    cameraEvent.Process(inPropertyID, inParam);
                }
                _eventHandlers.RemoveAll(cameraEvent => cameraEvent.RunOnce);
            }

            return(EDSDK.EDS_ERR_OK);
        }