0

这是代码:

    static void Main(string[] args)
    {
        Semaphore loadFinished = new Semaphore(0, 1);

        WebCore.Initialize(new WebCoreConfig() { CustomCSS = "::-webkit-scrollbar { visibility: hidden; }" });

        using (WebView webView = WebCore.CreateWebView(1200, 800))
        {
            webView.LoadCompleted += (a, b) => 
            { 
                loadFinished.Release(); 
            };
            webView.LoadURL("http://store.apple.com/ca/browse/home/shop_iphone/family/iphone/iphone4s");

            loadFinished.WaitOne();

            webView.Render().SaveToJPEG(@"D:\Users\menkaur\Documents\stream\2012\apple-store\awesonium\result.jpg", 100);
        }

        // Announce.
        Console.Write("Hit any key to see the result...");
        Console.ReadKey(true);

        // Start the application associated with .png files
        // and display the file.
        Process.Start(@"D:\Users\menkaur\Documents\stream\2012\apple-store\awesonium\result.jpg");

        // Shut down Awesomium before exiting.
        WebCore.Shutdown();

        Console.ReadKey(true);
    }

网站从不加载;但是,从普通的 chrome 来看,它看起来还不错;另外,我已经用 google.com 测试了代码,它也可以正常工作

有什么问题?

4

1 回答 1

1

好的。这是解决方案:

            while (!loadFinished.WaitOne(100))
            {
                WebCore.Update();
            }
于 2012-01-22T11:04:12.617 回答