Ejemplo n.º 1
0
        public KeyEnabledStates(
            IKeyboardService keyboardService, 
            ISuggestionStateService suggestionService,
            ICapturingStateManager capturingStateManager,
            ILastMouseActionStateManager lastMouseActionStateManager,
            ICalibrationService calibrationService,
            IWindowStateService mainWindowStateService)
        {
            this.keyboardService = keyboardService;
            this.suggestionService = suggestionService;
            this.capturingStateManager = capturingStateManager;
            this.lastMouseActionStateManager = lastMouseActionStateManager;
            this.calibrationService = calibrationService;
            this.mainWindowStateService = mainWindowStateService;

            suggestionService.OnPropertyChanges(ss => ss.Suggestions).Subscribe(_ => NotifyStateChanged());
            suggestionService.OnPropertyChanges(ss => ss.SuggestionsPage).Subscribe(_ => NotifyStateChanged());
            suggestionService.OnPropertyChanges(ss => ss.SuggestionsPerPage).Subscribe(_ => NotifyStateChanged());

            keyboardService.KeyDownStates[KeyValues.SimulateKeyStrokesKey].OnPropertyChanges(np => np.Value).Subscribe(_ => NotifyStateChanged());
            keyboardService.KeyDownStates[KeyValues.SleepKey].OnPropertyChanges(np => np.Value).Subscribe(_ => NotifyStateChanged());

            KeyValues.KeysWhichPreventTextCaptureIfDownOrLocked.ForEach(kv =>
                keyboardService.KeyDownStates[kv].OnPropertyChanges(np => np.Value).Subscribe(_ => NotifyStateChanged()));

            capturingStateManager.OnPropertyChanges(csm => csm.CapturingMultiKeySelection).Subscribe(_ => NotifyStateChanged());

            lastMouseActionStateManager.OnPropertyChanges(lmasm => lmasm.LastMouseActionExists).Subscribe(_ => NotifyStateChanged());

            mainWindowStateService.OnPropertyChanges(mwss => mwss.WindowState).Subscribe(_ => NotifyStateChanged());
        }
Ejemplo n.º 2
0
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            Frame rootFrame = Window.Current.Content as Frame;
            if (rootFrame == null)
            {
                rootFrame = new Frame();
                rootFrame.NavigationFailed += OnNavigationFailed;
                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // TODO: Restore navigation stack
                }
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                Locator.SetNavigationFrame(rootFrame);
                if (Locator.SettingsService.GetValue<string>("refresh_token") != null)
                    Locator.NavigationService.NavigateTo("Home");
                else
                    Locator.NavigationService.NavigateTo("Login");
            }
            Window.Current.Activate();
            KeyboardService = new KeyboardService();
        }
Ejemplo n.º 3
0
 public KeyboardController(IKeyboardService keyboardService, IEmojiService emojiService,
                           IStickerService stickerService)
 {
     _keyboardService = keyboardService;
     _emojiService    = emojiService;
     _stickerService  = stickerService;
 }
Ejemplo n.º 4
0
 public void SetKeyboardService(IKeyboardService service)
 {
     if (KeyboardService == null)
     {
         KeyboardService = service;
     }
 }
Ejemplo n.º 5
0
 public HandleCommandService(
     ICommandsService commandsService,
     IAuthorizationService spotifyAuthorizationService,
     IAuthorizationTokenRepository authorizationTokenRepository,
     ISendMessageService sendMessageService,
     ISpotifyLinkHelper spotifyLinkHelper,
     ISyncTracksService trackService,
     IPlaylistRepository playlistRepository,
     IKeyboardService keyboardService,
     IChatRepository chatRepository,
     IUserService userService,
     IUserRepository userRepository,
     ISpotifyClientFactory spotifyClientFactory,
     ISpotifyClientService spotifyClientService)
     : base(commandsService, userRepository, sendMessageService, spotifyLinkHelper)
 {
     _commandsService              = commandsService;
     _spotifyAuthorizationService  = spotifyAuthorizationService;
     _authorizationTokenRepository = authorizationTokenRepository;
     _sendMessageService           = sendMessageService;
     _spotifyLinkHelper            = spotifyLinkHelper;
     _syncTracksService            = trackService;
     _playlistRepository           = playlistRepository;
     _keyboardService              = keyboardService;
     _chatRepository       = chatRepository;
     _userService          = userService;
     _spotifyClientFactory = spotifyClientFactory;
     _spotifyClientService = spotifyClientService;
 }
