public void OnClick(TextControlMouseEventArgs args) { var oldLocation = _currentLocation; var newLocation = _currentLocation = _navigationUtils.GetLocation(args.TextControl); var ctrlIsPressed = args.KeysAndButtons == KeyStateMasks.MK_CONTROL; if (ctrlIsPressed) { var ctrlClickEvent = Create <NavigationEvent>(); ctrlClickEvent.Target = _navigationUtils.GetTarget(args.TextControl); ctrlClickEvent.Location = newLocation; ctrlClickEvent.TypeOfNavigation = NavigationType.CtrlClick; ctrlClickEvent.TriggeredBy = EventTrigger.Click; _currentLocation = ctrlClickEvent.Target; Fire(ctrlClickEvent); } else if (IsNewLocation(oldLocation, newLocation)) { var clickNavigationEvent = Create <NavigationEvent>(); clickNavigationEvent.Location = newLocation; clickNavigationEvent.TypeOfNavigation = NavigationType.Click; clickNavigationEvent.TriggeredBy = EventTrigger.Click; Fire(clickNavigationEvent); } }
public void OnKeyPress(EventArgs <ITextControl> args) { var oldLocation = _currentLocation; _navigationUtils.GetLocation( args.Value, curLocation => { var newLocation = _currentLocation = curLocation; if (!IsNewLocation(oldLocation, newLocation)) { return; } var keyboardNavigationEvent = Create <NavigationEvent>(); keyboardNavigationEvent.Location = newLocation; keyboardNavigationEvent.TypeOfNavigation = NavigationType.Keyboard; keyboardNavigationEvent.TriggeredBy = EventTrigger.Typing; Fire(keyboardNavigationEvent); }); }