public override FrameworkElement GetElement(string fileName)
        {
            var content = File.ReadAllLines(fileName);

            var url = content.FirstOrDefault(x => x.StartsWith("URL"));

            if (url == null)
            {
                return(null);
            }

            var maxWidth  = SystemParameters.WorkArea.Width - 100;
            var maxHeight = SystemParameters.WorkArea.Height - 100;

            var webView = new WebView();

            webView.BeginInit();
            webView.Width  = maxWidth / 2;
            webView.Height = maxHeight / 2;
            webView.EndInit();

            webView.Loaded += (sender, e) => ((WebView)sender).Navigate(url.Substring(4));

            return(webView);
        }
Beispiel #2
0
 public BrowserService()
 {
     _headlessWebView = new WebView();
     _headlessWebView.BeginInit(); // initialise the component. For some reason this does nothing.
     _headlessWebView.DOMContentLoaded    += HandleDomLoaded;
     _headlessWebView.NavigationCompleted += HandleNavigationCompleted;
     _headlessWebView.Loaded += HandleLoaded;
 }
Beispiel #3
0
        private WebView CreateSecondaryBrowser(IDxxWebViewContainer host)
        {
            Debug.Assert(PrimaryWebView != null);
            var wv = new WebView(PrimaryWebView.Process);

            wv.BeginInit();
            wv.EndInit();
            wv.IsScriptNotifyAllowed = true;
            Views.Add(wv, host);
            wv.Unloaded += OnWebViewUnloaded;
            return(wv);
        }