Ejemplo n.º 6
0
        public MainViewModel(IConfigurationService configService, INuiService nuiService, IKeyboardService keyboardService)
        {
            this.keyboardService = keyboardService;
            this.keyboardService.KeyUp += new EventHandler<KeyEventArgs>(keyboardService_KeyUp);
            this.configService = configService;
            this.nuiService = nuiService;
            this.nuiService.UserRaisedHand += new EventHandler<HandRaisedEventArgs>(nuiService_UserRaisedHand);
            this.nuiService.UserEnteredBounds += new EventHandler(nuiService_UserEnteredBounds);
            this.nuiService.UserExitedBounds += new EventHandler(nuiService_UserExitedBounds);
            this.ToggleCommand = new RelayCommand(this.ExecuteToggleCommand);
            this.AutoPlayCommand = new RelayCommand(this.ExecuteAutoPlayCommand);
            this.ToggleKinectVisionCommand = new RelayCommand(this.ExecuteToggleKinectVisionCommand);
            this.MainBackgroundBrush = (Brush)Application.Current.Resources["DefaultBackground"];
            this.EngineeringBackgroundBrush = new SolidColorBrush(Color.FromArgb(255, 0, 49, 83));

            this.videoTimer = new DispatcherTimer();
            this.videoTimer.Interval = TimeSpan.FromMilliseconds(50);
            this.videoTimer.Tick += new EventHandler(videoTimer_Tick);
            this.videoTimer.Start();

            if (!IsInDesignMode)
            {
                Application.Current.MainWindow.SizeChanged += new SizeChangedEventHandler(MainWindow_SizeChanged);
            }
        }
Ejemplo n.º 7
0
        public override void BindToEntity(Entity source)
        {
            base.BindToEntity(source);
            if (!source.TryGetComponent(out camera))
            {
                throw new InvalidOperationException(string.Format("'{0}' does not contain a {1}", source.Name, camera.GetType()));
            }

            keyboardService = Services.GetService <IKeyboardService>();

            if (CameraBindings == null)
            {
                CameraBindings = new[]
                {
                    new KeyBinding(Keys.W, CameraAction.MoveForward, ButtonStateFlags.Down),
                    new KeyBinding(Keys.S, CameraAction.MoveBackward, ButtonStateFlags.Down),
                    new KeyBinding(Keys.A, CameraAction.StrafeLeft, ButtonStateFlags.Down),
                    new KeyBinding(Keys.D, CameraAction.StrafeRight, ButtonStateFlags.Down),
                    new KeyBinding(Keys.Q, CameraAction.HoverDown, ButtonStateFlags.Down),
                    new KeyBinding(Keys.E, CameraAction.HoverUp, ButtonStateFlags.Down),
                    new KeyBinding(Keys.Z, CameraAction.YawLeft, ButtonStateFlags.Down),
                    new KeyBinding(Keys.C, CameraAction.YawRight, ButtonStateFlags.Down)
                }
            }
            ;
        }
Ejemplo n.º 8
0
        public GestureService(IBackButtonService backService, IKeyboardService keyService)
        {
            Two.BackService = backService as IBackButtonService2;
            Two.BackService.BackRequested += (s, e) =>
            {
                BackRequested2?.Invoke(s, e);
                if (AllowBackRequested)
                {
                    BackRequested?.Invoke(s, e);
                }
            };

            Two.BackService.ForwardRequested += (s, e) =>
            {
                ForwardRequested2?.Invoke(s, e);
                if (AllowForwardRequested)
                {
                    ForwardRequested?.Invoke(s, e);
                }
            };

            Two.KeyService = keyService as IKeyboardService2;
            Two.KeyService.AfterSearchGesture += (s, e) => AfterSearchGesture?.Invoke(s, e);
            Two.KeyService.AfterMenuGesture   += (s, e) => AfterMenuGesture?.Invoke(s, e);
            Two.KeyService.AfterKeyDown       += (s, e) => AfterKeyDown?.Invoke(s, e);
        }
        public MainViewModel(IConfigurationService configService, INuiService nuiService, IKeyboardService keyboardService)
        {
            this.keyboardService               = keyboardService;
            this.keyboardService.KeyUp        += new EventHandler <KeyEventArgs>(keyboardService_KeyUp);
            this.configService                 = configService;
            this.nuiService                    = nuiService;
            this.nuiService.UserRaisedHand    += new EventHandler <HandRaisedEventArgs>(nuiService_UserRaisedHand);
            this.nuiService.UserEnteredBounds += new EventHandler(nuiService_UserEnteredBounds);
            this.nuiService.UserExitedBounds  += new EventHandler(nuiService_UserExitedBounds);
            this.ToggleCommand                 = new RelayCommand(this.ExecuteToggleCommand);
            this.AutoPlayCommand               = new RelayCommand(this.ExecuteAutoPlayCommand);
            this.ToggleKinectVisionCommand     = new RelayCommand(this.ExecuteToggleKinectVisionCommand);
            this.MainBackgroundBrush           = (Brush)Application.Current.Resources["DefaultBackground"];
            this.EngineeringBackgroundBrush    = new SolidColorBrush(Color.FromArgb(255, 0, 49, 83));

            this.videoTimer          = new DispatcherTimer();
            this.videoTimer.Interval = TimeSpan.FromMilliseconds(50);
            this.videoTimer.Tick    += new EventHandler(videoTimer_Tick);
            this.videoTimer.Start();

            if (!IsInDesignMode)
            {
                Application.Current.MainWindow.SizeChanged += new SizeChangedEventHandler(MainWindow_SizeChanged);
            }
        }
