rework throttle

reuse throttle mechanism for catching global keys
This commit is contained in:
Oleksandr Bezdieniezhnykh
2024-08-14 02:02:26 +03:00
parent 468d28d9d8
commit 78776d37bd
6 changed files with 38 additions and 28 deletions
+2 -1
View File
@@ -9,6 +9,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Serilog;
using Azaion.Annotator.Extensions;
namespace Azaion.Annotator;
@@ -71,6 +72,6 @@ public partial class App : Application
private void GlobalClick(object sender, RoutedEventArgs e)
{
var args = (KeyEventArgs)e;
_mediator.Publish(new KeyEvent(sender, args));
_ = ThrottleExt.Throttle(() => _mediator.Publish(new KeyEvent(sender, args)), TimeSpan.FromMilliseconds(50));
}
}