WebBrowser的事件没有被解雇?我不认为它甚至导航?这是一个控制台应用程序。我不确定为什么不这样做,我已将[STAThread]
添加到Program.cs中的Main方法
internal class ClothingDownloader
{
private static readonly ILogger Logger = LogManager.GetCurrentClassLogger();
private WebBrowser _webBrowser;
public void Load()
{
var downloadUrl = Program.Server.ConfigHandler.GetConfigValueByKey("clothing.figuremap.url");
if (File.Exists("storage/figuremap.xml"))
{
Logger.Warn("Grabbing figuremap.xml from the cache...");
}
else
{
Logger.Trace("Attempting to download figuremap.xml from " + downloadUrl.Split('/')[0] + "...");
_webBrowser = new WebBrowser();
_webBrowser.DocumentCompleted += webBrowser_DocumentCompleted;
_webBrowser.ScriptErrorsSuppressed = true;
_webBrowser.Navigate("https://google.com");
}
}
void webBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
Console.WriteLine(_webBrowser.DocumentText);
}
}