Ejemplo n.º 1
0
 private static void OnDownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     if (sender is MightyWebClient mightyWebClient)
     {
         DownloadingWindowUtilities.SetPercent((float)e.BytesReceived / mightyWebClient.DocVersion.byteSize);
     }
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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();
            }
        }