Beispiel #1
0
        private void DownloadNewVersion()
        {
            if (File.Exists(NetUtils.DownloadedTargetTempPath))
            {
                File.Delete(NetUtils.DownloadedTargetTempPath);
            }

            var downloadForm = new DownloadForm("Download Update");

            downloadForm.OnCancel += (o, e) =>
            {
                NetUtils.Cancel();
            };

            NetUtils.OnProgressChanged += (o, e) =>
            {
                downloadForm.SetValues(e.CurrentSpeed, e.TotalSize, e.TotalDownloaded, e.Remaining, e.CurrentPercentage);
            };
            NetUtils.OnError += (o, e) =>
            {
            };
            NetUtils.OnDownloadCompleted += (o, e) =>
            {
                downloadForm.Close();
                ApplyUpdate();
            };
            downloadForm.Show(this);
            NetUtils.DownloadLatestVersion();
        }