Ejemplo n.º 10
0
        void GetServices()
        {
            _viewModel = ServiceLocator.Current.GetInstance <MainPageFragmentViewModel>();

            _keyboardService = ServiceLocator.Current.GetInstance <IKeyboardService>();

            _messenger = GalaSoft.MvvmLight.Messaging.Messenger.Default;
        }
Ejemplo n.º 11
0
        public KeyboardPage()
        {
            InitializeComponent();
            _dialogService = Injector.Get <IDialogService>();

            _keyboardService = Injector.Get <IKeyboardService>();
            RegisterForKeyboard();
        }
Ejemplo n.º 12
0
		void GetServices ()
		{
			_viewModel = ServiceLocator.Current.GetInstance<MainPageFragmentViewModel>();

			_keyboardService = ServiceLocator.Current.GetInstance<IKeyboardService>();

			_messenger = GalaSoft.MvvmLight.Messaging.Messenger.Default;
		}
Ejemplo n.º 13
0
 public HomeViewModel(IKeyboardService keyboardService)
 {
     Keyboard   = keyboardService;
     Title      = "Using Dependency Injection";
     AddUser    = new Command(AddUserCommand);
     DeleteUser = new Command(DeleteUserCommand);
     UpdateUser = new Command(UpdateUserCommand);
 }
Ejemplo n.º 14
0
 public RegisterViewModel(
     IDialogService dialogService,
     IRegisterService registerService,
     IKeyboardService keyboardService)
 {
     this.dialogService   = dialogService;
     this.registerService = registerService;
     this.keyboardService = keyboardService;
 }
Ejemplo n.º 15
0
 public SurroundWithFeature(IServiceProvider serviceProvider, ILog log, IOptionsService optionsService,
                            IShellHelperService shellHelperService, IShellSelectionService shellSelectionService,
                            IFileTypeResolver fileTypeResolver, IKeyboardService keyboardService) : base(serviceProvider, log, optionsService)
 {
     _shellHelperService    = shellHelperService;
     _shellSelectionService = shellSelectionService;
     _fileTypeResolver      = fileTypeResolver;
     _keyboardService       = keyboardService;
 }
Ejemplo n.º 16
0
 public void Start(IEnumerable<Entity> entities, Vector2 worldMousePosition)
 {
     _keyboard = _keyboard ?? ServiceLocator.Instance.GetService<IKeyboardService>();
     _origin = worldMousePosition;
     _initialTransforms = entities.ToDictionary(e => e, e => e.GetComponent<Transform>().Clone());
     _entities = entities.ToArray();
     _centroid = _entities.Aggregate(Vector2.Zero, (current, input) => current + input.GetComponent<Transform>().Position) / _entities.Length;
     _originToCentroidOffset = _origin - _centroid;
 }
Ejemplo n.º 17
0
        public override void BindToEntity(Entity source)
        {
            base.BindToEntity(source);
            pointerService = Services.GetService <IPointerService>();
            var deviceSettings = Services.GetService <IDirectXDeviceSettings>();

            ScreenSize      = new Vector2(deviceSettings.PreferredBackBufferWidth, deviceSettings.PreferredBackBufferHeight);
            keyboardService = Services.GetService <IKeyboardService>();
        }
