¡@

Home 

c# Programming Glossary: tcs

Retry a task multiple times based on user input in case of an exception in task

http://stackoverflow.com/questions/10490307/retry-a-task-multiple-times-based-on-user-input-in-case-of-an-exception-in-task

T func int retryCount int delay TaskCompletionSource T tcs null if tcs null tcs new TaskCompletionSource T Task.Factory.StartNew.. retryCount int delay TaskCompletionSource T tcs null if tcs null tcs new TaskCompletionSource T Task.Factory.StartNew func.. int delay TaskCompletionSource T tcs null if tcs null tcs new TaskCompletionSource T Task.Factory.StartNew func .ContinueWith..

General purpose FromEvent method

http://stackoverflow.com/questions/12865848/general-purpose-fromevent-method

Task FromEvent MyClass obj TaskCompletionSource object tcs new TaskCompletionSource object obj.OnCompletion tcs.SetResult.. tcs new TaskCompletionSource object obj.OnCompletion tcs.SetResult null return tcs.Task This then allows await FromEvent.. object obj.OnCompletion tcs.SetResult null return tcs.Task This then allows await FromEvent new MyClass The problem..

How to put a task to sleep (or delay) in C# 4.0?

http://stackoverflow.com/questions/15341962/how-to-put-a-task-to-sleep-or-delay-in-c-sharp-4-0

in 4.0 public static Task Delay double milliseconds var tcs new TaskCompletionSource bool System.Timers.Timer timer new.. timer new System.Timers.Timer timer.Elapsed obj args tcs.TrySetResult true timer.Interval milliseconds timer.AutoReset..

Perform screen-scape of Webbrowser control in thread

http://stackoverflow.com/questions/18675606/perform-screen-scape-of-webbrowser-control-in-thread

static Task Image GetPageAsImageAsync string url var tcs new TaskCompletionSource Image var thread new Thread WebBrowser.. JS a few seconds more Bitmap bitmap TakeSnapshot browser tcs.TrySetResult bitmap browser.Dispose Application.ExitThread.. ApartmentState.STA thread.Start return tcs.Task private static Bitmap TakeSnapshot WebBrowser browser ..

Correct way to delay the start of a Task

http://stackoverflow.com/questions/4990602/correct-way-to-delay-the-start-of-a-task

if dueTimeMs 0 return _sPreCompletedTask var tcs new TaskCompletionSource object var ctr new CancellationTokenRegistration.. delegate object self ctr.Dispose Timer self .Dispose tcs.TrySetResult null if cancellationToken.CanBeCanceled ctr cancellationToken.Register.. cancellationToken.Register delegate timer.Dispose tcs.TrySetCanceled timer.Change dueTimeMs 1 return tcs.Task..