Skip to content

Instantly share code, notes, and snippets.

@amamdouh2k15
amamdouh2k15 / WpfNonBlockingUIThreadWithFeedback.cs
Created January 15, 2017 12:46
Wpf Non Blocking UI Thread With Feedback
var task = Task.Factory.StartNew(() =>
{
//time consuming task
});
task.ContinueWith((t) =>
{
//TODO when task finishes
}, TaskContinuationOptions.ExecuteSynchronously);
@amamdouh2k15
amamdouh2k15 / DelayedTaskStart.cs
Last active January 15, 2017 12:47
Delayed Task Start
System.Threading.Timer timer = null;
timer = new System.Threading.Timer((obj) =>
{
//Delayed Code here
timer.Dispose();
},
null, 3000 /*Delay time in ms*/, System.Threading.Timeout.Infinite);