Ejemplo n.º 18
0
        public BaseContentPage()
        {
            keyboardService = DependencyService.Get <IKeyboardService>();
            logService      = DependencyService.Get <ILogService>();

            On <Xamarin.Forms.PlatformConfiguration.iOS>().SetUseSafeArea(true);

            this.WhenActivated(d => DefineBindings(d));
        }
Ejemplo n.º 19
0
 public MainViewModel(IPresetStorage presetStorage, IPresetService presetService,
                      IKeyboardService keyboardService)
 {
     _presets         = new ObservableCollection <RunConfiguration>();
     _presetStorage   = presetStorage;
     _presetService   = presetService;
     _keyboardService = keyboardService;
     SetDefaultConfiguration();
     _presetService.SharedPresetCollection.CollectionChanged += CollectionChanged;
 }
 public SettingsService(ITelegramBotClient telegramBotClient,
                        IKeyboardService keyboardService,
                        ISubscriberService subscriberService,
                        ISubscriberSettingsService subscriberSettingsService)
 {
     this._telegramBotClient         = telegramBotClient;
     this._keyboardService           = keyboardService;
     this._subscriberService         = subscriberService;
     this._subscriberSettingsService = subscriberSettingsService;
 }
 public WebhookHandlerService(ICommandService commandService,
                              ISubscriberService subscriberService,
                              IMapper mapper,
                              IKeyboardService keyboardService)
 {
     this._commandService    = commandService;
     this._subscriberService = subscriberService;
     this._mapper            = mapper;
     this._keyboardService   = keyboardService;
 }
Ejemplo n.º 22
0
        public LockingService(IMediator mediator,
                              IMouseService mouseService,
                              IKeyboardService keyboardService,
                              ApplicationConfiguration applicationConfiguration)
        {
            mediator.RegisterAsync <FaceDetectionResult>(this, FaceDetectionResultHandler);
            _mouseService    = mouseService;
            _keyboardService = keyboardService;

            SystemEvents.SessionSwitch += SystemEvents_SessionSwitch;
            _applicationConfiguration   = applicationConfiguration;
        }
Ejemplo n.º 23
0
 public VoteService(
     ISendMessageService sendMessageService,
     IKeyboardService keyboardService,
     IVoteTextHelper voteTextHelper,
     IVoteRepository voteRepository,
     IRemoveTrackService removeTrackService)
 {
     _sendMessageService = sendMessageService;
     _keyboardService    = keyboardService;
     _voteTextHelper     = voteTextHelper;
     _voteRepository     = voteRepository;
     _removeTrackService = removeTrackService;
 }
Ejemplo n.º 24
0
        public KeyboardOrchestratorBackgroundService(IKeyboardService keyboardService, ILogger <KeyboardOrchestratorBackgroundService> logger)
        {
            _keyboardService = keyboardService;
            _logger          = logger;
            _logger.LogInformation("Starting...");
            var process = Process.GetProcessesByName(_processName);

            if (process.Any())
            {
                _logger.LogInformation($"Found Processor... {_processName}");
                _processor = process.First();
            }
        }
Ejemplo n.º 25
0
        public OutputService(
            IKeyboardService keyboardService,
            ISuggestionStateService suggestionService,
            IPublishService publishService,
            IDictionaryService dictionaryService)
        {
            this.keyboardService = keyboardService;
            this.suggestionService = suggestionService;
            this.publishService = publishService;
            this.dictionaryService = dictionaryService;

            ReactToPublishingStateChanges();
            ReactToPublishableKeyDownStateChanges();
        }
Ejemplo n.º 26
0
 public LogInControlViewModel(
     IPreferencesService preferencesService,
     ILoggingService loggingService,
     IDialogService dialogService,
     IRefitService refitService,
     ITaskHelperFactory taskHelperFactory,
     IKeyboardService keyboardService)
 {
     this.authApi            = refitService.InitRefitInstance <IAuthApi>();
     this.preferencesService = preferencesService;
     this.loggingService     = loggingService;
     this.dialogService      = dialogService;
     this.taskHelperFactory  = taskHelperFactory;
     this.keyboardService    = keyboardService;
 }
