这就是我在WPF应用程序中的内容,我使用的是Awesomium Web浏览器控件以及MVVM和Caliburn.Micro。
在我的ShellViewModel中,我在OnViewReady方法中有以下代码
if (!WebCore.IsInitialized)
{
WebCore.Initialize(
new WebConfig()
{
HomeURL = "http://www.ic24.org.uk".ToUri(),
LogPath = Path.Combine(@"C:\Users\nstevens\AppData\Local\IC24\Cleo", "logs"),
LogLevel = LogLevel.Verbose
});
}
webControl = new WebControl
{
Source = "https://newcleodev.sehnp.nhs.uk/".ToUri(), // this is a locally hosted web application
WebSession =
WebCore.CreateWebSession(
@"C:\SessionDataPath",
new WebPreferences
{
WebSecurity = false,
AllowInsecureContent = true
})
};
webControl.WebSession.ClearCache();
webControl.BorderThickness = new Thickness(0, 0, 0, 0);
webControl.Margin = new Thickness(0, -4, 0, 0);
webControl.ShowContextMenu += webControl_ShowContextMenu;
webControl.ConsoleMessage += (sender, args) => Debug.WriteLine(args.Message);
webControl.Crashed += (sender, args) => Debug.WriteLine(args.Status);
webControl.LoadingFrame += this.webControl_LoadingFrame;
webControl.LoadingFrameComplete += this.webControl_LoadingFrameComplete;
webControl.CertificateError += (sender, args) =>
{
args.Handled = EventHandling.Default;
args.Ignore = true;
};
WebCore.ResourceInterceptor = new CustomResourceInterceptor
{
RequestEnabled = true,
Headers =
new Dictionary<string, string>
{
{
"theme",
shellView
.SelectedItem
.StyleSheet
}
}
};
this.documentPanel = new DockPane { Header = "NHS Confidential: Personal data about a patient", Content = webControl };
this.dockingManager.AddDocument(this.documentPanel);
webControl.DocumentReady += WebViewOnDocumentReady;
当我运行应用程序时,我没有在浏览器控件中加载Web应用程序,我尝试在Internet Explorer和Chrome中访问上面的Uri并且应用程序都加载了,我也在浏览器控件中尝试了不同的Uri他们都在工作。
我真的很难与这个特定的Uri挣扎,我唯一看到的问题是,当我在Chrome中加载这个Uri时,我会立即接受客户端证书(列出了根证书的对话框)
我想要一个完整性检查,下面的代码是正确的,我没有做错什么,也想知道问题是什么,日志文件的内容是
[0807/143423:INFO:(0)] WebCore is now online.
[0807/143423:INFO:(0)] Running Awesomium 1.7.5.0
[0807/143423:INFO:Awesomium.NET(0)] Registering Javascript Callbacks
没有其他东西输出到VS中的日志或输出窗口。
编辑:我检查了LoadingFrameEventArgs的值,看到没有问题,没有SSL错误,LoadingFrame事件被触发但没有别的,我真的被这个!! / p>