/// <summary> /// Call to run a file chooser dialog. Only a single file chooser dialog may be /// pending at any given time. |mode| represents the type of dialog to display. /// |title| to the title to be used for the dialog and may be empty to show the /// default title ("Open" or "Save" depending on the mode). |default_file_name| /// is the default file name to select in the dialog. |accept_types| is a list /// of valid lower-cased MIME types or file extensions specified in an input /// element and is used to restrict selectable files to such types. |callback| /// will be executed after the dialog is dismissed or immediately if another /// dialog is already pending. The dialog will be initiated asynchronously on /// the UI thread. /// </summary> public void RunFileDialog(CefFileDialogMode mode, string title, string defaultFileName, string[] acceptTypes, CefRunFileDialogCallback callback) { fixed (char* title_ptr = title) fixed (char* defaultFileName_ptr = defaultFileName) { var n_title = new cef_string_t(title_ptr, title != null ? title.Length : 0); var n_defaultFileName = new cef_string_t(defaultFileName_ptr, defaultFileName != null ? defaultFileName.Length : 0); var n_acceptTypes = cef_string_list.From(acceptTypes); cef_browser_host_t.run_file_dialog(_self, mode, &n_title, &n_defaultFileName, n_acceptTypes, callback.ToNative()); libcef.string_list_free(n_acceptTypes); } }
/// <summary> /// Call to run a file chooser dialog. Only a single file chooser dialog may be /// pending at any given time. |mode| represents the type of dialog to display. /// |title| to the title to be used for the dialog and may be empty to show the /// default title ("Open" or "Save" depending on the mode). |default_file_path| /// is the path with optional directory and/or file name component that will be /// initially selected in the dialog. |accept_filters| are used to restrict the /// selectable file types and may any combination of (a) valid lower-cased MIME /// types (e.g. "text/*" or "image/*"), (b) individual file extensions (e.g. /// ".txt" or ".png"), or (c) combined description and file extension delimited /// using "|" and ";" (e.g. "Image Types|.png;.gif;.jpg"). /// |selected_accept_filter| is the 0-based index of the filter that will be /// selected by default. |callback| will be executed after the dialog is /// dismissed or immediately if another dialog is already pending. The dialog /// will be initiated asynchronously on the UI thread. /// </summary> public void RunFileDialog(CefFileDialogMode mode, string title, string defaultFilePath, string[] acceptFilters, int selectedAcceptFilter, CefRunFileDialogCallback callback) { if (callback == null) { throw new ArgumentNullException("callback"); fixed(char *title_ptr = title) fixed(char *defaultFilePath_ptr = defaultFilePath) { var n_title = new cef_string_t(title_ptr, title != null ? title.Length : 0); var n_defaultFilePath = new cef_string_t(defaultFilePath_ptr, defaultFilePath != null ? defaultFilePath.Length : 0); var n_acceptFilters = cef_string_list.From(acceptFilters); cef_browser_host_t.run_file_dialog(_self, mode, &n_title, &n_defaultFilePath, n_acceptFilters, selectedAcceptFilter, callback.ToNative()); libcef.string_list_free(n_acceptFilters); } }
/// <summary> /// Call to run a file chooser dialog. Only a single file chooser dialog may be /// pending at any given time. |mode| represents the type of dialog to display. /// |title| to the title to be used for the dialog and may be empty to show the /// default title ("Open" or "Save" depending on the mode). |default_file_name| /// is the default file name to select in the dialog. |accept_types| is a list /// of valid lower-cased MIME types or file extensions specified in an input /// element and is used to restrict selectable files to such types. |callback| /// will be executed after the dialog is dismissed or immediately if another /// dialog is already pending. The dialog will be initiated asynchronously on /// the UI thread. /// </summary> public void RunFileDialog(CefFileDialogMode mode, string title, string defaultFileName, string[] acceptTypes, CefRunFileDialogCallback callback) { fixed(char *title_ptr = title) fixed(char *defaultFileName_ptr = defaultFileName) { var n_title = new cef_string_t(title_ptr, title != null ? title.Length : 0); var n_defaultFileName = new cef_string_t(defaultFileName_ptr, defaultFileName != null ? defaultFileName.Length : 0); var n_acceptTypes = cef_string_list.From(acceptTypes); cef_browser_host_t.run_file_dialog(_self, mode, &n_title, &n_defaultFileName, n_acceptTypes, callback.ToNative()); libcef.string_list_free(n_acceptTypes); } }