mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 03:36:44 +02:00
start issue#11
This commit is contained in:
@@ -13,7 +13,14 @@ namespace WinAlfred
|
||||
private static readonly object syncRoot = new object();
|
||||
|
||||
public static string DelayInvoke(this Dispatcher dispatcher, string namedInvocation,
|
||||
Action action, TimeSpan delay,
|
||||
Action<string> action, TimeSpan delay,
|
||||
DispatcherPriority priority = DispatcherPriority.Normal)
|
||||
{
|
||||
return DelayInvoke(dispatcher, namedInvocation, action, delay, string.Empty, priority);
|
||||
}
|
||||
|
||||
public static string DelayInvoke(this Dispatcher dispatcher, string namedInvocation,
|
||||
Action<string> action, TimeSpan delay, string arg,
|
||||
DispatcherPriority priority = DispatcherPriority.Normal)
|
||||
{
|
||||
lock (syncRoot)
|
||||
@@ -29,7 +36,7 @@ namespace WinAlfred
|
||||
var timer = new DispatcherTimer(delay, priority, (s, e) =>
|
||||
{
|
||||
RemoveTimer(namedInvocation);
|
||||
action();
|
||||
action(arg);
|
||||
}, dispatcher);
|
||||
timer.Start();
|
||||
timers.Add(namedInvocation, timer);
|
||||
|
||||
Reference in New Issue
Block a user