private void InternalDownloadHtmlAsync(Uri address, AsyncOperation asyncOperation)
        {
            string html = InternalDownloadHtml(address);
            DownloadHtmlCompletedEventArgs e = new DownloadHtmlCompletedEventArgs(null, false, html);

            asyncOperation.PostOperationCompleted(DownloadHtmlCompletedCallBack, e);
        }
        protected virtual void OnDownloadHtmlCompleted(DownloadHtmlCompletedEventArgs e)
        {
            EventHandler <DownloadHtmlCompletedEventArgs> handler = DownloadHtmlCompleted;

            //If the handler is not null then call the invoke method
            //This is a null propogation
            handler?.Invoke(this, e);
        }
        private void htmlClient_DownloadHtmlCompleted(object sender, DownloadHtmlCompletedEventArgs e)
        {
            string html = e.HTML;

            btnSync.Enabled  = true;
            btnAsync.Enabled = true;

            progressBar1.Value = progressBar1.Maximum;
            progressBar1.Style = ProgressBarStyle.Blocks;
        }
        private void InternalDownloadHtmlCompleted(object state)
        {
            DownloadHtmlCompletedEventArgs e = (DownloadHtmlCompletedEventArgs)state;

            OnDownloadHtmlCompleted(e);
        }