Пример #1
0
        private void Window_Initialized(object sender, EventArgs e)
        {
            if (!Cef.IsInitialized)
            {
                var cefConfigHelper = new CefConfigHelper();
                cefConfigHelper.SetCefSharpSettings();
                Cef.Initialize(cefConfigHelper.GetSettings());
            }

            InitChromeBrowser();

            mainGrid.Children.Add(chromeBrowser);
        }
Пример #2
0
        private void ChromeBrowser_IsBrowserInitializedChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            if (chromeBrowser.IsInitialized)
            {
                //Case 1: Use the http
                //chromeBrowser.Address = "www.baidu.com";

                //Case 2: Load HTML file
                //chromeBrowser.LoadHtml("<html><body><h1>Hello world!</h1></body></html>", "http://example/");

                //Case 3: Use the Url
                var startupUrl = CefConfigHelper.GetStartupUrl(DevEnvironmentHelper.IsDevMode());

                chromeBrowser.Address = startupUrl;
            }
        }