Пример #1
0
        public void SetRelease(ViewDataCallback viewDataCallback, GetFileCallback getFileCallback)
        {
            // Handle Callbacks
            if (viewDataCallback == null || getFileCallback == null)
            {
                throw new ArgumentNullException("Callbacks");
            }
            this.m_viewDataCallback = viewDataCallback;
            this.m_getFileCallback  = getFileCallback;
            // Init ReleaseControl
            uint response = 0;

            response = this.m_api.InitiateReleaseControl(this.m_cameraHandle);
            if (!VerifyReponse(response))
            {
                throw new Exception("InitiateReleaseControl");
            }
            // Init ViewData Timer
            this.m_timer = new Timer(new TimerCallback((o) =>
            {
                if (Thread.VolatileRead(ref this.m_accepted) == 1)
                {
                    return;
                }
                Thread.VolatileWrite(ref this.m_accepted, 1);
            }), null, 0, 100);
            // Register ViewFinder
            this.m_prViewFinderCallback = new PRApi.prViewFinderCB(MyViewFinderCB);
            response = this.m_api.RC_StartViewFinder(this.m_cameraHandle, m_prViewFinderCallback);
            if (!VerifyReponse(response))
            {
                throw new Exception("RC_StartViewFinder");
            }
            // Register SetEvent
            this.m_setEventCB = new PRApi.prSetEventCB(MySetEventCB);
            response          = this.m_api.SetEventCallback(this.m_cameraHandle, this.m_setEventCB);
            if (!VerifyReponse(response))
            {
                throw new Exception("SetEventCallback");
            }
        }
Пример #2
0
 public void SetRelease(ViewDataCallback viewDataCallback, GetFileCallback getFileCallback)
 {
     // Handle Callbacks
     if (viewDataCallback == null || getFileCallback == null)
     {
         throw new ArgumentNullException("Callbacks");
     }
     this.m_viewDataCallback = viewDataCallback;
     this.m_getFileCallback = getFileCallback;
     // Init ReleaseControl
     uint response = 0;
     response = this.m_api.InitiateReleaseControl(this.m_cameraHandle);
     if (!VerifyReponse(response))
     {
         throw new Exception("InitiateReleaseControl");
     }
     // Init ViewData Timer
     this.m_timer = new Timer(new TimerCallback((o) =>
     {
         if (Thread.VolatileRead(ref this.m_accepted) == 1)
         {
             return;
         }
         Thread.VolatileWrite(ref this.m_accepted, 1);
     }), null, 0, 100);
     // Register ViewFinder
     this.m_prViewFinderCallback = new PRApi.prViewFinderCB(MyViewFinderCB);
     response = this.m_api.RC_StartViewFinder(this.m_cameraHandle, m_prViewFinderCallback);
     if (!VerifyReponse(response))
     {
         throw new Exception("RC_StartViewFinder");
     }
     // Register SetEvent
     this.m_setEventCB = new PRApi.prSetEventCB(MySetEventCB);
     response = this.m_api.SetEventCallback(this.m_cameraHandle, this.m_setEventCB);
     if (!VerifyReponse(response))
     {
         throw new Exception("SetEventCallback");
     }
 }