C# Cef-上载文件,不显示OpenFileDialog

C# Cef-上载文件,不显示OpenFileDialog,c#,chromium,openfiledialog,chromium-embedded,cefsharp,C#,Chromium,Openfiledialog,Chromium Embedded,Cefsharp,我需要有一种方法来选择一些文件而不显示OpenFileDialog 是的,我知道CEF不是自动化某事物的最佳方式,但我需要用CEF来实现这一点 我发现从2014年起这是可能的: 在此提交中,添加了覆盖文件浏览对话框结果的功能。。。但我仍然不明白如何使用这个能力 我找到了用法示例,但它不起作用: using System.Collections.Generic; using System.IO; namespace CefSharp.Example { public class Temp

我需要有一种方法来选择一些文件而不显示OpenFileDialog

是的,我知道CEF不是自动化某事物的最佳方式,但我需要用CEF来实现这一点

我发现从2014年起这是可能的:

在此提交中,添加了覆盖文件浏览对话框结果的功能。。。但我仍然不明白如何使用这个能力

我找到了用法示例,但它不起作用:

using System.Collections.Generic;
using System.IO;
namespace CefSharp.Example
{
    public class TempFileDialogHandler : IDialogHandler
    {
        public bool OnFileDialog(IWebBrowser browser, string title, string defaultFileName, List<string> acceptTypes, out List<string> result)
        {
            result = new List<string> { Path.GetRandomFileName() };
            return true;
        }
    }
}
使用System.Collections.Generic;
使用System.IO;
名称空间。示例
{
公共类TempFileDialogHandler:IDialogHandler
{
public bool OnFileDialog(IWebBrowser浏览器、字符串标题、字符串默认文件名、列表接受类型、输出列表结果)
{
结果=新列表{Path.GetRandomFileName()};
返回true;
}
}
}
它向我显示了一个错误,即目前OnFileDialog中的IDialogHandler有另一个参数(没有结果)

当前参数列表为:

public bool OnFileDialog(IWebBrowser browserControl, IBrowser browser, CefFileDialogMode mode, string title, string defaultFilePath, List<string> acceptFilters, int selectedAcceptFilter, IFileDialogCallback callback)
public bool OnFileDialog(IWebBrowser浏览器控件、IBrowser浏览器、CefFileDialogMode模式、字符串标题、字符串默认文件路径、列表接受筛选器、int-selectedAcceptFilter、IFileDialogCallback回调)
有人能帮我吗


我使用的是最新的CEFsharp:63.0.3

“它向我显示了错误”-我不清楚以下哪部分是错误消息。ofc它向我显示,没有使用此类参数的方法。我在上面的文本中编写了当前参数列表:)在两个代码示例中都可以看到OnFileDialog参数之间的差异。。。因此,错误文本类似于
TempFileDialogHandler不实现IDialogHandler
public class TempFileDialogHandler : IDialogHandler
{
    string[] _filePath;

    public TempFileDialogHandler(params string[] filePath)
    {
        _filePath = filePath;
    }

    public bool OnFileDialog(IWebBrowser browserControl, IBrowser browser, CefFileDialogMode mode, string title, string defaultFilePath, List<string> acceptFilters, int selectedAcceptFilter, IFileDialogCallback callback)
    {
        callback.Continue(0, _filePath.ToList());
        return true;
    }
}
Browser.DialogHandler = new TempFileDialogHandler(files);