Esempio n. 1
0
 public static void DownloadFileVisual(string url, string path)
 {
     using (var webClient = WebClientHelper.GetWebClient())
     {
         var frm = new ProgressForm();
         frm.Text = Language.Misc_DownloadFileVisual_Downloading;
         webClient.DownloadProgressChanged += (sender, e) =>
             { frm.mainProgressBar.Value = e.ProgressPercentage; };
         webClient.DownloadFileCompleted += (sender, args) =>
             {
                 frm.AllowClose = true;
                 frm.Close();
             };
         webClient.DownloadFileAsync(new Uri(url), path);
         frm.ShowDialog(frmMain.defaultInstance);
     }
 }
Esempio n. 2
0
 public static void UnZipFileVisual(string zipFileName, string targetPath)
 {
     var frmProg = new ProgressForm {mainProgressBar = {Style = ProgressBarStyle.Marquee}, Text = Language.Misc_UnZipFile_Unpacking___};
     ThreadPool.QueueUserWorkItem(state =>
                                      {
                                          DecompressToDirectory(new FileStream(zipFileName, FileMode.Open), targetPath, null, null);
                                          frmProg.AllowClose = true;
                                          if (frmProg.InvokeRequired)
                                          {
                                              frmProg.Invoke(new MethodInvoker(frmProg.Close));
                                          }
                                          else
                                          {
                                              frmProg.Close();   
                                          }
                                      });
     frmProg.ShowDialog(frmMain.Default);
 }