Esempio n. 1
0
        private void AddCanonCameras()
        {
            foreach (EosCamera eosCamera in _framework.GetCameraCollection())
            {
                bool shouldbeadded = true;
                foreach (ICameraDevice device in ConnectedDevices)
                {
                    CanonSDKBase camera = device as CanonSDKBase;
                    if (camera != null)
                    {
                        if (camera.Camera == eosCamera)
                        {
                            shouldbeadded = false;
                            break;
                        }
                    }
                }

                if (shouldbeadded)
                {
                    Log.Debug("New canon camera found !");
                    CanonSDKBase camera = new CanonSDKBase();
                    camera.Init(eosCamera);
                    ConnectedDevices.Add(camera);
                    NewCameraConnected(camera);
                }
            }
            Thread.Sleep(2500);
        }
        private void AddCanonCameras()
        {
            lock (_locker)
            {
                foreach (EosCamera eosCamera in GetEosCameras())
                {
                    bool shouldbeadded =
                        ConnectedDevices.OfType <CanonSDKBase>().All(camera => camera.PortName != eosCamera.PortName);

                    if (shouldbeadded)
                    {
                        Log.Debug("New canon camera found !");
                        CanonSDKBase camera = new CanonSDKBase();
                        Log.Debug("Pas 1");
                        DeviceDescriptor descriptor = new DeviceDescriptor {
                            EosCamera = eosCamera
                        };
                        descriptor.CameraDevice = camera;
                        Log.Debug("Pas 2");
                        camera.Init(eosCamera);
                        Log.Debug("Pas 3");
                        ConnectedDevices.Add(camera);
                        Log.Debug("Pas 4");
                        _deviceEnumerator.Add(descriptor);
                        Log.Debug("Pas 5");
                        NewCameraConnected(camera);
                        Log.Debug("New canon camera found done!");
                    }
                }
                //Thread.Sleep(2500);
            }
        }
        private void AddCanonCameras()
        {
            foreach (EosCamera eosCamera in GetEosCameras())
            {
                bool shouldbeadded = true;
                foreach (ICameraDevice device in ConnectedDevices)
                {
                    CanonSDKBase camera = device as CanonSDKBase;
                    if (camera != null)
                    {
                        if (camera.Camera == eosCamera)
                        {
                            shouldbeadded = false;
                            break;
                        }
                    }
                }

                if (shouldbeadded)
                {
                    Log.Debug("New canon camera found !");
                    CanonSDKBase     camera     = new CanonSDKBase();
                    DeviceDescriptor descriptor = new DeviceDescriptor {
                        EosCamera = eosCamera
                    };
                    descriptor.CameraDevice = camera;
                    NewCameraConnected(camera);
                    camera.Init(eosCamera);
                    ConnectedDevices.Add(camera);
                    _deviceEnumerator.Add(descriptor);
                }
            }
            Thread.Sleep(2500);
        }