protected override bool OnFileDialog(CefBrowser browser, CefFileDialogMode mode, string title, string defaultFilePath, string[] acceptFilters, int selectedAcceptFilter, CefFileDialogCallback callback)
 {
     return(base.OnFileDialog(browser, mode, title, defaultFilePath, acceptFilters, selectedAcceptFilter, callback));
 }
 /// <summary>
 /// Called to run a file chooser dialog.
 /// </summary>
 /// <param name="browser">The browser object.</param>
 /// <param name="mode">
 /// Represents the type of dialog to display.
 /// </param>
 /// <param name="title">
 /// The title to be used for the dialog and may be empty to show the default title
 /// (&apos;Open&apos; or &apos;Save&apos; depending on the mode).
 /// </param>
 /// <param name="defaultFilePath">
 ///  The path with optional directory and/or file name component that should be
 ///  initially selected in the dialog.
 /// </param>
 /// <param name="acceptFilters">
 /// Used to restrict the selectable file types and may any combination of
 /// <list type="bullet">
 /// <item>valid lower-cased MIME types (e.g. &apos;text/*&apos; or &apos;image/*&apos;);</item>
 /// <item>individual file extensions (e.g. &apos;.txt&apos; or &apos;.png&apos;);</item>
 /// <item>
 /// combined description and file extension delimited using &apos;|&apos; and
 /// &apos;;&apos; (e.g. &apos;Image Types|.png;.gif;.jpg&apos;).
 /// </item>
 /// </list>
 /// </param>
 /// <param name="selectedAcceptFilter">
 /// The 0-based index of the filter that should be selected by default.
 /// </param>
 /// <param name="callback">A callback object.</param>
 /// <returns>
 /// To display a custom dialog return true and execute <paramref name="callback"/>
 /// either inline or at a later time. To display the default dialog return false.
 /// </returns>
 internal protected virtual bool OnFileDialog(CefBrowser browser, CefFileDialogMode mode, string title, string defaultFilePath, CefStringList acceptFilters, int selectedAcceptFilter, CefFileDialogCallback callback)
 {
     return(false);
 }
 /// <inheritdoc />
 internal protected override bool OnFileDialog(CefBrowser browser, CefFileDialogMode mode, string title, string defaultFilePath, CefStringList acceptFilters, int selectedAcceptFilter, CefFileDialogCallback callback)
 {
     callback.Cancel();
     return(true);
 }
Exemple #4
0
 protected override bool OnFileDialog(CefBrowser browser, CefFileDialogMode mode, string title, string defaultFilePath, string[] acceptFilters, int selectedAcceptFilter, CefFileDialogCallback callback)
 {
     return(logic.OnFileDialog(ConvertDialogType(mode & CefFileDialogMode.TypeMask), acceptFilters, callback));
 }
Exemple #5
0
 protected internal unsafe override bool OnFileDialog(CefBrowser browser, CefFileDialogMode mode, string title, string defaultFilePath, CefStringList acceptFilters, int selectedAcceptFilter, CefFileDialogCallback callback)
 {
     return(_implementation.OnFileDialog(browser, mode, title, defaultFilePath, acceptFilters, selectedAcceptFilter, callback));
 }
        protected override bool OnFileDialog(CefBrowser browser, CefFileDialogMode mode, string title, string defaultFilePath, string[] acceptFilters, int selectedAcceptFilter, CefFileDialogCallback callback)
        {
            if (mode == (CefFileDialogMode.Save | CefFileDialogMode.OverwritePromptFlag | CefFileDialogMode.HideReadOnlyFlag))
            {
                var saveFileDialog = new SaveFileDialog();
                saveFileDialog.FileName = defaultFilePath;
                //saveFileDialog.Filter = string.Join("Supported Files|*", acceptFilters);
                if (saveFileDialog.ShowDialog() == DialogResult.OK && saveFileDialog.FileName != "")
                {
                    callback.Continue(selectedAcceptFilter, saveFileDialog.FileNames);
                }
            }
            else if (mode == (CefFileDialogMode.OpenFolder | CefFileDialogMode.OverwritePromptFlag | CefFileDialogMode.HideReadOnlyFlag))
            {
                var dialog = new FolderBrowserDialog();
                if (dialog.ShowDialog() == DialogResult.OK && dialog.SelectedPath != "")
                {
                    callback.Continue(selectedAcceptFilter, new string[] { dialog.SelectedPath });
                }
            }
            else if (mode == (CefFileDialogMode.OverwritePromptFlag | CefFileDialogMode.HideReadOnlyFlag))
            {
                var dialog = new OpenFileDialog();
                dialog.Multiselect = mode == CefFileDialogMode.OpenMultiple;
                if (dialog.ShowDialog() == DialogResult.OK && dialog.FileName != "")
                {
                    callback.Continue(selectedAcceptFilter, dialog.FileNames);
                }
            }
            //else callback.Cancel();

            return(base.OnFileDialog(browser, mode, title, defaultFilePath, acceptFilters, selectedAcceptFilter, callback));
        }
Exemple #7
0
        protected override Boolean OnFileDialog(CefBrowser browser, CefFileDialogMode mode, String title, String defaultFileName, String[] acceptTypes, CefFileDialogCallback callback)
        {
            if (mode == CefFileDialogMode.Open || mode == CefFileDialogMode.OpenMultiple)
            {
                if (this.Client.HandleOpenFileDialog != null)
                {
                    callback.Continue(this.Client.HandleOpenFileDialog(title, defaultFileName, acceptTypes));
                    return(true);
                }
            }
            else if (mode == CefFileDialogMode.Save)
            {
                if (this.Client.HandleSaveFileDialog != null)
                {
                    callback.Continue(this.Client.HandleSaveFileDialog(title, defaultFileName, acceptTypes));
                    return(true);
                }
            }

            Log.Trace("DialogHandler.OnFileDialog( browser: {0}, mode: {1}, title: {2}, defaultFileName: {3}, acceptTypes: {4} )",
                      browser.Identifier,
                      Enum.GetName(typeof(CefFileDialogMode), mode),
                      title,
                      defaultFileName,
                      String.Join(" ", acceptTypes));

            return(false);
            //return base.OnFileDialog( browser, mode, title, defaultFileName, acceptTypes, callback );
        }
 protected override bool OnFileDialog(CefBrowser browser, CefFileDialogMode mode, string title, string defaultFilePath, string[] acceptFilters, int selectedAcceptFilter, CefFileDialogCallback callback)
 {
     if (OwnerWebView.DisableFileDialogs)
     {
         return(true);
     }
     return(false);
 }