PurplePen.DownloadProgressDialog.Dispose C# (CSharp) Method

Dispose() protected method

Clean up any resources being used.
protected Dispose ( bool disposing ) : void
disposing bool true if managed resources should be disposed; otherwise, false.
return void
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null)) {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

Usage Example

Example #1
0
        public static bool DownloadAndInstall(Uri downloadFrom, string fileName, bool exitToInstall)
        {
            WebClient client         = new WebClient();
            string    downloadedFile = Path.Combine(GetDownloadDirectory(), fileName);
            bool      completed      = false;
            bool      success        = false;

            downloadedFile = FindNonexistantFile(downloadedFile);

            DownloadProgressDialog downloadProgressDialog = new DownloadProgressDialog();

            client.DownloadProgressChanged += (sender, e) => { downloadProgressDialog.SetProgress(e.ProgressPercentage); };
            client.DownloadFileCompleted   += (sender, e) => {
                completed = true;
                downloadProgressDialog.DialogResult = DialogResult.OK;
            };

            client.DownloadFileAsync(downloadFrom, downloadedFile);
            var result = downloadProgressDialog.ShowDialog();

            if (result == DialogResult.OK && completed)
            {
                success = Install(downloadedFile, exitToInstall);
            }

            client.Dispose();
            downloadProgressDialog.Dispose();
            return(success);
        }
All Usage Examples Of PurplePen.DownloadProgressDialog::Dispose