Ejemplo n.º 27
0
    public LogInViewModel(
        ILogInService logInService,
        IDialogService dialogService,
        IKeyboardService keyboardService,
        IHelpYouService helpYouService)
    {
        this.logInService    = logInService;
        this.dialogService   = dialogService;
        this.keyboardService = keyboardService;
        this.helpYouService  = helpYouService;

        CallUsCommand       = new AsyncCommand(() => CallUsCommandd());
        DoLoginCommand      = new AsyncCommand(() => DoLoginCommandAsync());
        GoToRegisterCommand = new AsyncCommand(() => GoToRegisterCommandAsync());
    }
Ejemplo n.º 28
0
 public VkUpdateController(
     IVkGroupMessageService vkGroupMessageService,
     IConfigurationHelperService configurationHelper,
     IStickerService stickerService,
     IEmojiService emojiService,
     IKeyboardService keyboardService,
     IBotUserService botUserService,
     IReceivedMessageService receivedMessageService)
 {
     _vkGroupMessageService  = vkGroupMessageService;
     _configurationHelper    = configurationHelper;
     _stickerService         = stickerService;
     _emojiService           = emojiService;
     _keyboardService        = keyboardService;
     _botUserService         = botUserService;
     _receivedMessageService = receivedMessageService;
 }
Ejemplo n.º 29
0
 public AddTrackService(
     ISendMessageService sendMessageService,
     ISpotifyLinkHelper spotifyTextHelper,
     ISuccessResponseService successResponseService,
     ISpotifyClientFactory spotifyClientFactory,
     ISpotifyClientService spotifyClientService,
     ITrackRepository trackRepository,
     IKeyboardService keyboardService)
 {
     _sendMessageService     = sendMessageService;
     _spotifyLinkHelper      = spotifyTextHelper;
     _successResponseService = successResponseService;
     _spotifyClientFactory   = spotifyClientFactory;
     _spotifyClientService   = spotifyClientService;
     _trackRepository        = trackRepository;
     _keyboardService        = keyboardService;
 }
Ejemplo n.º 30
0
        public GuiService()
        {
            _graphics = ServiceLocator.Instance.GetService<GraphicsDevice>();
            _timer = ServiceLocator.Instance.GetService<ITimerService>();
            _keyboard = ServiceLocator.Instance.GetService<IKeyboardService>();
            _mouse = ServiceLocator.Instance.GetService<IMouseService>();
            _renderInterface = new Gui.LibRocketRenderInterface(_graphics, ServiceLocator.Instance.GetService<ContentManager>(), true);
            _coroutines = ServiceLocator.Instance.GetService<ICoroutineService>();

            LibRocketNet.Core.SystemInterface = new Gui.LibRocketSystemInterface(_timer);
            LibRocketNet.Core.RenderInterface = _renderInterface;
            LibRocketNet.Core.Initialize();
            LibRocketNet.Core.ScriptEvent += (o, e) =>
            {
                Console.WriteLine("[Gui] Script event:" + e.Script);
            };

            Context = LibRocketNet.Core.CreateContext(
                ContextName,
                new Vector2i(_graphics.Viewport.Width, _graphics.Viewport.Height));

            LoadFonts();
            LibRocketNet.Core.InitDebugger(Context);

            _keyboard.KeyDown += KeyDownHandler;
            _keyboard.KeyUp += KeyUpHandler;
            _mouse.ButtonDown += (o, e) => {
                Context.ProcessMouseButtonDown(e, GetKeyModifiers());
            };
            _mouse.ButtonUp +=
                (o, e) => Context.ProcessMouseButtonUp(e, GetKeyModifiers());

            _mouse.WheelChanged += (w) =>
            {
                Context.ProcessMouseWheel(-w, GetKeyModifiers());
            };
            _mouse.Move += ProcessMouseMove;

            _coroutines.StartCoroutine(UpdateUI());
        }
