private void OnProcessFileDialog(object sender, FileDialogEventArgs e)
 {
     switch (e.Mode)
     {
     case FileDialogMode.Save:
         using (var saveDialog = new SaveFileDialog())
         {
             saveDialog.Title            = e.Title;
             saveDialog.Filter           = e.Filter;
             saveDialog.FileName         = Path.GetFileName(e.DefaultFileName);
             saveDialog.InitialDirectory = Path.Combine(
                 Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
                 "Downloads");
             if (saveDialog.ShowDialog(_siteContainer.ParentBundle.MainForm) != DialogResult.Cancel)
             {
                 FormDownloadProgress.ShowProgress(_siteContainer.ParentBundle.MainForm);
                 Application.DoEvents();
                 FormDownloadProgress.SetTitle("Downloading…");
                 Application.DoEvents();
                 FormDownloadProgress.SetDetails(Path.GetFileName(saveDialog.FileName));
                 Application.DoEvents();
                 _siteContainer.SuspendPages();
                 Application.DoEvents();
                 e.Continue(saveDialog.FileName);
             }
             else
             {
                 e.Cancel();
             }
         }
         break;
     }
     e.Handled = true;
 }
Beispiel #2
0
 private void DownloadFile(string url, AfterDownloadAction afterDownloadAction = AfterDownloadAction.None)
 {
     _afterDownloadAction = afterDownloadAction;
     FormDownloadProgress.ShowProgress(_siteContainer.ParentBundle.MainForm);
     FormDownloadProgress.SetTitle("Downloading…");
     _siteContainer.SuspendPages();
     Application.DoEvents();
     _extensionDownloadView.WebView.LoadUrl(url.Replace(@"SalesLibraries/SalesLibraries", "SalesLibraries"));
 }