void CefWrapper_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            EmployeeId = (int)e.NewValue;

            if (_isCefInitialized)
            {
                var urlToNavigate = "http://*****:*****@"CEF is not initialized.
                        (This is ok in design-mode! If this happens at runtime, you need to call MapWrapper.InitializeChromiumEmbedded() before instantiating the MapWrapper-control.)"
                };
            }
        }
Exemple #2
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.WebView = ((CefSharp.Wpf.WebView)(target));

            #line 22 "..\..\..\ChromiumSessionWindow.xaml"
                this.WebView.LoadCompleted += new CefSharp.LoadCompletedEventHandler(this.WebView_LoadCompleted);

            #line default
            #line hidden
                return;

            case 2:
                this.btnBack = ((System.Windows.Controls.Button)(target));

            #line 30 "..\..\..\ChromiumSessionWindow.xaml"
                this.btnBack.Click += new System.Windows.RoutedEventHandler(this.btnBack_Click);

            #line default
            #line hidden
                return;

            case 3:
                this.btnNext = ((System.Windows.Controls.Button)(target));

            #line 42 "..\..\..\ChromiumSessionWindow.xaml"
                this.btnNext.Click += new System.Windows.RoutedEventHandler(this.btnNext_Click);

            #line default
            #line hidden
                return;

            case 4:

            #line 59 "..\..\..\ChromiumSessionWindow.xaml"
                ((System.Windows.Controls.TextBox)(target)).KeyUp += new System.Windows.Input.KeyEventHandler(this.TextBox_KeyUp);

            #line default
            #line hidden
                return;

            case 5:
                this.btnRefresh = ((System.Windows.Controls.Button)(target));

            #line 67 "..\..\..\ChromiumSessionWindow.xaml"
                this.btnRefresh.Click += new System.Windows.RoutedEventHandler(this.btnRefresh_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
        public MainWindow(string url)
        {
            InitializeComponent();

            Mouse.OverrideCursor = Cursors.None;

            //RegistryKey reg = Registry.CurrentUser.CreateSubKey(Properties.Settings.Default.RegistryKey);
            //string url = (string)reg.GetValue("Url", "http://192.168.1.2");
            //reg.Close();

            web_view = new WebView(url, new CefSharp.BrowserSettings());

            this.mainGrid.Children.Add(web_view);
        }
        public WebViewContentControl()
        {
            string data;
            using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("MetroWebbrowser.Resources.theme.css"))
            using (var reader = new StreamReader(stream))
            {
                data = reader.ReadToEnd();
            }
            data = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(data));

            var bs = new BrowserSettings
            {
                UserStyleSheetEnabled = true,
                UserStyleSheetLocation = @"data:text/css;charset=utf-8;base64," + data
            };
            internal_web_view = new WebView("http://www.google.com", bs);
            internal_web_view.PropertyChanged += WebViewPropertyChanged;
            Content = internal_web_view;
        }
        public MainWindow()
        {
            InitializeComponent();

            CEF.Initialize(new Settings { CachePath = @".\cachepath" });

            var browserSettings = new BrowserSettings
            {
                UniversalAccessFromFileUrlsAllowed = true
            };

            var urlToNavigate = AppDomain.CurrentDomain.BaseDirectory + @"client\index.html";

            webView = new WebView(urlToNavigate, browserSettings);
            webView.LoadCompleted += webView_LoadCompleted;
            webView.RegisterJsObject("cefCallback", new CefBridge());

            CefSharpContainer.Children.Add(webView);
        }
        public void InitializeWebview()
        {
            Settings settings = new Settings
            {
#if DEBUG
                PackLoadingDisabled = false,
#else
                PackLoadingDisabled = true,
#endif
                CachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),"Battlelogium", "cache")
                
            };
            CEF.Initialize(settings);
            
            BrowserSettings browserSettings = new BrowserSettings
            {
                FileAccessFromFileUrlsAllowed = true,
                UniversalAccessFromFileUrlsAllowed = true,
#if CEF_DEVTOOLS
                DeveloperToolsDisabled = false,
#else
                DeveloperToolsDisabled = true,
#endif
                UserStyleSheetEnabled = true,
                //UserStyleSheetLocation = "data:text/css;charset=utf-8;base64,Ojotd2Via2l0LXNjcm9sbGJhcnt2aXNpYmlsaXR5OmhpZGRlbn0NCiNjb21tdW5pdHktYmFyIC5vdXRlcmFycm93e2Rpc3BsYXk6bm9uZX0="
                UserStyleSheetLocation = "data:text/css;charset=utf-8;base64,I2NvbW11bml0eS1iYXIgLm91dGVyYXJyb3d7ZGlzcGxheTpub25lfQ0KI2NvbW11bml0eS1iYXJ7cGFkZGluZzo1cHggMCFpbXBvcnRhbnR9DQo6Oi13ZWJraXQtc2Nyb2xsYmFye3dpZHRoOjZweDtoZWlnaHQ6NnB4O2JhY2tncm91bmQ6cmdiYSgxOSwyMiwyNiwwLjQpfQ0KOjotd2Via2l0LXNjcm9sbGJhci10cmFja3tiYWNrZ3JvdW5kOnJnYmEoMCwwLDAsMC4xKX0NCjo6LXdlYmtpdC1zY3JvbGxiYXItdGh1bWJ7YmFja2dyb3VuZDpyZ2JhKDAsMCwwLDAuMyl9DQo6Oi13ZWJraXQtc2Nyb2xsYmFyLXRodW1iOmhvdmVye2JhY2tncm91bmQ6cmdiYSgwLDAsMCwwLjQpfQ0KOjotd2Via2l0LXNjcm9sbGJhci10aHVtYjphY3RpdmV7YmFja2dyb3VuZDpyZ2JhKDAsMCwwLC42KX0=",
                /* UserStyleSheetLocation is the data in userstylesheet.css minified and encoded in utf8 base64 data URI*/


            };           
            this.battlelogWebview = new WebView(this.battlelogURL, browserSettings);
            this.battlelogWebview.RegisterJsObject("app", javascriptObject);
            this.battlelogWebview.LoadCompleted += this.LoadCompleted;
            this.battlelogWebview.PropertyChanged += battlelogWebview_PropertyChanged;
            this.battlelogWebview.RequestHandler = this;
            this.IsWebviewInitialized = true;
        }
 public void BrowserLoadSafeExpectedAttachesBrowserHandler()
 {
     var browser = new WebView();
     browser.LoadSafe("myfake.url");
     Assert.IsNotNull(browser.LoadHandler);
     Assert.IsNotNull(browser.LifeSpanHandler);
     Assert.IsNotNull(browser.RequestHandler);
 }