Ejemplo n.º 31
0
        public MainViewModel(
            IAudioService audioService,
            ICalibrationService calibrationService,
            IDictionaryService dictionaryService,
            IKeyboardService keyboardService,
            ISuggestionStateService suggestionService,
            ICapturingStateManager capturingStateManager,
            ILastMouseActionStateManager lastMouseActionStateManager,
            IInputService inputService,
            IOutputService outputService,
            IWindowManipulationService mainWindowManipulationService,
            List<INotifyErrors> errorNotifyingServices)
        {
            Log.Debug("Ctor called.");

            this.audioService = audioService;
            this.calibrationService = calibrationService;
            this.dictionaryService = dictionaryService;
            this.keyboardService = keyboardService;
            this.suggestionService = suggestionService;
            this.capturingStateManager = capturingStateManager;
            this.lastMouseActionStateManager = lastMouseActionStateManager;
            this.inputService = inputService;
            this.outputService = outputService;
            this.mainWindowManipulationService = mainWindowManipulationService;
            this.errorNotifyingServices = errorNotifyingServices;

            calibrateRequest = new InteractionRequest<NotificationWithCalibrationResult>();

            SelectionMode = SelectionModes.Key;
            Keyboard = new Alpha();

            SelectKeyboardOnKeyboardSetChanges();
            AttachScratchpadEnabledListener();

            HandleFunctionKeySelectionResult(KeyValues.LeftShiftKey); //Set initial shift state to on
        }
Ejemplo n.º 32
0
        public InputService(
            IKeyboardService keyboardService,
            IDictionaryService dictionaryService,
            IAudioService audioService,
            ICapturingStateManager capturingStateManager,
            IPointSource pointSource,
            ITriggerSource keySelectionTriggerSource,
            ITriggerSource pointSelectionTriggerSource)
        {
            this.keyboardService = keyboardService;
            this.dictionaryService = dictionaryService;
            this.audioService = audioService;
            this.capturingStateManager = capturingStateManager;
            this.pointSource = pointSource;
            this.keySelectionTriggerSource = keySelectionTriggerSource;
            this.pointSelectionTriggerSource = pointSelectionTriggerSource;

            //Fixation key triggers also need the enabled state info
            var fixationTrigger = keySelectionTriggerSource as IFixationTriggerSource;
            if (fixationTrigger != null)
            {
                fixationTrigger.KeyEnabledStates = keyboardService.KeyEnabledStates;
            }
        }
Ejemplo n.º 33
0
 public ViewController(IntPtr handle) : base(handle)
 {
     _keyboardService = new KeyboardService();
 }
Ejemplo n.º 34
0
 public GameManager(IKeyboardService keyboardService)
 {
     this.keyboardService = keyboardService;
 }
Ejemplo n.º 35
0
 public RepeaterBackgroundService(RepeaterSettings settings, ILogger <RepeaterBackgroundService> logger, IKeyboardService keyboard)
 {
     _settings = settings;
     _logger   = logger;
     _keyboard = keyboard;
 }
Ejemplo n.º 36
0
 public PlayerShipControlSystem()
     : base(PlayerShipTag)
 {
     _mouse = ServiceLocator.Instance.GetService<IMouseService>();
     _keyboard = ServiceLocator.Instance.GetService<IKeyboardService>();
 }
Ejemplo n.º 37
0
 internal BackButtonService(IKeyboardService keyboardService)
 {
     _keyboardService = keyboardService as IKeyboardService2;
 }
Ejemplo n.º 38
0
        public override void Initialize()
        {
            base.Initialize();

            _keyboard = Services.GetService<IKeyboardService>();
        }
Ejemplo n.º 39
0
 public BackButtonService(IKeyboardService keyboardService)
 {
     _keyboardService = keyboardService as IKeyboardService2;
 }
Ejemplo n.º 40
0
 public MessageService(VkApi vkApi, IKeyboardService keyboards, ILogger <MessageService> logger)
 {
     _looger    = logger;
     _vkApi     = vkApi;
     _keyboards = keyboards;
 }
Ejemplo n.º 41
0
 public GameUpdateService(IKeyboardService keyboardService, IStatsService statsService, IWorldController worldController)
 {
     KeyboardService = keyboardService;
     StatsService    = statsService;
     WorldController = worldController;
 }
