DownLoadFile.cs 886 B

12345678910111213141516171819202122232425262728293031
  1. using CefSharp;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. namespace UAS_Web.tool
  7. {
  8. class DownLoadFile : IDownloadHandler
  9. {
  10. public void OnBeforeDownload(IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
  11. {
  12. if (!callback.IsDisposed)
  13. {
  14. using (callback)
  15. {
  16. callback.Continue(@"C:\Users\" +
  17. System.Security.Principal.WindowsIdentity.GetCurrent().Name +
  18. @"\Downloads\" +
  19. downloadItem.SuggestedFileName,
  20. showDialog: true);
  21. }
  22. }
  23. }
  24. public void OnDownloadUpdated(IBrowser browser, DownloadItem downloadItem, IDownloadItemCallback callback)
  25. {
  26. }
  27. }
  28. }