void inputHelper_KeyPressed(object sender, KeyEventArgs e) { if(e.Code == Key.Tab) { // focus switch int step = e.Shift ? -1 : 1; int index = actors.IndexOf(focusedActor); for(int i = index + step; i != index; i += step) { if(i >= actors.Count) i = 0; else if(i < 0) i = actors.Count - 1; IFocusable focusableActor = actors[i] as IFocusable; if (focusableActor != null) { if (focusableActor.CanAcquireFocus) { if(this.focusedActor != null) (this.focusedActor as IFocusable).HasFocus = false; this.focusedActor = actors[i]; focusableActor.HasFocus = true; break; } } } return; } HandleKeyPressed(e); }
public override void HandleKeyPressed(KeyEventArgs e) { base.HandleKeyPressed(e); }
void inputHelper_KeyReleased(object sender, KeyEventArgs e) { HandleKeyReleased(e); }