Ejemplo n.º 42
0
        private IInputService CreateInputService(
            IKeyboardService keyboardService,
            IDictionaryService dictionaryService,
            IAudioService audioService,
            ICalibrationService calibrationService,
            ICapturingStateManager capturingStateManager,
            List<INotifyErrors> errorNotifyingServices)
        {
            Log.Debug("Creating InputService.");

            //Instantiate point source
            IPointSource pointSource;
            switch (Settings.Default.PointsSource)
            {
                case PointsSources.GazeTracker:
                    pointSource = new GazeTrackerSource(
                        Settings.Default.PointTtl,
                        Settings.Default.GazeTrackerUdpPort,
                        new Regex(Settings.Default.GazeTrackerUdpRegex));
                    break;

                case PointsSources.TheEyeTribe:
                    var theEyeTribePointService = new TheEyeTribePointService();
                    errorNotifyingServices.Add(theEyeTribePointService);
                    pointSource = new PointServiceSource(
                        Settings.Default.PointTtl,
                        theEyeTribePointService);
                    break;

                case PointsSources.TobiiEyeX:
                case PointsSources.TobiiRex:
                    var tobiiEyeXPointService = new TobiiEyeXPointService();
                    var tobiiEyeXCalibrationService = calibrationService as TobiiEyeXCalibrationService;
                    if (tobiiEyeXCalibrationService != null)
                    {
                        tobiiEyeXCalibrationService.EyeXHost = tobiiEyeXPointService.EyeXHost;
                    }
                    errorNotifyingServices.Add(tobiiEyeXPointService);
                    pointSource = new PointServiceSource(
                        Settings.Default.PointTtl,
                        tobiiEyeXPointService);
                    break;

                case PointsSources.MousePosition:
                    pointSource = new MousePositionSource(
                        Settings.Default.PointTtl);
                    break;

                default:
                    throw new ArgumentException("'PointsSource' settings is missing or not recognised! Please correct and restart OptiKey.");
            }

            //Instantiate key trigger source
            ITriggerSource keySelectionTriggerSource;
            switch (Settings.Default.KeySelectionTriggerSource)
            {
                case TriggerSources.Fixations:
                    keySelectionTriggerSource = new KeyFixationSource(
                       Settings.Default.KeySelectionTriggerFixationLockOnTime,
                       Settings.Default.KeySelectionTriggerFixationCompleteTime,
                       Settings.Default.KeySelectionTriggerIncompleteFixationTtl,
                       pointSource.Sequence);
                    break;

                case TriggerSources.KeyboardKeyDownsUps:
                    keySelectionTriggerSource = new KeyboardKeyDownUpSource(
                        Settings.Default.KeySelectionTriggerKeyboardKeyDownUpKey,
                        pointSource.Sequence);
                    break;

                case TriggerSources.MouseButtonDownUps:
                    keySelectionTriggerSource = new MouseButtonDownUpSource(
                        Settings.Default.KeySelectionTriggerMouseDownUpButton,
                        pointSource.Sequence);
                    break;

                default:
                    throw new ArgumentException(
                        "'KeySelectionTriggerSource' setting is missing or not recognised! Please correct and restart OptiKey.");
            }

            //Instantiate point trigger source
            ITriggerSource pointSelectionTriggerSource;
            switch (Settings.Default.PointSelectionTriggerSource)
            {
                case TriggerSources.Fixations:
                    pointSelectionTriggerSource = new PointFixationSource(
                        Settings.Default.PointSelectionTriggerFixationLockOnTime,
                        Settings.Default.PointSelectionTriggerFixationCompleteTime,
                        Settings.Default.PointSelectionTriggerLockOnRadiusInPixels,
                        Settings.Default.PointSelectionTriggerFixationRadiusInPixels,
                        pointSource.Sequence);
                    break;

                case TriggerSources.KeyboardKeyDownsUps:
                    pointSelectionTriggerSource = new KeyboardKeyDownUpSource(
                        Settings.Default.PointSelectionTriggerKeyboardKeyDownUpKey,
                        pointSource.Sequence);
                    break;

                case TriggerSources.MouseButtonDownUps:
                    pointSelectionTriggerSource = new MouseButtonDownUpSource(
                        Settings.Default.PointSelectionTriggerMouseDownUpButton,
                        pointSource.Sequence);
                    break;

                default:
                    throw new ArgumentException(
                        "'PointSelectionTriggerSource' setting is missing or not recognised! "
                        + "Please correct and restart OptiKey.");
            }

            return new InputService(keyboardService, dictionaryService, audioService, capturingStateManager,
                pointSource, keySelectionTriggerSource, pointSelectionTriggerSource)
            {
                State = RunningStates.Paused //Instantiate the InputService and immediately set to paused
            };
        }
Ejemplo n.º 43
0
 private void ReleaseKeysOnApplicationExit(IKeyboardService keyboardService, IPublishService publishService)
 {
     Application.Current.Exit += (o, args) =>
     {
         if (keyboardService.KeyDownStates[KeyValues.SimulateKeyStrokesKey].Value.IsDownOrLockedDown())
         {
             publishService.ReleaseAllDownKeys();
         }
     };
 }