Usually, a special extension method is used for this:
public static class DispatcherHelper
{
public static void DelayInvoke(this Dispatcher dispatcher, TimeSpan ts, Action action)
{
DispatcherTimer delayTimer = new DispatcherTimer(DispatcherPriority.Send, dispatcher);
delayTimer.Interval = ts;
delayTimer.Tick += (s, e) =>
{
delayTimer.Stop();
action();
};
delayTimer.Start();
}
}
In your case, you can use it as follows:
Dispatcher.DelayInvoke(TimeSpan.FromSeconds(5), () =>
{
CompilationStatus = 0;
}
: , , SO-: ?