Example #1
0
        private void KeyDownThread(KeyboardHookEventArgs e)
        {
            _eventIsBusy = true;
            try
            {
                Key inputKey = KeyInterop.KeyFromVirtualKey((int)e.Key);
                foreach (var item in ServiceProvider.Settings.Actions)
                {
                    if (!item.Global)
                    {
                        continue;
                    }
                    if (item.Alt == e.isAltPressed && item.Ctrl == e.isCtrlPressed && item.KeyEnum == inputKey)
                    {
                        ServiceProvider.WindowsManager.ExecuteCommand(item.Name);
                    }
                }
                ICameraDevice lastDevice = null;
                foreach (ICameraDevice device in ServiceProvider.DeviceManager.ConnectedDevices)
                {
                    if (lastDevice != null)
                    {
                        lastDevice.WaitForCamera(1500);
                    }

                    // wait for camera to finish last transfer with timeot of 1.5 sec
                    device.WaitForCamera(1500);
                    // skip camera is camera is still busy
                    if (device.IsBusy)
                    {
                        continue;
                    }
                    CameraProperty property = device.LoadProperties();
                    if (property.KeyTrigger.KeyEnum != Key.None && property.KeyTrigger.Alt == e.isAltPressed &&
                        property.KeyTrigger.Ctrl == e.isCtrlPressed &&
                        property.KeyTrigger.KeyEnum == inputKey)
                    {
                        CameraHelper.Capture(device);
                        lastDevice = device;
                    }
                    if (property.KeyTriggerNoAF.KeyEnum != Key.None && property.KeyTriggerNoAF.Alt == e.isAltPressed &&
                        property.KeyTriggerNoAF.Ctrl == e.isCtrlPressed &&
                        property.KeyTriggerNoAF.KeyEnum == inputKey)
                    {
                        CameraHelper.CaptureNoAf(device);
                        lastDevice = device;
                    }
                }
            }
            catch (Exception exception)
            {
                StaticHelper.Instance.SystemMessage = exception.Message;
                Log.Error("Key trigger ", exception);
            }
            _eventIsBusy = false;
        }
Example #2
0
 private void KeyDown(KeyboardHookEventArgs e)
 {
     _altPressed  = e.isAltPressed;
     _ctrlPressed = e.isCtrlPressed;
     if (_eventIsBusy)
     {
         Log.Debug("Evcent busy !");
         return;
     }
     Task.Factory.StartNew(() => KeyDownThread(e));
 }
Example #3
0
        private void KeyUp(KeyboardHookEventArgs e)
        {
            _altPressed = e.isAltPressed;
            _ctrlPressed = e.isCtrlPressed;

        }
Example #4
0
        private void KeyDownThread(KeyboardHookEventArgs e)
        {
            _eventIsBusy = true;
            try
            {
                Key inputKey = KeyInterop.KeyFromVirtualKey((int)e.Key);
                foreach (var item in ServiceProvider.Settings.Actions)
                {
                    if (!item.Global)
                        continue;
                    if (item.Alt == e.isAltPressed && item.Ctrl == e.isCtrlPressed && item.KeyEnum == inputKey)
                        ServiceProvider.WindowsManager.ExecuteCommand(item.Name);
                }
                ICameraDevice lastDevice = null;
                foreach (ICameraDevice device in ServiceProvider.DeviceManager.ConnectedDevices)
                {
                    if (lastDevice != null)
                        lastDevice.WaitForCamera(1500);

                    // wait for camera to finish last transfer with timeot of 1.5 sec
                    device.WaitForCamera(1500);
                    // skip camera is camera is still busy
                    if (device.IsBusy)
                        continue;
                    CameraProperty property = device.LoadProperties();
                    if (property.KeyTrigger.KeyEnum != Key.None && property.KeyTrigger.Alt == e.isAltPressed &&
                        property.KeyTrigger.Ctrl == e.isCtrlPressed &&
                        property.KeyTrigger.KeyEnum == inputKey)
                    {
                        CameraHelper.Capture(device);
                        lastDevice = device;
                    }
                }
            }
            catch (Exception exception)
            {
                StaticHelper.Instance.SystemMessage = exception.Message;
                Log.Error("Key trigger ", exception);
            }
            _eventIsBusy = false;
        }
Example #5
0
 private void KeyDown(KeyboardHookEventArgs e)
 {
     _altPressed = e.isAltPressed;
     _ctrlPressed = e.isCtrlPressed;
     if (_eventIsBusy)
     {
         Log.Debug("Evcent busy !");
         return;
     }
     Task.Factory.StartNew(() => KeyDownThread(e));
 }
Example #6
0
 private void KeyUp(KeyboardHookEventArgs e)
 {
     _altPressed  = e.isAltPressed;
     _ctrlPressed = e.isCtrlPressed;
     _shftPressed = e.isShiftPressed;
 }