DownLoadFile.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using CefSharp;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Diagnostics;
  5. using System.Linq;
  6. using System.Text;
  7. namespace UAS_Web.tool
  8. {
  9. class DownLoadFile : IDownloadHandler
  10. {
  11. public static bool downloading = false;
  12. public void OnBeforeDownload(IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
  13. {
  14. if (!callback.IsDisposed)
  15. {
  16. using (callback)
  17. {
  18. callback.Continue(System.AppDomain.CurrentDomain.BaseDirectory + downloadItem.SuggestedFileName,
  19. showDialog: false);
  20. }
  21. }
  22. }
  23. public void OnDownloadUpdated(IBrowser browser, DownloadItem downloadItem, IDownloadItemCallback callback)
  24. {
  25. if (downloadItem.IsComplete)
  26. {
  27. downloading = false;
  28. }
  29. else {
  30. downloading = true;
  31. }
  32. }
  33. }
  34. }