コード例 #1
0
ファイル: Button.cs プロジェクト: VladCananau/PowerArgs
 private void OnKeyInputReceived(ConsoleKeyInfo info)
 {
     if (info.Key == ConsoleKey.Enter || info.Key == ConsoleKey.Spacebar)
     {
         Pressed.Fire();
     }
 }
コード例 #2
0
ファイル: Button.cs プロジェクト: VladCananau/PowerArgs
 private void RegisterShortcutIfPossibleAndNotAlreadyDone()
 {
     if (Shortcut != null && shortcutRegistered == false && Application != null)
     {
         shortcutRegistered = true;
         Application.FocusManager.GlobalKeyHandlers.PushForLifetime(Shortcut.Key, Shortcut.Modifier, () =>
         {
             if (this.CanFocus)
             {
                 Pressed.Fire();
             }
         }, this);
     }
 }
コード例 #3
0
 private void Click()
 {
     Pressed.Fire();
 }