public void DownloadResponse(IAsyncResult result)
        {
            AsyncResult            res        = (AsyncResult)result;
            AsyncDownloadDelegator myDelegate = (AsyncDownloadDelegator)res.AsyncDelegate;

            _resultLocation = myDelegate.EndInvoke(result);
            _doFinalCall    = true;
        }
        public void StartAsyncDownload(string artifacturl, string targetfile)
        {
            ServicePointManager.ServerCertificateValidationCallback =
                RemoteCertification.MyRemoteCertificateValidationCallback;

            AsyncDownloadDelegator myDelegate = AsyncDownload;

            myDelegate.BeginInvoke(artifacturl, targetfile, DownloadResponse, null);

            EditorApplication.update -= EditorUpdate;
            EditorApplication.update += EditorUpdate;
        }