public NavigationPresenter(INavigationView view, ISettingsSerializer settingsSerializer, IKeyboardListener keyboardListener, IMatchModelMapper matchModelMapper, IPresentationService presentationService, INavigationServiceBuilder navigationServiceBuilder) { _view = view; _settingsSerializer = settingsSerializer; _keyboardListener = keyboardListener; _matchModelMapper = matchModelMapper; _navigationServiceBuilder = navigationServiceBuilder; _presentationService = presentationService; Settings settings = _settingsSerializer.Deserialize(); _keyboardListener.KeyCombinationPressed += GlobalKeyCombinationPressed; _keyboardListener.StartListening(settings.GlobalKeyCombination); _view.CurrentSettings = settings; _view.ShowMatches(new List<MatchModel> {new MatchModel(_matchModelMapper, Resources.InitialMatchesMessage)}); _view.ShowInitializingScreen = true; //Initialize navigation service asynchronously, as it may require a long operation (file system parsing). //Clone settings to avoid any coupling Settings settingsCopy = settings.Clone() as Settings; InitializeDelegate initialize = Initialize; initialize.BeginInvoke(settingsCopy, EndInitialize, initialize); }
public ConfigurationViewModel(IMouseListener mouseListener, IKeyboardListener keyboardListener) { this.ScreenElements = MacroData.Current.ScreenElements; this._mouseListener = mouseListener; this._keyboardListener = keyboardListener; _mouseListener.MouseMove += OnMouseMove; _keyboardListener.KeyUp += OnKeyUp; this.SelectedScreenElement = this.ScreenElements.FirstOrDefault(); this.HelpInfo = new StringBuilder() .AppendLine("Keyboard Shortcuts") .AppendLine("F1: \tSelect previous screen element") .AppendLine("F2: \tAssign current mouse position to selected screen element") .AppendLine("F3: \tSelect next screen element") .AppendLine() .AppendLine("Screen Elements") .AppendLine("Jet Bay 1 - 8: \t\tpositions to select each jet bay") .AppendLine("Hero Slot 1 - 5: \t\tpositions to select heroes in the Deploy screen") .AppendLine("Prev/Next Hero Page: \tthe left/right arrows on the Deploy screen") .AppendLine("Confirm Button: \t\tthe big Confirm button on the Deploy screen") .AppendLine("Collect All: \t\tthe Collect All button to collect when deploys are over.\r\nNote: this is assumed to become visible by clicking Jet Bay 1") .ToString(); }
private MessagePreviewResult NotifyListener(IKeyboardListener listener, Control target, Message msg) { MessagePreviewResult result = MessagePreviewResult.NotProcessed; Keys keyData; switch (msg.Msg) { case NativeMethods.WM_KEYDOWN: case NativeMethods.WM_SYSKEYDOWN: keyData = ((Keys)((int)((long)msg.WParam))) | Control.ModifierKeys; result = listener.OnPreviewKeyDown(target, new KeyEventArgs(keyData)); break; case NativeMethods.WM_CHAR: case NativeMethods.WM_SYSCHAR: KeyPressEventArgs e = new KeyPressEventArgs((char)((ushort)((long)msg.WParam))); result = listener.OnPreviewKeyPress(target, e); break; case NativeMethods.WM_KEYUP: case NativeMethods.WM_SYSKEYUP: keyData = ((Keys)((int)((long)msg.WParam))) | Control.ModifierKeys; result = listener.OnPreviewKeyUp(target, new KeyEventArgs(keyData)); break; } return(result); }
/// <summary> /// Adds the given tool. /// </summary> /// <param name="tool">The tool.</param> public void AddTool(ITool tool) { tool.Controller = this; //add the tool to the collection even if it doesn't attach to anything (yet) registeredTools.Add(tool); IMouseListener mouseTool = null; if ((mouseTool = tool as IMouseListener) != null) { mouseListeners.Add(mouseTool); } IKeyboardListener keyboardTool = null; if ((keyboardTool = tool as IKeyboardListener) != null) { keyboardListeners.Add(keyboardTool); } IDragDropListener dragdropTool = null; if ((dragdropTool = tool as IDragDropListener) != null) { dragdropListeners.Add(dragdropTool); } }
public void RemoveTool(ITool tool) { if (tool == null) { return; } tool.Controller = null; registeredTools.Remove(tool); IMouseListener mouseTool = tool as IMouseListener; if (mouseTool != null) { mouseListeners.Remove(mouseTool); } IKeyboardListener keyboardTool = tool as IKeyboardListener; if (keyboardTool != null) { keyboardListeners.Remove(keyboardTool); } IDragDropListener dragdropTool = tool as IDragDropListener; if (dragdropTool != null) { dragdropListeners.Remove(dragdropTool); } tool.OnToolActivate -= new EventHandler <ToolEventArgs>(AddedTool_OnToolActivate); tool.OnToolDeactivate -= new EventHandler <ToolEventArgs>(AddedTool_OnToolDeactivate); }
public NavigationPresenter(INavigationView view, ISettingsSerializer settingsSerializer, IKeyboardListener keyboardListener, IMatchModelMapper matchModelMapper, IPresentationService presentationService, INavigationServiceBuilder navigationServiceBuilder) { _view = view; _settingsSerializer = settingsSerializer; _keyboardListener = keyboardListener; _matchModelMapper = matchModelMapper; _navigationServiceBuilder = navigationServiceBuilder; _presentationService = presentationService; Settings settings = _settingsSerializer.Deserialize(); _keyboardListener.KeyCombinationPressed += GlobalKeyCombinationPressed; _keyboardListener.StartListening(settings.GlobalKeyCombination); _view.CurrentSettings = settings; _view.ShowMatches(new List <MatchModel> { new MatchModel(_matchModelMapper, Resources.InitialMatchesMessage) }); _view.ShowInitializingScreen = true; //Initialize navigation service asynchronously, as it may require a long operation (file system parsing). //Clone settings to avoid any coupling Settings settingsCopy = settings.Clone() as Settings; InitializeDelegate initialize = Initialize; initialize.BeginInvoke(settingsCopy, EndInitialize, initialize); }
private MessagePreviewResult NotifyListener( IKeyboardListener listener, Control target, Message msg) { MessagePreviewResult messagePreviewResult = MessagePreviewResult.NotProcessed; switch (msg.Msg) { case 256: case 260: Keys keyData1 = (Keys)(long)msg.WParam | Control.ModifierKeys; messagePreviewResult = listener.OnPreviewKeyDown(target, new KeyEventArgs(keyData1)); break; case 257: case 261: Keys keyData2 = (Keys)(long)msg.WParam | Control.ModifierKeys; messagePreviewResult = listener.OnPreviewKeyUp(target, new KeyEventArgs(keyData2)); break; case 258: case 262: KeyPressEventArgs e = new KeyPressEventArgs((char)(long)msg.WParam); messagePreviewResult = listener.OnPreviewKeyPress(target, e); break; } return(messagePreviewResult); }
/// <summary> /// Sets the element that will receive key events /// </summary> /// <param name="element">element.</param> public void SetKeyboardFocus(IKeyboardListener element) { // clean up if we are removing focus if (element == null) { _lastPressedKeys = _emptyKeys; ClearKeyRepeatTimer(); } if (_keyboardFocusElement == element) { return; } var oldKeyboardFocus = _keyboardFocusElement; if (oldKeyboardFocus != null) { oldKeyboardFocus.LostFocus(); } _keyboardFocusElement = element; if (_keyboardFocusElement != null) { _keyboardFocusElement.GainedFocus(); } }
public void AddListener(IKeyboardListener listener) { if (!this.ContainsListener(listener)) { this.listeners.Add(listener); this.UpdateHook(); } }
public MainVM(IKeyboardListener kbListener, ITextFetcher textFetcher, IDataServiceFacade dataServiceFacade) { _kbListener = kbListener; _textFetcher = textFetcher; _dataServiceFacade = dataServiceFacade; _kbListener.MagicCombinationPressed += _kbListener_MagicCombinationPressed; }
public void RemoveListener(IKeyboardListener listener) { int index = this.listeners.IndexOf(listener); if (index >= 0) { this.listeners.RemoveAt(index); this.UpdateHook(); } }
protected BaseShotter() { try { _keyboard = KeyboardListenerFactory.Get(); _keyboard.WatchFor(Keys.Escape); _keyboard.KeyUp += OnKeyUp; } catch (Exception e) { AcToolsLogging.Write("Can’t set listener: " + e); } }
public BMBApplication( IProcessListener processListener, IProcessHandler processHandler, IKeyboardListener keyboardListener, IKeyboardHandler keyboardHandler) { this.processListener = processListener; this.processHandler = processHandler; this.keyboardListener = keyboardListener; this.keyboardHandler = keyboardHandler; }
public MemoryListener() { try { _keyboard = KeyboardListenerFactory.Get(); _keyboard.WatchFor(Keys.Escape); _keyboard.PreviewKeyDown += OnKeyDown; _keyboard.PreviewKeyUp += OnKeyUp; } catch (Exception e) { Logging.Error(e); } }
public HUDKeyboard ShowKeyboard(IKeyboardListener reciever) { if (_keyboard != null) { HideKeyboard(); } _keyboard = new HUDKeyboard(reciever); AddModal(_keyboard, true); return(_keyboard); }
public MemoryListener(CancellationTokenSource sharedCancellationTokenSource) { _sharedCancellationTokenSource = sharedCancellationTokenSource; try { _keyboard = KeyboardListenerFactory.Get(); _keyboard.WatchFor(Keys.Escape); _keyboard.KeyUp += OnKeyUp; } catch (Exception e) { Logging.Error(e); } AcSharedMemory.Instance.Start += OnStart; }
public KeyboardManager( IEventBroker <ClickerEventArgs> eventBroker, IFsm <ClickerEventArgs> fsm, IKeyboardListener keyboardListener ) { _eventBroker = eventBroker; _fsm = fsm; _keyboardListener = keyboardListener; _handler = new RawKeyEventHandler(OnKeyDown); //_hnd = GCHandle.Alloc(_keyboardListener); }
public void Show(UIView parent, CGPoint position) { _keyboardListener = parent as IKeyboardListener; _keyboardListener?.Pause(); Application.Instance.RegisterSchemeForEditMode(_scheme); Application.Instance.RegisterSchemeForViewMode(_scheme); var suggestionsSize = _suggestionsView.ChangeWidthAndLayout((float)parent.Frame.Width / 3f); Frame = new CGRect(position, suggestionsSize); parent.Add(this); }
public static void AddKeyboardListener([NotNull] IKeyboardListener listener) => KeyboardListeners.Add(listener);
public static async Task <Result> StartAsync(IAcsStarter starter, StartProperties properties, IProgress <ProgressState> progress = null, CancellationToken cancellation = default(CancellationToken)) { if (_busy) { return(null); } _busy = true; if (OptionDebugMode) { progress?.Report(ProgressState.Waiting); await Task.Delay(500, cancellation); _busy = false; return(GetResult(DateTime.MinValue)); } RemoveResultJson(); IKeyboardListener listener = null; if (properties.SetKeyboardListener) { try { listener = KeyboardListenerFactory.Get(); listener.Subscribe(); } catch (Exception e) { AcToolsLogging.Write("Can’t set listener: " + e); } } var start = DateTime.Now; try { progress?.Report(ProgressState.Preparing); await Task.Run(() => properties.Set(), cancellation); if (cancellation.IsCancellationRequested || OptionRaceIniTestMode) { return(null); } progress?.Report(ProgressState.Launching); await starter.RunAsync(cancellation); if (cancellation.IsCancellationRequested) { return(null); } var process = await starter.WaitUntilGameAsync(cancellation); await Task.Run(() => properties.SetGame(process), cancellation); if (cancellation.IsCancellationRequested) { return(null); } progress?.Report(ProgressState.Waiting); await starter.WaitGameAsync(cancellation); if (cancellation.IsCancellationRequested) { return(null); } } finally { _busy = false; if (cancellation.IsCancellationRequested) { starter.CleanUp(); } else { progress?.Report(ProgressState.Finishing); await starter.CleanUpAsync(cancellation); } properties.RevertChanges(); listener?.Dispose(); } return(GetResult(start)); }
public void SetUp() { _keyboardListener = new KeyboardListener(); _keyboardListener.KeyCombinationPressed += HandleKeyCombinationPressed; _keyPressHandled = false; }
public static void RemoveKeyboardListener([NotNull] IKeyboardListener listener) => KeyboardListeners.Remove(listener);
public bool ContainsListener(IKeyboardListener listener) { return(this.listeners.IndexOf(listener) >= 0); }
/// <summary> /// Subscribe an keyboard listener /// </summary> /// <param name="listener"></param> public void SubscribeKeyboardListener(IKeyboardListener listener) { // Subscribe passed keyboard listener to the input manager _inputManager.AddListener((listener).OnNewKeyboardInput); }
public void Add(IKeyboardListener listener) { simple.Enter(); subscribers.Add(listener); simple.Exit(); }
public void Remove(IKeyboardListener listener) { simple.Enter(); subscribers.Remove(listener); simple.Exit(); }
public HUDKeyboard(IKeyboardListener owner, int depth = 0) { Focusable = false; Depth = depth; _owner = owner; }
/// <summary> /// Subscrible a keyboard listener /// </summary> /// <param name="pListener"></param> public void SubscribeListener(IKeyboardListener pListener) { inputManager.AddListener(pListener.OnNewKeyboardInput); }