Exemple #1
0
        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 WebBrowser();

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

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

            return(webView);
        }
Exemple #2
0
        public override FrameworkElement GetElement(string fileName)
        {
            var maxWidth  = SystemParameters.WorkArea.Width - 100;
            var maxHeight = SystemParameters.WorkArea.Height - 100;

            var webBrowser = new WebBrowser();

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

            webBrowser.Navigate(new Uri(fileName, UriKind.Absolute));

            return(webBrowser);
        }