forked from cefsharp/CefSharp.OutOfProcess
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDialogHandlerProxy.cs
More file actions
38 lines (32 loc) · 1.21 KB
/
Copy pathDialogHandlerProxy.cs
File metadata and controls
38 lines (32 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System.Collections.Generic;
using CefSharp.OutOfProcess.Interface;
using CefSharp.Handler;
using System.Linq;
using CefSharp.OutOfProcess.Interface.Callbacks;
namespace CefSharp.OutOfProcess.BrowserProcess.CallbackProxies
{
internal sealed class DialogHandlerProxy : CallbackProxyBase<IFileDialogCallback>, IDialogHandler
{
public DialogHandlerProxy(IOutOfProcessHostRpc host)
: base(host)
{
}
public void Callback(FileDialogCallbackDetails details)
{
var cb = GetCallback(details.CallbackId);
if (details.Continue)
{
cb.Continue(details.Files.ToList());
}
else
{
cb.Cancel();
}
}
bool IDialogHandler.OnFileDialog(IWebBrowser chromiumWebBrowser, IBrowser browser, CefFileDialogMode mode, string title, string defaultFilePath, List<string> acceptFilters, IFileDialogCallback callback)
{
var result = host.OnFileDialog(((OutOfProcessChromiumWebBrowser)chromiumWebBrowser).Id, mode.ToString(), title, defaultFilePath, acceptFilters.ToArray(), CreateCallback(callback));
return result.Result;
}
}
}