mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-04-28 18:15:47 +02:00
38 lines
996 B
C#
38 lines
996 B
C#
using System.Windows.Forms;
|
|
using CefSharp;
|
|
using TweetDuck.Browser.Notification;
|
|
using TweetDuck.Controls;
|
|
|
|
namespace TweetDuck.Browser.Handling {
|
|
sealed class KeyboardHandlerNotification : KeyboardHandlerBase {
|
|
private readonly FormNotificationBase notification;
|
|
|
|
public KeyboardHandlerNotification(FormNotificationBase notification) {
|
|
this.notification = notification;
|
|
}
|
|
|
|
protected override bool HandleRawKey(IWebBrowser browserControl, Keys key, CefEventFlags modifiers) {
|
|
if (base.HandleRawKey(browserControl, key, modifiers)) {
|
|
return true;
|
|
}
|
|
|
|
switch (key) {
|
|
case Keys.Enter:
|
|
notification.InvokeAsyncSafe(notification.FinishCurrentNotification);
|
|
return true;
|
|
|
|
case Keys.Escape:
|
|
notification.InvokeAsyncSafe(notification.HideNotification);
|
|
return true;
|
|
|
|
case Keys.Space:
|
|
notification.InvokeAsyncSafe(() => notification.FreezeTimer = !notification.FreezeTimer);
|
|
return true;
|
|
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|