From 1008347f666e883b567997532dbce70811468bcb Mon Sep 17 00:00:00 2001 From: amaitland Date: Thu, 20 Oct 2016 08:35:15 +1000 Subject: [PATCH] Offscreen Example - Add comment about TrySetResultAsync --- CefSharp.OffScreen.Example/Program.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CefSharp.OffScreen.Example/Program.cs b/CefSharp.OffScreen.Example/Program.cs index ff8313598..34933b2c8 100644 --- a/CefSharp.OffScreen.Example/Program.cs +++ b/CefSharp.OffScreen.Example/Program.cs @@ -105,6 +105,8 @@ namespace CefSharp.OffScreen.Example public static Task LoadPageAsync(IWebBrowser browser, string address = null) { + //If using .Net 4.6 then use TaskCreationOptions.RunContinuationsAsynchronously + //and switch to tcs.TrySetResult below - no need for the custom extension method var tcs = new TaskCompletionSource(); EventHandler handler = null; @@ -114,6 +116,8 @@ namespace CefSharp.OffScreen.Example if (!args.IsLoading) { browser.LoadingStateChanged -= handler; + //This is required when using a standard TaskCompletionSource + //Extension method found in the CefSharp.Internals namespace tcs.TrySetResultAsync(true); } };