Files
cefsharp/CefSharp/TaskPrintToPdf.cs
T
amaitland 60ae3cc739 Switch to using TrySetResult instead of SetResult
Invoke TrySetResult using TaskFactory.Run so continuations are run in an async fashion

Reference #1672
2016-04-27 21:01:58 +10:00

25 lines
687 B
C#

// Copyright © 2010-2016 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using System.Threading.Tasks;
using CefSharp.Internals;
namespace CefSharp
{
public sealed class TaskPrintToPdf : IPrintToPdfCallback
{
private readonly TaskCompletionSource<bool> taskCompletionSource = new TaskCompletionSource<bool>();
public Task<bool> Task
{
get { return taskCompletionSource.Task; }
}
public void OnPdfPrintFinished(string path, bool ok)
{
taskCompletionSource.TrySetResultAsync(ok);
}
}
}