Exemple #8
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.MainGrid = ((System.Windows.Controls.Grid)(target));
     return;
     case 2:
     this.test = ((CefSharp.Wpf.WebView)(target));
     return;
     case 3:
     this.QueryBox = ((System.Windows.Controls.TextBox)(target));
     
     #line 9 "..\..\MainWindow.xaml"
     this.QueryBox.KeyDown += new System.Windows.Input.KeyEventHandler(this.enterHandler);
     
     #line default
     #line hidden
     return;
     case 4:
     
     #line 10 "..\..\MainWindow.xaml"
     ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.searchButton);
     
     #line default
     #line hidden
     return;
     case 5:
     this.SongList = ((System.Windows.Controls.ListBox)(target));
     
     #line 11 "..\..\MainWindow.xaml"
     this.SongList.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.newSong);
     
     #line default
     #line hidden
     return;
     case 6:
     this.prevButton = ((System.Windows.Controls.Button)(target));
     
     #line 12 "..\..\MainWindow.xaml"
     this.prevButton.Click += new System.Windows.RoutedEventHandler(this.prevSongButton);
     
     #line default
     #line hidden
     return;
     case 7:
     this.nextButton = ((System.Windows.Controls.Button)(target));
     
     #line 13 "..\..\MainWindow.xaml"
     this.nextButton.Click += new System.Windows.RoutedEventHandler(this.nextSongButton);
     
     #line default
     #line hidden
     return;
     }
     this._contentLoaded = true;
 }