CefBeforeDownloadCallback.cs 1.1 KB

1234567891011121314151617181920212223242526272829
  1. namespace Xilium.CefGlue
  2. {
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Diagnostics;
  6. using System.Runtime.InteropServices;
  7. using Xilium.CefGlue.Interop;
  8. /// <summary>
  9. /// Callback interface used to asynchronously continue a download.
  10. /// </summary>
  11. public sealed unsafe partial class CefBeforeDownloadCallback
  12. {
  13. /// <summary>
  14. /// Call to continue the download. Set |download_path| to the full file path
  15. /// for the download including the file name or leave blank to use the
  16. /// suggested name and the default temp directory. Set |show_dialog| to true
  17. /// if you do wish to show the default "Save As" dialog.
  18. /// </summary>
  19. public void Continue(string downloadPath, bool showDialog)
  20. {
  21. fixed (char* downloadPath_ptr = downloadPath)
  22. {
  23. var n_downloadPath = new cef_string_t(downloadPath_ptr, downloadPath != null ? downloadPath.Length : 0);
  24. cef_before_download_callback_t.cont(_self, &n_downloadPath, showDialog ? 1 : 0);
  25. }
  26. }
  27. }
  28. }