-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Packet viewer] Added creature text as a database diff processor
- Loading branch information
Showing
8 changed files
with
239 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using System; | ||
using System.Windows.Input; | ||
using Avalonia; | ||
using Avalonia.Controls; | ||
using Avalonia.Input; | ||
|
||
namespace WDE.Common.Avalonia.Controls | ||
{ | ||
/*** | ||
* This is KeyBinding that forwards the gesture to the focused TextBox first | ||
*/ | ||
public class BetterKeyBinding : KeyBinding, ICommand | ||
{ | ||
public static readonly StyledProperty<ICommand> CustomCommandProperty = AvaloniaProperty.Register<KeyBinding, ICommand>(nameof (CustomCommand)); | ||
|
||
public ICommand CustomCommand | ||
{ | ||
get => GetValue(CustomCommandProperty); | ||
set => SetValue(CustomCommandProperty, value); | ||
} | ||
|
||
public BetterKeyBinding() | ||
{ | ||
Command = this; | ||
} | ||
|
||
public bool CanExecute(object? parameter) | ||
{ | ||
return CustomCommand.CanExecute(parameter); | ||
} | ||
|
||
public void Execute(object? parameter) | ||
{ | ||
if (FocusManager.Instance.Current is TextBox tb) | ||
{ | ||
var ev = new KeyEventArgs() | ||
{ | ||
Key = Gesture.Key, | ||
KeyModifiers = Gesture.KeyModifiers, | ||
RoutedEvent = InputElement.KeyDownEvent | ||
}; | ||
tb.RaiseEvent(ev); | ||
if (!ev.Handled) | ||
CustomCommand.Execute(parameter); | ||
} | ||
else | ||
CustomCommand.Execute(parameter); | ||
} | ||
|
||
public event EventHandler? CanExecuteChanged | ||
{ | ||
add => CustomCommand.CanExecuteChanged += value; | ||
remove => CustomCommand.CanExecuteChanged -= value; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.