Exemple #1
0
 private static void OnDownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     if (sender is MightyWebClient mightyWebClient)
     {
         DownloadingWindowUtilities.SetPercent((float)e.BytesReceived / mightyWebClient.DocVersion.byteSize);
     }
 }
Exemple #2
0
        private static void OnDownloadDocCompleted(object sender, AsyncCompletedEventArgs e)
        {
            DownloadingWindowUtilities.Close();

            if (!(sender is MightyWebClient mightyWebClient))
            {
                return;
            }

            MightySettingsServices.DocPath = mightyWebClient.Path;
            FileUtilities.OpenAtPath(FileUtilities.GetDirectoryPath(mightyWebClient.Path));
            UpdateDocVersion(mightyWebClient.DocVersion.versionNumber);
        }
Exemple #3
0
        private static void DownloadDocAtPath(string path, MightyDocVersion docVersion)
        {
            using (var client = new MightyWebClient())
            {
                client.Path                     = path;
                client.DocVersion               = docVersion;
                client.DownloadFileCompleted   += OnDownloadDocCompleted;
                client.DownloadProgressChanged += OnDownloadProgressChanged;
                client.DownloadFileAsync(new Uri(docVersion.docURL), path);

                DownloadingWindowUtilities.Open();
            }
        }