PowerControl: Apply profile changes in bulk

This commit is contained in:
Kamil Trzciński 2023-01-21 13:25:06 +01:00
parent b7d7ad677e
commit 4bcefc703e
4 changed files with 64 additions and 37 deletions

View file

@ -0,0 +1,17 @@
namespace CommonHelpers
{
public static class Dispatcher
{
public static CancellationTokenSource RunWithDelay(int delayMs, Action action)
{
var cancellationTokenSource = new CancellationTokenSource();
Task.Delay(1000, cancellationTokenSource.Token).ContinueWith(_ =>
{
System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(action);
});
return cancellationTokenSource;
}
}
}