Beispiel #1
0
 //we cannt use this for intermec camera init with picturebox
 //public void Connect(IntPtr handle, object o1, object o2)
 //{
 //    addLog("Connect with handle UNSUPPORTED");
 //    cam = new Intermec.Multimedia.Camera(Intermec.Multimedia.Camera.ImageResolutionType.Medium);
 //}
 Boolean startCAM()
 {
     addLog("startCAM()");
     try
     {
         if (cam == null)
         {
             addLog("creat new cam");
             Intermec.Multimedia.Camera.ImageResolutionType viewFinderResolution = Intermec.Multimedia.Camera.ImageResolutionType.Medium;
             cam = new Intermec.Multimedia.Camera(m_pb, viewFinderResolution);
             if (cam.Features.Torch.Available)
             {
                 cam.Features.Torch.PresetValue = Intermec.Multimedia.Camera.Feature.TorchFeature.TorchPresets.Off;
             }
             if (cam.Features.Flash.Available)
             {
                 cam.Features.Flash.CurrentValue = cam.Features.Flash.MaxValue;
             }
         }
         else
         {
             addLog("using existing cam");
         }
         return true;
     }
     catch (CameraException ex)
     {
         addLog("CameraException: " + ex.Message);
     }
     catch (Exception ex)
     {
         addLog("Exception: " + ex.Message);
     }
     return false;
 }
Beispiel #2
0
        void stopCAM()
        {
            addLog("StopCAM()");
            if (cam != null)
            {
                addLog("stopCAM(): cam is not null");
                StopPreview();
                try { cam.SnapshotEvent -= cam_SnapshotEvent; }
                catch (Exception) { }
                //cam.Streaming = false;
                //cam.PictureBoxUpdate = Camera.PictureBoxUpdateType.None;
            }
            try
            {
                //we have to set the event, otherwise the main app will never stop!
                CameraEventArgs cea = new CameraEventArgs(CameraTaskCodes.ImageCaptureComplete);
                addLog("stopCAM(): fire event CaptureComplete");
                doHandleEvent(cea);
                Thread.Sleep(200);
            }
            catch (Exception ex)
            {
                addLog("stopCAM(): Exception for doHandleEvent(): " + ex.Message);
            }
            addLog("StopCAM(): DeInit cam");

            //cam MUST be disposed to have barcoding work!
            if (cam != null)
                camDispose(cam);// cam.Dispose();    //control invoke????
            if (cam != null)
            {
                addLog("stopCAM(): setting cam = null");
                cam = null;
            }
            addLog("StopCAM() done");
        }
Beispiel #3
0
 public new void Dispose()
 {
     addLog("Dispose...");
     if (cam == null)
     {
         addLog("Dispose: no cam!");
         return;
     }
     cam.Streaming = false;
     cam.Dispose();
     cam = null;
     addLog("Dispose done.");
     base.Dispose();
 }