Beispiel #1
0
        public void webClient_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
        {
            var state       = (object[])e.UserState;
            var destination = (string)state[0];

            if (e.Error != null)
            {
                MessageBox.Show(e.Error.Message, Application.ProductName);
                return;
            }

            if (e.Cancelled)
            {
                if (File.Exists(destination))
                {
                    File.Delete(destination);
                }
                //this.webClient = null;

                return;
            }

            Thread.Sleep(500);
            //this.webClient = null;

            if (ArchiveManager.ExtractArchive(destination))
            {
                MessageBox.Show(SuccessMessage);

                if (Success != null)
                {
                    Success();
                }
            }
        }