private void onTextBoxKeyPressed(object sender, TextBoxKeyPressingEventArgs args) { if (args.PressedKey != Key.Enter) return; args.ShouldCancel = true; string path = _fileTextBox.Text; if (Hooks.FileSystem.DirectoryExists(path)) fillAllFiles(path); else if (Hooks.FileSystem.FileExists(path)) { onFileSelected(path); } }
private void onKeyDown(object sender, KeyboardEventArgs args) { if (args.Key == Key.ShiftLeft) { _leftShiftOn = true; return; } if (args.Key == Key.ShiftRight) { _rightShiftOn = true; return; } if (!IsFocused) return; TextBoxKeyPressingEventArgs pressingArgs = new TextBoxKeyPressingEventArgs(args.Key); OnPressingKey.Invoke(this, pressingArgs); if (pressingArgs.ShouldCancel) return; processKey(args.Key); }