Skip to content

@Nilzor /DelayedExecuter.cs
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
DelayedExecuter
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml;
namespace NilzorLib.Metro.Core
{
public class DelayedExecuter
{
DispatcherTimer _timer;
public static void ExecuteAfter(int ms, Action action)
{
ExecuteAfter(new TimeSpan(0,0,0,0,ms), action);
}
public static void ExecuteAfter(TimeSpan span, Action action)
{
var p = new DelayedExecuter();
p._timer = new DispatcherTimer();
p._timer.Interval = span;
p._timer.Tick += (a,b) =>
{
p._timer.Stop();
p._timer = null;
action();
};
p._timer.Start();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.