mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-08-17 00:31:42 +02:00
Configuration
Core
Bridge
Controls
Handling
Filters
General
ContextMenuBase.cs
ContextMenuBrowser.cs
ContextMenuGuide.cs
ContextMenuNotification.cs
DragHandlerBrowser.cs
KeyboardHandlerBrowser.cs
KeyboardHandlerNotification.cs
RequestHandlerBase.cs
RequestHandlerBrowser.cs
ResourceHandlerNotification.cs
Management
Notification
Other
Utils
FormBrowser.Designer.cs
FormBrowser.cs
FormBrowser.resx
FormManager.cs
TweetDeckBrowser.cs
Data
Plugins
Properties
Resources
Updates
bld
lib
subprocess
video
.gitattributes
.gitignore
LICENSE.md
Program.cs
README.md
Reporter.cs
TweetDuck.csproj
TweetDuck.sln
TweetDuck.sln.DotSettings
packages.config
46 lines
1.9 KiB
C#
46 lines
1.9 KiB
C#
using CefSharp;
|
|
using System.Windows.Forms;
|
|
using TweetDuck.Core.Controls;
|
|
using TweetDuck.Core.Notification;
|
|
|
|
namespace TweetDuck.Core.Handling {
|
|
sealed class KeyboardHandlerNotification : IKeyboardHandler{
|
|
private readonly FormNotificationBase notification;
|
|
|
|
public KeyboardHandlerNotification(FormNotificationBase notification){
|
|
this.notification = notification;
|
|
}
|
|
|
|
private void TriggerKeyboardShortcutAnalytics(){
|
|
notification.InvokeAsyncSafe(notification.AnalyticsFile.NotificationKeyboardShortcuts.Trigger);
|
|
}
|
|
|
|
bool IKeyboardHandler.OnPreKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey, ref bool isKeyboardShortcut){
|
|
if (type == KeyType.RawKeyDown && !browser.FocusedFrame.Url.StartsWith("chrome-devtools://")){
|
|
switch((Keys)windowsKeyCode){
|
|
case Keys.Enter:
|
|
notification.InvokeAsyncSafe(notification.FinishCurrentNotification);
|
|
TriggerKeyboardShortcutAnalytics();
|
|
return true;
|
|
|
|
case Keys.Escape:
|
|
notification.InvokeAsyncSafe(notification.HideNotification);
|
|
TriggerKeyboardShortcutAnalytics();
|
|
return true;
|
|
|
|
case Keys.Space:
|
|
notification.InvokeAsyncSafe(() => notification.FreezeTimer = !notification.FreezeTimer);
|
|
TriggerKeyboardShortcutAnalytics();
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
bool IKeyboardHandler.OnKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey){
|
|
return false;
|
|
}
|
|
}
|
|
}
|