コード例 #1
0
        public void FastTakePhoto(short fromImageNumber, short toImageNumber)
        {
            //CameraHandler = new SDKHandler();

            //Handler of image download

            CameraHandler.ImageDownloaded -= new SDKHandler.BitmapUpdate(SDK_ImageDownloaded);
            CameraHandler.ImageDownloaded += new SDKHandler.BitmapUpdate(SDK_ImageDownloaded);

            List <Camera> cameraList = CameraHandler.GetCameraList();

            if (cameraList == null || cameraList.Count == 0)
            {
                return;
            }

            Camera camera = cameraList[0];

            if (!CameraHandler.CameraSessionOpen)
            {
                CameraHandler.OpenSession(camera);
            }

            int delay = 1000;

            ShowBackgroundWindow(fromImageNumber);
            Thread.Sleep(delay);

            this.startImageNumber   = 1;
            this.currentImageNumber = toImageNumber;

            //Transfer image to computer
            CameraHandler.SetSetting(EDSDK.PropID_SaveTo, (uint)EDSDK.EdsSaveTo.Host);
            CameraHandler.SetCapacity();

            //Take photo
            CameraHandler.TakePhoto();
            Thread.Sleep(delay);

            this.imageForm.Close();
            this.imageForm = null;
        }