CefRunFileDialogCallback.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233
  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 for CefBrowserHost::RunFileDialog. The methods of this
  10. /// class will be called on the browser process UI thread.
  11. /// </summary>
  12. public abstract unsafe partial class CefRunFileDialogCallback
  13. {
  14. private void on_file_dialog_dismissed(cef_run_file_dialog_callback_t* self, int selected_accept_filter, cef_string_list* file_paths)
  15. {
  16. CheckSelf(self);
  17. var mFilePaths = cef_string_list.ToArray(file_paths);
  18. OnFileDialogDismissed(selected_accept_filter, mFilePaths);
  19. }
  20. /// <summary>
  21. /// Called asynchronously after the file dialog is dismissed.
  22. /// |selected_accept_filter| is the 0-based index of the value selected from
  23. /// the accept filters array passed to CefBrowserHost::RunFileDialog.
  24. /// |file_paths| will be a single value or a list of values depending on the
  25. /// dialog mode. If the selection was cancelled |file_paths| will be empty.
  26. /// </summary>
  27. protected abstract void OnFileDialogDismissed(int selectedAcceptFilter, string[] filePaths);
  28. }
  29. }