System.Threading.Tasks.TaskCompletionSource.SetResult(ServiceAttachResult)

Here are the examples of the csharp api System.Threading.Tasks.TaskCompletionSource.SetResult(ServiceAttachResult) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

19 Source : ApplicationServices.cs
with GNU General Public License v3.0
from ivpn

public Task<ServiceAttachResult> AttachToService()
        {
            __TaskCompletion = new TaskCompletionSource<ServiceAttachResult>();

            PrivilegeHelper.StartAndConnectToLaunchAgent((int connectionPort, UInt64 secret) => {
                if (connectionPort > 0)                    
                    __TaskCompletion.SetResult(new ServiceAttachResult(connectionPort, secret));
                else 
                    __TaskCompletion.SetResult(new ServiceAttachResult("There was an error launching IVPN Agent."));
            });


            return __TaskCompletion.Task;
        }