public Task <ServiceAttachResult> AttachToService() { __TaskCompletion = new TaskCompletionSource <ServiceAttachResult>(); PrivilegeHelper.StartAndConnectToLaunchAgent((int connectionPort) => { if (connectionPort > 0) { __TaskCompletion.SetResult(new ServiceAttachResult(connectionPort)); } else { __TaskCompletion.SetResult(new ServiceAttachResult("There was an error launching IVPN Agent.")); } }); return(__TaskCompletion.Task); }