请看第三步
CefSharp.WinForms.Example版本v69.0.0
1.new类myhandle:DefaultRequestHandler
2.chromiumWebBrowser1.RequestHandler = new myhandle();
3.implement接口
public override CefReturnValue OnBeforeResourceLoad(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IRequestCallback callback)
{
Uri url;
string str;
if (Uri.TryCreate(request.Url, UriKind.Absolute, out url) == false)
{
return CefReturnValue.Cancel;
}
str = request.Url.ToString();
if (str.Contains("https://example.com/v1"))
{
if (str.Contains("png"))
return CefReturnValue.Cancel;
if (str.Contains("json"))
return CefReturnValue.Cancel;
string name = "";
HttpDldFile df = new HttpDldFile();
df.Download("E:\\", str, ref name);
//here I want to change the Form UI
//example label1.Text = "state:download complete";
}
return CefReturnValue.Continue;
}