private void InitializeBrowser(ChromiumWebBrowser webBrowser) { webBrowser.RequestHandler = this; webBrowser.LifeSpanHandler = this; webBrowser.RegisterJsObject("callbackObject", this.callback); // So. Fun story. From https://github.com/cefsharp/CefSharp/issues/738#issuecomment-91099199, we need to set the zoom level // in the FrameLoadStart event. However, the IWpfWebBrowser's ZoomLevel is a DependencyProperty, and it wraps // the SetZoomLevel method on the unmanaged browser (which is exposed directly by ChromiumWebBrowser, but not by IWpfWebBrowser). // Now, FrameLoadState and FrameLoadEnd are called on a background thread, and since ZoomLevel is a DP, it can only be changed // from the UI thread (it's "helpful" and does a dispatcher check for us). But, if we dispatch back to the UI thread to call // ZoomLevel = xxx, then CEF seems to hit threading issues, and can sometimes render things entirely badly (massive icons, no // localization, bad spacing, no JavaScript at all, etc). // So, in this case, we need to call SetZoomLevel directly, as we can do that from the thread on which FrameLoadStart is called, // and everything's happy. // However, this means that the DP value isn't updated... Which means we can't use the DP at all. We have to call SetZoomLevel // *everywhere*, and that means keeping a local field zoomLevel to track the current zoom level. Such is life webBrowser.FrameLoadStart += (o, e) => webBrowser.SetZoomLevel(this.zoomLevel); webBrowser.FrameLoadEnd += (o, e) => { if (e.IsMainFrame && e.Url != "about:blank") { var script = @"$('#folders .panel-footer .pull-right').prepend(" + @"'<button class=""btn btn-sm btn-default"" onclick=""callbackObject.openFolder(angular.element(this).scope().folder.id)"">" + @"<span class=""fa fa-folder-open""></span>" + @"<span style=""margin-left: 3px"">" + Resources.ViewerView_OpenFolder + "</span></button>')"; webBrowser.ExecuteScriptAsync(script); } }; }
static void SetHeightFromDocument(ChromiumWebBrowser webControl) { webControl.EvaluateScriptAsync(@"(function() { var body = document.body, html = document.documentElement; var height = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ); return height; })();") .ContinueWith( height => { webControl.Height = (int) height.Result.Result + 20; // Take possible scrollbar into acct }); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.WebBrowser = ((CefSharp.Wpf.ChromiumWebBrowser)(target)); return; } this._contentLoaded = true; }
public WebBrowserForm_ViewModel_WPF( ILogger Logger_, INavigationService NavigationService_, ChromiumWebBrowser browser_ ) : base (Logger_,NavigationService_) { Browser = browser_; PropertyChanged += WebBrowserForm_ViewModel_WPF_PropertyChanged; }
//================== public void Start(string startUrl, bool useAlwaysInternalBrowser, bool useOffscreen = false) { #if WITHFAKEBROWSER this.theBrowser = new FakeBrowser(); GoToContentBrowserAddress(startUrl); #endif #if WITHCEF if (!useOffscreen) { this.theOnscreenBrowser = new CefSharp.Wpf.ChromiumWebBrowser(); GoToContentBrowserAddress(startUrl); } #endif #if WITHBROWSERPLUGIN // due to the nature of the plug-in, this forms as SINGLETON if (BrowserContainer.browserPlugin != null && BrowserContainer.theOnscreenBrowser != null) { // always fine return; } var pluginName = "AasxPluginWebBrowser"; var actionName = "get-browser-grid"; BrowserContainer.browserPlugin = Plugins.FindPluginInstance(pluginName); if (BrowserContainer.browserPlugin == null || !BrowserContainer.browserPlugin.HasAction(actionName)) { // ok, fallback BrowserContainer.browserPlugin = null; BrowserContainer.theOnscreenBrowser = null; this.theFallbackBrowser = new FakeBrowser(); this.browserHandlesFiles = fallbackBrowserHandlesFiles; GoToContentBrowserAddress(startUrl); } else { // setup var res = BrowserContainer.browserPlugin.InvokeAction(actionName, startUrl); if (res != null && res is AasxPluginResultBaseObject) { BrowserContainer.theOnscreenBrowser = (res as AasxPluginResultBaseObject).obj as Grid; } } #endif this.useAlwaysInternalBrowser = useAlwaysInternalBrowser; this.useOffscreen = useOffscreen; }
/// <summary> /// This method is used ignore script error for web browser control /// </summary> private static void HideScriptErrors(CefSharp.Wpf.ChromiumWebBrowser wb, bool hide) { System.Reflection.FieldInfo fieldComWebBrowser = typeof(CefSharp.Wpf.ChromiumWebBrowser).GetField("_axIWebBrowser2", BindingFlags.Instance | BindingFlags.NonPublic); if (fieldComWebBrowser == null) { return; } object objComWebBrowser = fieldComWebBrowser.GetValue(wb); if (objComWebBrowser == null) { return; } objComWebBrowser.GetType().InvokeMember("Silent", BindingFlags.SetProperty, null, objComWebBrowser, new object[] { hide }); }
public MainWindow() { InitializeComponent(); try { _Browser = new ChromiumWebBrowser(); //CefSettings setting = new CefSettings(); //Cef.Initialize(setting); //_Browser.Width = CTRL_BrowserPanel.Width; //_Browser.Height = CTRL_BrowserPanel.Height; CTRL_BrowserPanel.Children.Add(_Browser); // 注册事件 _Browser.AddressChanged += _Browser_AddressChanged; _Browser.LoadingStateChanged += _Browser_LoadingStateChanged; _Browser.FrameLoadEnd += _Browser_FrameLoadEnd; _Browser.ConsoleMessage += _Browser_ConsoleMessage; _Browser.Address = _defaultUrl; CTRL_URL.Text = _defaultUrl; CTRL_OrderDate.SelectedDate = DateTime.Now.Date.AddDays(7); String[] files = System.IO.Directory.GetFiles(Environment.CurrentDirectory + "\\JS\\"); List <String> jsFileNames = new List <string>(); if (files != null && files.Length > 0) { foreach (var file in files) { jsFileNames.Add(System.IO.Path.GetFileName(file)); } } CTRL_ScriptFileList.ItemsSource = jsFileNames; // 加载账号 String account = System.IO.File.ReadAllText(Environment.CurrentDirectory + "\\Phones.json"); List <Account> accountList = Newtonsoft.Json.JsonConvert.DeserializeObject <List <Account> >(account); CTRL_AccountList.ItemsSource = accountList; CTRL_AccountList.DisplayMemberPath = "phone"; CTRL_ScriptName.Text = "Order1_7-9.js"; //CTRL_ScriptFileList.IsEnabled = false; } catch (Exception ex) { MessageBox.Show("程序初始化异常:" + ex.Message + ex.StackTrace); } }
public MainWindow() { InitializeComponent(); Cef.Initialize(); m_chromeBrowser = new ChromiumWebBrowser(); m_object = new JavascriptObject(); //m_object.SetChromeBrowser(m_chromeBrowser); // Register the JavaScriptInteractionObj class with JS m_chromeBrowser.RegisterJsObject("DesktopClient", m_object); m_chromeBrowser.Address="http:/admin.primeanalytics.io"; mainGrid.Children.Add(m_chromeBrowser); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.webbro = ((CefSharp.Wpf.ChromiumWebBrowser)(target)); #line 10 "..\..\..\user_drive.xaml" this.webbro.AddHandler(System.Windows.Controls.Primitives.Selector.SelectedEvent, new System.Windows.RoutedEventHandler(this.OnTabBaixar)); #line default #line hidden return; } this._contentLoaded = true; }
private void Grid_Initialized(object sender, EventArgs e) { var grid = sender as System.Windows.Controls.Grid; if (grid == null) { return; } _Browser = new ChromiumWebBrowser(); _Browser.ZoomLevelIncrement = 0.10F; _Browser.IsBrowserInitializedChanged += ChromiumWebBrowser_IsBrowserInitializedChanged; grid.Children.Add(_Browser); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.cefBrowser = ((CefSharp.Wpf.ChromiumWebBrowser)(target)); #line 11 "..\..\..\MainWindow.xaml" this.cefBrowser.IsBrowserInitializedChanged += new System.Windows.DependencyPropertyChangedEventHandler(this.cefBrowser_IsBrowserInitializedChanged); #line default #line hidden return; } this._contentLoaded = true; }
private void LoadBrowser() { var setting = new CefSharp.CefSettings(); CefSharp.Cef.Initialize(setting); webView = new CefSharp.Wpf.ChromiumWebBrowser() { BrowserSettings = { DefaultEncoding = "UTF-8" }, JsDialogHandler = new BrowserDialog(), //MenuHandler = false, }; webView.PreviewTextInput += (obj, args) => { foreach (var character in args.Text) { // 把每个字符向浏览器组件发送一遍 webView.GetBrowser().GetHost().SendKeyEvent((int)WM.CHAR, (int)character, 0); } // 不让cef自己处理 args.Handled = true; }; webView.PreviewKeyDown += (obj, args) => { if (args.Key.ToString() == "F5") { webView.Address = "localhost"; } if (args.Key.ToString() == "F12") { webView.ShowDevTools(); } if (args.Key.ToString() == "Back") { webView.Back(); } }; webView.RegisterJsObject("csharp", new CallbackObjectForJs()); webView.Address = "localhost"; webView.FrameLoadEnd += OnLoadEnd; Content = webView; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.goStopButton = ((System.Windows.Controls.Button)(target)); return; case 2: #line 37 "..\..\..\..\Views\BrowserTabView.xaml" ((System.Windows.Controls.TextBox)(target)).GotKeyboardFocus += new System.Windows.Input.KeyboardFocusChangedEventHandler(this.OnTextBoxGotKeyboardFocus); #line default #line hidden #line 38 "..\..\..\..\Views\BrowserTabView.xaml" ((System.Windows.Controls.TextBox)(target)).GotMouseCapture += new System.Windows.Input.MouseEventHandler(this.OnTextBoxGotMouseCapture); #line default #line hidden return; case 3: this.angleSlider = ((System.Windows.Controls.Slider)(target)); return; case 4: this.opacitySlider = ((System.Windows.Controls.Slider)(target)); return; case 5: this.ExecuteJavascriptTextBox = ((System.Windows.Controls.TextBox)(target)); return; case 6: this.EvaluateJavascriptTextBox = ((System.Windows.Controls.TextBox)(target)); return; case 7: this.browser = ((CefSharp.Wpf.ChromiumWebBrowser)(target)); return; } this._contentLoaded = true; }
public MainWindow() { CefSettings settings = new CefSettings(); settings.RegisterScheme(new CefCustomScheme() { SchemeName = ResourceSchemeHandlerFactory.SchemeName, SchemeHandlerFactory = new ResourceSchemeHandlerFactory() }); Cef.Initialize(settings); browser = new ChromiumWebBrowser(); InitializeComponent(); container.Children.Add(browser); browser.Address = "resource://client-app/index.html "; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 9 "..\..\..\..\..\Tests\AuthTests\AuthWindow.xaml" ((TwitchAssistant.Tests.AuthTests.AuthWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded); #line default #line hidden return; case 2: this.WebBrowser = ((CefSharp.Wpf.ChromiumWebBrowser)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 9 "..\..\..\TransFile.xaml" ((Dragon_Translator.TransFile)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded); #line default #line hidden return; case 2: this.web = ((CefSharp.Wpf.ChromiumWebBrowser)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 11 "..\..\..\..\..\..\NoRefractorUi\UserInterface\AuthBrowserWindow\AuthBrowserView.xaml" ((TwitchAssistant.UserInterface.AuthBrowserWindow.AuthBrowserView)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded); #line default #line hidden return; case 2: this.ConectBrowser = ((CefSharp.Wpf.ChromiumWebBrowser)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.PopupButton = ((System.Windows.Controls.Button)(target)); #line 7 "..\..\MainWindow.xaml" this.PopupButton.Click += new System.Windows.RoutedEventHandler(this.PopupButton_OnClick); #line default #line hidden return; case 2: this.popup = ((System.Windows.Controls.Primitives.Popup)(target)); return; case 3: this.LoadingTextBlock = ((System.Windows.Controls.TextBlock)(target)); return; case 4: this.queryResultsWebBrowser = ((CefSharp.Wpf.ChromiumWebBrowser)(target)); #line 14 "..\..\MainWindow.xaml" this.queryResultsWebBrowser.FrameLoadStart += new System.EventHandler <CefSharp.FrameLoadStartEventArgs>(this.QueryResultsWebBrowser_OnFrameLoadStart); #line default #line hidden #line 15 "..\..\MainWindow.xaml" this.queryResultsWebBrowser.FrameLoadEnd += new System.EventHandler <CefSharp.FrameLoadEndEventArgs>(this.QueryResultsWebBrowser_OnFrameLoadEnd); #line default #line hidden return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.ChatBrowser = ((CefSharp.Wpf.ChromiumWebBrowser)(target)); return; case 2: this.ChatSettingsElement = ((System.Windows.Controls.Grid)(target)); return; case 3: this.ContextMenu = ((System.Windows.Controls.ContextMenu)(target)); return; case 4: this.UsebleLayout = ((System.Windows.Controls.Grid)(target)); return; } this._contentLoaded = true; }
public MainWindow() { // InitializeCef(); InitializeComponent(); var b = new CefSharp.Wpf.ChromiumWebBrowser(); ChrWb.Loaded += (e, a) => { var addr = string.Format("file://{0}/transptest/index.html", System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); ChrWb.Address = addr; }; ChrWb2.Loaded += (e, a) => { var addr = string.Format("file://{0}/transptest/semitransparent.png", System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); ChrWb2.Address = addr; }; ChrWb3.Loaded += (e, a) => { var addr = string.Format("file://{0}/transptest/gradient.html", System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); ChrWb3.Address = addr; }; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.Browser = ((CefSharp.Wpf.ChromiumWebBrowser)(target)); return; case 2: this.textBox = ((System.Windows.Controls.TextBox)(target)); return; case 3: this.button = ((System.Windows.Controls.Button)(target)); #line 17 "..\..\..\MainWindow.xaml" this.button.Click += new System.Windows.RoutedEventHandler(this.button_Click); #line default #line hidden return; } this._contentLoaded = true; }
public MainWindow() { InitializeComponent(); _jsBridge = new RecentCustomerBridge(); _jsBridge.OnCustomerReceived += _jsBridge_OnCustomerReceived; Cef.Initialize(new CefSettings { }); var browserSettings = new BrowserSettings { UniversalAccessFromFileUrls = CefState.Enabled, WebSecurity = CefState.Disabled }; Console.WriteLine(AppDomain.CurrentDomain.BaseDirectory); _chromium = new ChromiumWebBrowser { BrowserSettings = browserSettings, Address = AppDomain.CurrentDomain.BaseDirectory + "..\\..\\..\\..\\sample-webapp\\dist\\index.html" }; _chromium.RegisterJsObject("cefResponseChannel", _jsBridge); ChromiumContainer.Children.Add(_chromium); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.gameTitleBg = ((System.Windows.Shapes.Rectangle)(target)); return; case 2: this.gameTitle = ((System.Windows.Controls.Label)(target)); return; case 3: this.gameCategoryBg1 = ((System.Windows.Shapes.Rectangle)(target)); return; case 4: this.gameCategory1 = ((System.Windows.Controls.Label)(target)); return; case 5: this.gameCategoryBg2 = ((System.Windows.Shapes.Rectangle)(target)); return; case 6: this.gameCategory2 = ((System.Windows.Controls.Label)(target)); return; case 7: this.gameCategoryBg3 = ((System.Windows.Shapes.Rectangle)(target)); return; case 8: this.gameCategory3 = ((System.Windows.Controls.Label)(target)); return; case 9: this.middleLine = ((System.Windows.Shapes.Rectangle)(target)); return; case 10: this.leftLine = ((System.Windows.Shapes.Rectangle)(target)); return; case 11: this.rightLine = ((System.Windows.Shapes.Rectangle)(target)); return; case 12: this.leftBg = ((System.Windows.Shapes.Rectangle)(target)); return; case 13: this.rightBg = ((System.Windows.Shapes.Rectangle)(target)); return; case 14: this.gameDescriptionContour = ((System.Windows.Shapes.Rectangle)(target)); return; case 15: this.gameDescription = ((System.Windows.Controls.TextBox)(target)); return; case 16: this.gameDescriptionSafeguard = ((System.Windows.Shapes.Rectangle)(target)); return; case 17: this.gamePublisherUnderline = ((System.Windows.Shapes.Rectangle)(target)); return; case 18: this.gameDeveloperUnderline = ((System.Windows.Shapes.Rectangle)(target)); return; case 19: this.gamePublisher = ((System.Windows.Controls.Label)(target)); return; case 20: this.gameDeveloper = ((System.Windows.Controls.Label)(target)); return; case 21: this.gamePrice = ((System.Windows.Controls.Label)(target)); return; case 22: this.buyButton = ((System.Windows.Controls.Button)(target)); #line 82 "..\..\..\..\..\..\Panels\Pages\ShopPanel_Game.xaml" this.buyButton.Click += new System.Windows.RoutedEventHandler(this.FirstPurchaseButton); #line default #line hidden return; case 23: this.gamePromoGrid = ((System.Windows.Controls.Grid)(target)); return; case 24: this.gamePromo = ((System.Windows.Controls.Image)(target)); return; case 25: this.promoVideo = ((CefSharp.Wpf.ChromiumWebBrowser)(target)); #line 89 "..\..\..\..\..\..\Panels\Pages\ShopPanel_Game.xaml" this.promoVideo.LostFocus += new System.Windows.RoutedEventHandler(this.PromoVideo_OnLostFocus); #line default #line hidden return; case 26: this.rightPromoButton = ((System.Windows.Shapes.Rectangle)(target)); return; case 27: this.leftPromoButton = ((System.Windows.Shapes.Rectangle)(target)); return; case 28: this.leftArrow = ((System.Windows.Controls.Image)(target)); return; case 29: this.rightArrow = ((System.Windows.Controls.Image)(target)); return; case 30: this.promoFullscreenButton = ((System.Windows.Controls.Image)(target)); return; case 31: this.promoFullscreen = ((System.Windows.Controls.Grid)(target)); return; case 32: this.promoFullscreenBg = ((System.Windows.Shapes.Rectangle)(target)); return; case 33: this.gamePromoFullscreen = ((System.Windows.Controls.Image)(target)); return; case 34: this.closeFullscreenButton = ((System.Windows.Controls.Image)(target)); return; case 35: this.Movement = ((System.Windows.Media.TranslateTransform)(target)); return; case 36: this.Scale = ((System.Windows.Media.ScaleTransform)(target)); return; case 37: #line 125 "..\..\..\..\..\..\Panels\Pages\ShopPanel_Game.xaml" ((System.Windows.Media.Animation.Storyboard)(target)).Completed += new System.EventHandler(this.ShowCloseButton); #line default #line hidden return; case 38: #line 143 "..\..\..\..\..\..\Panels\Pages\ShopPanel_Game.xaml" ((System.Windows.Media.Animation.Storyboard)(target)).Completed += new System.EventHandler(this.HideFullscreenPromo); #line default #line hidden return; case 39: this.confirmPurchaseGrid = ((System.Windows.Controls.Grid)(target)); return; case 40: this.confirmMessage = ((System.Windows.Controls.Label)(target)); return; case 41: this.confirmPrice = ((System.Windows.Controls.Label)(target)); return; case 42: this.confirmButton = ((System.Windows.Controls.Button)(target)); #line 168 "..\..\..\..\..\..\Panels\Pages\ShopPanel_Game.xaml" this.confirmButton.Click += new System.Windows.RoutedEventHandler(this.ApprovePurchase); #line default #line hidden return; case 43: this.cancelButton = ((System.Windows.Controls.Button)(target)); #line 170 "..\..\..\..\..\..\Panels\Pages\ShopPanel_Game.xaml" this.cancelButton.Click += new System.Windows.RoutedEventHandler(this.CancelPurchase); #line default #line hidden return; case 44: this.MovementX = ((System.Windows.Media.TranslateTransform)(target)); return; case 45: #line 190 "..\..\..\..\..\..\Panels\Pages\ShopPanel_Game.xaml" ((System.Windows.Media.Animation.Storyboard)(target)).Completed += new System.EventHandler(this.HideConfirmGrid); #line default #line hidden return; case 46: this.Notification = ((System.Windows.Controls.Grid)(target)); return; case 47: this.NotificationLabel = ((System.Windows.Controls.Label)(target)); return; case 48: this.NotificationImage = ((System.Windows.Controls.Image)(target)); return; case 49: this.MovementX2 = ((System.Windows.Media.TranslateTransform)(target)); return; case 50: #line 222 "..\..\..\..\..\..\Panels\Pages\ShopPanel_Game.xaml" ((System.Windows.Media.Animation.Storyboard)(target)).Completed += new System.EventHandler(this.NotificationAnimCompleted); #line default #line hidden return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.Helpdesk = ((MahApps.Metro.Controls.Flyout)(target)); return; case 2: this.helpDeskDoc = ((System.Windows.Controls.RichTextBox)(target)); return; case 3: this.soundcloudViewButton = ((System.Windows.Controls.Button)(target)); #line 36 "..\..\..\MPBMain.xaml" this.soundcloudViewButton.Click += new System.Windows.RoutedEventHandler(this.soundcloudPenView_Click); #line default #line hidden return; case 4: #line 50 "..\..\..\MPBMain.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.settings_Click); #line default #line hidden return; case 5: #line 64 "..\..\..\MPBMain.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.helpDesk_Click); #line default #line hidden return; case 6: this.MPB_Main = ((System.Windows.Controls.Grid)(target)); return; case 7: this.soundcloudView = ((System.Windows.Controls.Grid)(target)); return; case 8: this.txtBox_songUrl = ((System.Windows.Controls.TextBox)(target)); #line 99 "..\..\..\MPBMain.xaml" this.txtBox_songUrl.KeyDown += new System.Windows.Input.KeyEventHandler(this.scOnKeyHandler); #line default #line hidden return; case 9: this.loadPageButton = ((System.Windows.Controls.Button)(target)); #line 100 "..\..\..\MPBMain.xaml" this.loadPageButton.Click += new System.Windows.RoutedEventHandler(this.loadPageButton_Click); #line default #line hidden return; case 10: this.genPlaysButton = ((System.Windows.Controls.Button)(target)); #line 102 "..\..\..\MPBMain.xaml" this.genPlaysButton.Click += new System.Windows.RoutedEventHandler(this.genPlaysButton_Click); #line default #line hidden return; case 11: this.genPlaysNumber = ((System.Windows.Controls.Label)(target)); return; case 12: this.maxPlays = ((System.Windows.Controls.TextBox)(target)); return; case 13: this.genPlaysCancel = ((System.Windows.Controls.Button)(target)); #line 107 "..\..\..\MPBMain.xaml" this.genPlaysCancel.Click += new System.Windows.RoutedEventHandler(this.genPlaysCancel_Click); #line default #line hidden return; case 14: this.tbPlays = ((System.Windows.Controls.TextBox)(target)); return; case 15: this.proxyChechbox = ((System.Windows.Controls.CheckBox)(target)); #line 110 "..\..\..\MPBMain.xaml" this.proxyChechbox.Checked += new System.Windows.RoutedEventHandler(this.useProxyServer); #line default #line hidden return; case 16: this.loadProxies = ((System.Windows.Controls.Button)(target)); #line 111 "..\..\..\MPBMain.xaml" this.loadProxies.Click += new System.Windows.RoutedEventHandler(this.loadProxies_Click); #line default #line hidden return; case 17: this.proxyListbox = ((System.Windows.Controls.ListBox)(target)); return; case 18: this.proxylistLabel = ((System.Windows.Controls.Label)(target)); return; case 19: this.accountLoginButton = ((System.Windows.Controls.Button)(target)); #line 121 "..\..\..\MPBMain.xaml" this.accountLoginButton.Click += new System.Windows.RoutedEventHandler(this.accountLoginButton_Click); #line default #line hidden return; case 20: this.accountLogoutButton = ((System.Windows.Controls.Button)(target)); #line 122 "..\..\..\MPBMain.xaml" this.accountLogoutButton.Click += new System.Windows.RoutedEventHandler(this.accountLogoutButton_Click); #line default #line hidden return; case 21: this.userNameTb = ((System.Windows.Controls.TextBox)(target)); return; case 22: this.accountNameLabel = ((System.Windows.Controls.Label)(target)); return; case 23: this.passwordTb = ((System.Windows.Controls.TextBox)(target)); return; case 24: this.passwordLabel = ((System.Windows.Controls.Label)(target)); return; case 25: this.accountListDataGrid = ((System.Windows.Controls.DataGrid)(target)); #line 127 "..\..\..\MPBMain.xaml" this.accountListDataGrid.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.accountListDataGrid_SelectionChanged); #line default #line hidden return; case 26: #line 131 "..\..\..\MPBMain.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.accountDelete_Click); #line default #line hidden return; case 27: this.saveAccounts = ((System.Windows.Controls.Button)(target)); #line 137 "..\..\..\MPBMain.xaml" this.saveAccounts.Click += new System.Windows.RoutedEventHandler(this.saveAccountList_Click); #line default #line hidden return; case 28: this.additionalSongs = ((System.Windows.Controls.DataGrid)(target)); #line 138 "..\..\..\MPBMain.xaml" this.additionalSongs.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.songSet_SelectionChanged); #line default #line hidden return; case 29: #line 141 "..\..\..\MPBMain.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.songSetDelete_Click); #line default #line hidden return; case 30: this.rotationCheckBox = ((System.Windows.Controls.CheckBox)(target)); return; case 31: this.genPlaysCancel_Copy = ((System.Windows.Controls.Button)(target)); #line 148 "..\..\..\MPBMain.xaml" this.genPlaysCancel_Copy.Click += new System.Windows.RoutedEventHandler(this.saveSongList_Click); #line default #line hidden return; case 32: this.autoFollowButt = ((System.Windows.Controls.Button)(target)); #line 149 "..\..\..\MPBMain.xaml" this.autoFollowButt.Click += new System.Windows.RoutedEventHandler(this.autoFollowButt_Click); #line default #line hidden return; case 33: this.autoFollowButt_Copy = ((System.Windows.Controls.Button)(target)); #line 150 "..\..\..\MPBMain.xaml" this.autoFollowButt_Copy.Click += new System.Windows.RoutedEventHandler(this.likeHelicopter_Click); #line default #line hidden return; case 34: this.accountListLabel = ((System.Windows.Controls.Label)(target)); return; case 35: this.Max_Counts = ((System.Windows.Controls.Grid)(target)); return; case 36: this.maxFollowAccountsTxtBox = ((System.Windows.Controls.TextBox)(target)); return; case 37: this.maxFollowLabel = ((System.Windows.Controls.Label)(target)); return; case 38: this.maxLikesTxtBox = ((System.Windows.Controls.TextBox)(target)); return; case 39: this.maxFollowLabel_Copy1 = ((System.Windows.Controls.Label)(target)); return; case 40: this.maxRepostsTxt = ((System.Windows.Controls.TextBox)(target)); return; case 41: this.maxFollowLabel_Copy4 = ((System.Windows.Controls.Label)(target)); return; case 42: this.Counter_Labels = ((System.Windows.Controls.Grid)(target)); return; case 43: this.maxFollowLabel_Copy = ((System.Windows.Controls.Label)(target)); return; case 44: this.followedAccountsL = ((System.Windows.Controls.Label)(target)); return; case 45: this.maxFollowLabel_Copy2 = ((System.Windows.Controls.Label)(target)); return; case 46: this.likedLabel = ((System.Windows.Controls.Label)(target)); return; case 47: this.maxFollowLabel_Copy3 = ((System.Windows.Controls.Label)(target)); return; case 48: this.repostsLabel = ((System.Windows.Controls.Label)(target)); return; case 49: this.autoRepostButton = ((System.Windows.Controls.Button)(target)); #line 174 "..\..\..\MPBMain.xaml" this.autoRepostButton.Click += new System.Windows.RoutedEventHandler(this.repostBot_Click); #line default #line hidden return; case 50: this.loadProxies_Copy = ((System.Windows.Controls.Button)(target)); #line 175 "..\..\..\MPBMain.xaml" this.loadProxies_Copy.Click += new System.Windows.RoutedEventHandler(this.editProxies_Click); #line default #line hidden return; case 51: this.settingsView = ((System.Windows.Controls.Grid)(target)); return; case 52: this.devToolsButton = ((System.Windows.Controls.Button)(target)); #line 179 "..\..\..\MPBMain.xaml" this.devToolsButton.Click += new System.Windows.RoutedEventHandler(this.devToolsButton_Click); #line default #line hidden return; case 53: this.devToolsButton_Copy = ((System.Windows.Controls.Button)(target)); #line 182 "..\..\..\MPBMain.xaml" this.devToolsButton_Copy.Click += new System.Windows.RoutedEventHandler(this.openNewInstance); #line default #line hidden return; case 54: this.License_Grid = ((System.Windows.Controls.Grid)(target)); return; case 55: this.publicKeyTb = ((System.Windows.Controls.TextBox)(target)); return; case 56: this.licenseTb = ((System.Windows.Controls.TextBox)(target)); return; case 57: this.validateLicenseButton = ((System.Windows.Controls.Button)(target)); #line 188 "..\..\..\MPBMain.xaml" this.validateLicenseButton.Click += new System.Windows.RoutedEventHandler(this.validateLicense_Click); #line default #line hidden return; case 58: this.Browser = ((CefSharp.Wpf.ChromiumWebBrowser)(target)); return; } this._contentLoaded = true; }
public bool Load(string Path, bool AssemblyOnly = false) { try { // 구성 파일 로드 if (!AssemblyOnly) { LoadConfig(Path); } if (AssemblyFile.Equals("local")) { // 내부 어셈블리 사용 switch (AssemblyEntry) { case "WebView": BorderContent.Background = Brushes.Black; ChromiumWebBrowser WebView = new ChromiumWebBrowser(); WebView.Address = AssemblyArgument; BorderContent.Child = WebView; break; } } else { // 외부 어셈블리 참조 Assembly WidgetAssembly = Assembly.LoadFrom(AssemblyFile); Type[] TypeList = WidgetAssembly.GetTypes(); foreach (Type Target in TypeList) { if (Target.Name == AssemblyEntry) { // 어셈블리 진입점 검색 및 인스턴스 생성 _WidgetTarget = Target; _WidgetControl = Activator.CreateInstance(Target) as UserControl; // 어셈블리에 전달할 인자가 존재하는 경우 메소드 호출 if (AssemblyArgument.Length > 0) { CallMethod("SetArgument", AssemblyArgument); } break; } }; // 검색된 컨트롤을 현재 컨트롤에 추가 BorderContent.Child = WidgetControl; } return true; } catch { return false; } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.WindowName = ((System.Windows.Controls.Label)(target)); return; case 2: #line 40 "..\..\..\..\MainWindow - Копировать.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.OffButton_Click); #line default #line hidden return; case 3: this.Maps = ((CefSharp.Wpf.ChromiumWebBrowser)(target)); return; case 4: this.TimeLabel = ((System.Windows.Controls.Label)(target)); return; case 5: this.TasksButton = ((System.Windows.Controls.Button)(target)); #line 47 "..\..\..\..\MainWindow - Копировать.xaml" this.TasksButton.Click += new System.Windows.RoutedEventHandler(this.TasksButton_Click); #line default #line hidden return; case 6: this.MapsButton = ((System.Windows.Controls.Button)(target)); #line 48 "..\..\..\..\MainWindow - Копировать.xaml" this.MapsButton.Click += new System.Windows.RoutedEventHandler(this.MapsButton_Click); #line default #line hidden return; case 7: #line 54 "..\..\..\..\MainWindow - Копировать.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.OnButton_Click); #line default #line hidden return; case 8: this.OffScreen = ((System.Windows.Controls.Canvas)(target)); return; case 9: this.tasksList = ((System.Windows.Controls.ListBox)(target)); return; } this._contentLoaded = true; }
protected override void OnClose() { this.WebBrowser.Dispose(); this.WebBrowser = null; // This is such a dirty, horrible, hacky thing to do... // So it turns out that doesn't like being shut down, then re-initialized, see http://www.magpcss.org/ceforum/viewtopic.php?f=6&t=10807&start=10 // and others. However, if we wait a little while (presumably for the WebBrowser to die and all open connections to the subprocess // to close), then kill it in a very dirty way (by killing the process rather than calling Cef.Shutdown), it springs back to life // when Cef.Initialize is called again. // I'm not 100% it's not leaking something somewhere, but it seems to work, and saves 50MB of idle memory usage // However, I'm not comfortable enough with this to enable it permanently yet //await Task.Delay(5000); //CefSharpHelper.TerminateCefSharpProcess(); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 12 "..\..\DishDetailScreen.xaml" ((FoodRecipeApp.DishDetailScreen)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded); #line default #line hidden return; case 2: this.TitleBar = ((System.Windows.Controls.Grid)(target)); return; case 3: this.Back = ((System.Windows.Controls.Button)(target)); #line 27 "..\..\DishDetailScreen.xaml" this.Back.Click += new System.Windows.RoutedEventHandler(this.Back_Click); #line default #line hidden return; case 4: this.Carousel = ((System.Windows.Controls.StackPanel)(target)); return; case 5: this.CarouselTransform = ((System.Windows.Media.TranslateTransform)(target)); return; case 6: this.DishNameLabel = ((System.Windows.Controls.Label)(target)); return; case 7: this.dishDesTextBlock = ((System.Windows.Controls.TextBlock)(target)); return; case 8: this.dishIngTextBlock = ((System.Windows.Controls.TextBlock)(target)); return; case 9: this.dishImage = ((System.Windows.Controls.Image)(target)); return; case 10: this.tagList = ((System.Windows.Controls.ListView)(target)); return; case 11: this.videoGrid = ((System.Windows.Controls.Grid)(target)); return; case 12: this.videoSP = ((System.Windows.Controls.StackPanel)(target)); return; case 13: this.videolabel = ((System.Windows.Controls.Label)(target)); return; case 14: this.videocef = ((CefSharp.Wpf.ChromiumWebBrowser)(target)); return; case 15: this.stepDetailView = ((System.Windows.Controls.ListView)(target)); return; case 17: this.leftBtn = ((System.Windows.Controls.Button)(target)); #line 170 "..\..\DishDetailScreen.xaml" this.leftBtn.Click += new System.Windows.RoutedEventHandler(this.leftBtn_Click); #line default #line hidden return; case 18: this.RightBtn = ((System.Windows.Controls.Button)(target)); #line 181 "..\..\DishDetailScreen.xaml" this.RightBtn.Click += new System.Windows.RoutedEventHandler(this.RightBtn_Click); #line default #line hidden return; case 19: this.NavigatorBar = ((System.Windows.Controls.Grid)(target)); return; case 20: this.CarouselBtnSkip = ((System.Windows.Controls.ListView)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.loadGrid = ((System.Windows.Controls.Grid)(target)); return; case 2: this.appGrid = ((System.Windows.Controls.Grid)(target)); return; case 3: #line 137 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.Border)(target)).MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.titleBar_MouseMove); #line default #line hidden return; case 4: #line 147 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.miniminzeButton_Click); #line default #line hidden return; case 5: #line 150 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.maximizeButton_Click); #line default #line hidden return; case 6: #line 153 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.closeButton_Click); #line default #line hidden return; case 7: #line 169 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.whatsapp_Click); #line default #line hidden return; case 8: #line 180 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.whatsapp_RefreshClick); #line default #line hidden return; case 9: #line 187 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.threema_Click); #line default #line hidden return; case 10: #line 198 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.threema_RefreshClick); #line default #line hidden return; case 11: #line 205 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.telegram_Click); #line default #line hidden return; case 12: #line 216 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.telegram_RefreshClick); #line default #line hidden return; case 13: #line 223 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.slack_Click); #line default #line hidden return; case 14: #line 234 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.slack_RefreshClick); #line default #line hidden return; case 15: #line 241 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.msteams_Click); #line default #line hidden return; case 16: #line 252 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.msteams_RefreshClick); #line default #line hidden return; case 17: this.browser_whatsapp = ((CefSharp.Wpf.ChromiumWebBrowser)(target)); return; case 18: this.browser_threema = ((CefSharp.Wpf.ChromiumWebBrowser)(target)); return; case 19: this.browser_telegram = ((CefSharp.Wpf.ChromiumWebBrowser)(target)); return; case 20: this.browser_slack = ((CefSharp.Wpf.ChromiumWebBrowser)(target)); return; case 21: this.browser_msteams = ((CefSharp.Wpf.ChromiumWebBrowser)(target)); return; } this._contentLoaded = true; }
public bool Load(string Path) { try { // 위젯 분석 INI Widget = new INI(Path); string Local = "<%LOCAL%>"; _INI = Path; _Title = Widget.GetValue("General", "Title"); _Author = Widget.GetValue("General", "Author"); _Summary = Widget.GetValue("General", "Summary"); _AssemblyFile = Widget.GetValue("Assembly", "File").Replace(Local, System.IO.Path.GetDirectoryName(Path)).Trim(); _AssemblyEntry = Widget.GetValue("Assembly", "Entry").Replace(Local, System.IO.Path.GetDirectoryName(Path)).Trim(); _AssemblyArgument = Widget.GetValue("Assembly", "Argument").Replace(Local, System.IO.Path.GetDirectoryName(Path)).Trim(); _AppearanceWidth = int.Parse(Widget.GetValue("Appearance", "Width")); _AppearanceHeight = int.Parse(Widget.GetValue("Appearance", "Height")); _AppearanceExpandable = bool.Parse(Widget.GetValue("Appearance", "Expandable")); if (AssemblyFile.Equals("local")) { // 내부 어셈블리 사용 switch (AssemblyEntry) { case "WebView": ChromiumWebBrowser WebView = new ChromiumWebBrowser(); WebView.Address = AssemblyArgument; BorderContent.Child = WebView; break; } } else { // 외부 어셈블리 참조 Assembly WidgetAssembly = Assembly.LoadFrom(AssemblyFile); Type[] TypeList = WidgetAssembly.GetTypes(); foreach (Type Target in TypeList) { if (Target.Name == AssemblyEntry) { // 어셈블리 진입점 검색 및 인스턴스 생성 _WidgetTarget = Target; _WidgetControl = Activator.CreateInstance(Target) as UserControl; // 어셈블리에 전달할 인자가 존재하는 경우 메소드 호출 if (AssemblyArgument.Length > 0) { CallMethod("SetArgument", AssemblyArgument); } break; } }; // 검색된 컨트롤을 현재 컨트롤에 추가 BorderContent.Child = WidgetControl; } // 위젯 모양새 적용 if (ParentDock != null) { Width = AppearanceWidth * ParentDock.GridWidth; Height = AppearanceHeight * ParentDock.GridHeight; } else { WidthColumn = AppearanceWidth; HeightRow = AppearanceHeight; } return true; } catch { return false; } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.goStopButton = ((System.Windows.Controls.Button)(target)); return; case 2: #line 37 "..\..\..\..\Views\BrowserTabView.xaml" ((System.Windows.Controls.TextBox)(target)).GotKeyboardFocus += new System.Windows.Input.KeyboardFocusChangedEventHandler(this.OnTextBoxGotKeyboardFocus); #line default #line hidden #line 38 "..\..\..\..\Views\BrowserTabView.xaml" ((System.Windows.Controls.TextBox)(target)).GotMouseCapture += new System.Windows.Input.MouseEventHandler(this.OnTextBoxGotMouseCapture); #line default #line hidden return; case 3: this.angleSlider = ((System.Windows.Controls.Slider)(target)); return; case 4: this.opacitySlider = ((System.Windows.Controls.Slider)(target)); return; case 5: this.ExecuteJavascriptTextBox = ((System.Windows.Controls.TextBox)(target)); return; case 6: this.GroupBoxCtrl = ((System.Windows.Controls.GroupBox)(target)); return; case 7: this.ComboBoxType = ((System.Windows.Controls.ComboBox)(target)); return; case 8: this.TextBoxStatus = ((System.Windows.Controls.TextBox)(target)); return; case 9: this.btnRun = ((System.Windows.Controls.Button)(target)); return; case 10: this.OrderList = ((System.Windows.Controls.ListView)(target)); return; case 11: this.GroupBoxJS = ((System.Windows.Controls.GroupBox)(target)); return; case 12: this.EvaluateJavascriptTextBox = ((System.Windows.Controls.TextBox)(target)); return; case 13: this.browser = ((CefSharp.Wpf.ChromiumWebBrowser)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 104 "..\..\MainWindow.xaml" ((System.Windows.Controls.Border)(target)).MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.titleBar_MouseMove); #line default #line hidden return; case 2: #line 106 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.miniminzeButton_Click); #line default #line hidden return; case 3: #line 109 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.maximizeButton_Click); #line default #line hidden return; case 4: #line 112 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.closeButton_Click); #line default #line hidden return; case 5: #line 127 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.whatsapp_Click); #line default #line hidden return; case 6: #line 140 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.threema_Click); #line default #line hidden return; case 7: this.browser_whatsapp = ((CefSharp.Wpf.ChromiumWebBrowser)(target)); return; case 8: this.browser_threema = ((CefSharp.Wpf.ChromiumWebBrowser)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.PopupButton = ((System.Windows.Controls.Button)(target)); #line 7 "..\..\MainWindow.xaml" this.PopupButton.Click += new System.Windows.RoutedEventHandler(this.PopupButton_OnClick); #line default #line hidden return; case 2: this.popup = ((System.Windows.Controls.Primitives.Popup)(target)); return; case 3: this.LoadingTextBlock = ((System.Windows.Controls.TextBlock)(target)); return; case 4: this.queryResultsWebBrowser = ((CefSharp.Wpf.ChromiumWebBrowser)(target)); #line 14 "..\..\MainWindow.xaml" this.queryResultsWebBrowser.FrameLoadStart += new System.EventHandler<CefSharp.FrameLoadStartEventArgs>(this.QueryResultsWebBrowser_OnFrameLoadStart); #line default #line hidden #line 15 "..\..\MainWindow.xaml" this.queryResultsWebBrowser.FrameLoadEnd += new System.EventHandler<CefSharp.FrameLoadEndEventArgs>(this.QueryResultsWebBrowser_OnFrameLoadEnd); #line default #line hidden return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 10 "..\..\..\MainWindow.xaml" ((WebBrowsers.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded); #line default #line hidden #line 10 "..\..\..\MainWindow.xaml" ((WebBrowsers.MainWindow)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.Window_Closing); #line default #line hidden return; case 2: this.grid = ((System.Windows.Controls.Grid)(target)); return; case 3: this.utlsmenuStackPanel = ((System.Windows.Controls.StackPanel)(target)); return; case 4: this.textBox = ((System.Windows.Controls.TextBox)(target)); #line 25 "..\..\..\MainWindow.xaml" this.textBox.KeyDown += new System.Windows.Input.KeyEventHandler(this.textBox_KeyDown); #line default #line hidden return; case 5: #line 26 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click); #line default #line hidden return; case 6: #line 27 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_1); #line default #line hidden return; case 7: #line 28 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_2); #line default #line hidden return; case 8: this.webBrowser = ((System.Windows.Controls.WebBrowser)(target)); #line 32 "..\..\..\MainWindow.xaml" this.webBrowser.Navigated += new System.Windows.Navigation.NavigatedEventHandler(this.webBrowser_Navigated); #line default #line hidden return; case 9: this.webBrowserTextBlock = ((System.Windows.Controls.TextBlock)(target)); return; case 10: this.chromiumWebBrowser = ((CefSharp.Wpf.ChromiumWebBrowser)(target)); return; case 11: this.chromiumWebBrowserTextBlock = ((System.Windows.Controls.TextBlock)(target)); return; case 12: this.eoWebControl = ((EO.WebBrowser.Wpf.WebControl)(target)); return; case 13: this.eoWebControlTextBlock = ((System.Windows.Controls.TextBlock)(target)); return; } this._contentLoaded = true; }
public FrameworkElement Initialize() { if (!Cef.IsInitialized) { var path = PluginsManager.Instance.GetPluginDirectory("CefSharp"); var settings = new CefSettings { UserAgent = DefaultUserAgent, MultiThreadedMessageLoop = true, LogSeverity = LogSeverity.Disable, CachePath = FilesStorage.Instance.GetTemporaryFilename(@"Cef"), UserDataPath = FilesStorage.Instance.GetTemporaryFilename(@"Cef"), BrowserSubprocessPath = Path.Combine(path, "CefSharp.BrowserSubprocess.exe"), LocalesDirPath = Path.Combine(path, "locales"), ResourcesDirPath = Path.Combine(path), Locale = SettingsHolder.Locale.LocaleName, #if DEBUG RemoteDebuggingPort = 45451, #endif }; settings.RegisterScheme(new CefCustomScheme { SchemeName = AltFilesHandlerFactory.SchemeName, SchemeHandlerFactory = new AltFilesHandlerFactory() }); Cef.Initialize(settings, false, null); } _requestHandler = new RequestHandler { UserAgent = DefaultUserAgent }; _inner = new ChromiumWebBrowser { BrowserSettings = { FileAccessFromFileUrls = CefState.Enabled, UniversalAccessFromFileUrls = CefState.Enabled, WebSecurity = CefState.Disabled }, RequestHandler = _requestHandler, MenuHandler = new MenuHandler() }; _inner.FrameLoadStart += OnFrameLoadStart; _inner.FrameLoadEnd += OnFrameLoadEnd; return _inner; }
public static string GetHtml(CefSharp.Wpf.ChromiumWebBrowser d) { return((string)d.GetValue(HtmlProperty)); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.container = ((System.Windows.Controls.Grid)(target)); return; case 2: this.startPage = ((WebExpress.StartPage)(target)); return; case 3: this.WebView = ((CefSharp.Wpf.ChromiumWebBrowser)(target)); #line 44 "..\..\..\..\Applets\TabView.xaml" this.WebView.PreviewMouseDown += new System.Windows.Input.MouseButtonEventHandler(this.WebView_PreviewMouseDown); #line default #line hidden return; case 4: this.ListContainer = ((System.Windows.Controls.Grid)(target)); return; case 5: this.MagicBox = ((WebExpress.Controls.MagicBox)(target)); return; case 6: this.Panel = ((System.Windows.Controls.Grid)(target)); #line 56 "..\..\..\..\Applets\TabView.xaml" this.Panel.MouseEnter += new System.Windows.Input.MouseEventHandler(this.Panel_MouseEnter); #line default #line hidden #line 56 "..\..\..\..\Applets\TabView.xaml" this.Panel.MouseLeave += new System.Windows.Input.MouseEventHandler(this.Panel_MouseLeave); #line default #line hidden return; case 7: this.textBox = ((System.Windows.Controls.TextBox)(target)); #line 61 "..\..\..\..\Applets\TabView.xaml" this.textBox.KeyDown += new System.Windows.Input.KeyEventHandler(this.textBox_KeyDown); #line default #line hidden #line 61 "..\..\..\..\Applets\TabView.xaml" this.textBox.GotMouseCapture += new System.Windows.Input.MouseEventHandler(this.textBox_GotMouseCapture); #line default #line hidden return; case 8: this.Back = ((WebExpress.Controls.IconButton)(target)); return; case 9: this.Forward = ((WebExpress.Controls.IconButton)(target)); return; case 10: this.RefreshButton = ((WebExpress.Controls.IconButton)(target)); return; case 11: this.MenuButton = ((WebExpress.Controls.IconButton)(target)); return; case 12: this.BookmarkButton = ((WebExpress.Controls.IconButton)(target)); return; case 13: this.SnackBar = ((WebExpress.Controls.SnackBar)(target)); return; } this._contentLoaded = true; }
/// <summary> /// Property To set Dependency Property /// </summary> /// <param name="d"></param> /// <param name="value"></param> public static void SetHtml(CefSharp.Wpf.ChromiumWebBrowser d, string value) { d.SetValue(HtmlProperty, value); }
protected override void OnInitialActivate() { if (!Cef.IsInitialized) { var configuration = this.configurationProvider.Load(); var settings = new CefSettings() { RemoteDebuggingPort = AppSettings.Instance.CefRemoteDebuggingPort, // We really only want to set the LocalStorage path, but we don't have that level of control.... CachePath = this.pathsProvider.CefCachePath, IgnoreCertificateErrors = true, }; // System proxy settings (which also specify a proxy for localhost) shouldn't affect us settings.CefCommandLineArgs.Add("no-proxy-server", "1"); if (configuration.DisableHardwareRendering) { settings.CefCommandLineArgs.Add("disable-gpu", "1"); settings.CefCommandLineArgs.Add("disable-gpu-vsync", "1"); } Cef.Initialize(settings); } var webBrowser = new ChromiumWebBrowser(); this.InitializeBrowser(webBrowser); this.WebBrowser = webBrowser; this.RefreshBrowser(); }
private void InitializeBrowser(ChromiumWebBrowser webBrowser) { webBrowser.RequestHandler = this; webBrowser.LifeSpanHandler = this; // Enable WPF touch scrolling - may cause issues, see https://github.com/cefsharp/CefSharp/pull/1418 webBrowser.IsManipulationEnabled = true; webBrowser.RegisterJsObject("callbackObject", this.callback); // So. Fun story. From https://github.com/cefsharp/CefSharp/issues/738#issuecomment-91099199, we need to set the zoom level // in the FrameLoadStart event. However, the IWpfWebBrowser's ZoomLevel is a DependencyProperty, and it wraps // the SetZoomLevel method on the unmanaged browser (which is exposed directly by ChromiumWebBrowser, but not by IWpfWebBrowser). // Now, FrameLoadState and FrameLoadEnd are called on a background thread, and since ZoomLevel is a DP, it can only be changed // from the UI thread (it's "helpful" and does a dispatcher check for us). But, if we dispatch back to the UI thread to call // ZoomLevel = xxx, then CEF seems to hit threading issues, and can sometimes render things entirely badly (massive icons, no // localization, bad spacing, no JavaScript at all, etc). // So, in this case, we need to call SetZoomLevel directly, as we can do that from the thread on which FrameLoadStart is called, // and everything's happy. // However, this means that the DP value isn't updated... Which means we can't use the DP at all. We have to call SetZoomLevel // *everywhere*, and that means keeping a local field zoomLevel to track the current zoom level. Such is life webBrowser.FrameLoadStart += (o, e) => webBrowser.SetZoomLevel(this.zoomLevel); webBrowser.FrameLoadEnd += (o, e) => { if (e.Frame.IsMain && e.Url != "about:blank") { var addOpenFolder = @"$('#folders .panel-footer .pull-right').prepend(" + @" '<button class=""btn btn-sm btn-default"" onclick=""callbackObject.openFolder(angular.element(this).scope().folder.id)"">" + @" <span class=""fa fa-folder-open""></span>" + @" <span style=""margin-left: 3px"">" + Resources.ViewerView_OpenFolder + @"</span>" + @" </button>')"; webBrowser.ExecuteScriptAsync(addOpenFolder); var addFolderBrowse = @"$('#folderPath').wrap($('<div/>').css('display', 'flex'));" + @"$('#folderPath').after(" + @" $('<button>').attr('id', 'folderPathBrowseButton')" + @" .addClass('btn btn-sm btn-default')" + @" .html('" + Resources.ViewerView_BrowseToFolder + @"')" + @" .css({'flex-grow': 1, 'margin': '0 0 0 5px'})" + @" .on('click', function() { callbackObject.browseFolderPath() })" + @");" + @"$('#folderPath').removeAttr('list');" + @"$('#directory-list').remove();" + @"$('#editFolder').on('shown.bs.modal', function() {" + @" if ($('#folderPath').is('[readonly]')) {" + @" $('#folderPathBrowseButton').attr('disabled', 'disabled');" + @" }" + @" else {" + @" $('#folderPathBrowseButton').removeAttr('disabled');" + @" }" + @"});"; webBrowser.ExecuteScriptAsync(addFolderBrowse); } }; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 10 "..\..\..\MainWindow.xaml" ((WpfApp1.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded); #line default #line hidden return; case 2: this.kinectViewer = ((WpfApp1.KinectViewer)(target)); return; case 3: this.myWeb = ((CefSharp.Wpf.ChromiumWebBrowser)(target)); #line 37 "..\..\..\MainWindow.xaml" this.myWeb.Loaded += new System.Windows.RoutedEventHandler(this.ChromiumWebBrowser_Loaded); #line default #line hidden return; case 4: this.reset = ((System.Windows.Controls.Button)(target)); #line 45 "..\..\..\MainWindow.xaml" this.reset.Click += new System.Windows.RoutedEventHandler(this.reset_Click); #line default #line hidden return; case 5: this.save = ((System.Windows.Controls.Button)(target)); #line 46 "..\..\..\MainWindow.xaml" this.save.Click += new System.Windows.RoutedEventHandler(this.save_Click); #line default #line hidden return; case 6: this.slider = ((System.Windows.Controls.Slider)(target)); return; case 7: this.btnSlide = ((System.Windows.Controls.Button)(target)); #line 52 "..\..\..\MainWindow.xaml" this.btnSlide.Click += new System.Windows.RoutedEventHandler(this.btnSlide_Click); #line default #line hidden return; case 8: this.Yes = ((System.Windows.Controls.Image)(target)); return; case 9: this.No = ((System.Windows.Controls.Image)(target)); return; case 10: this.titre = ((System.Windows.Controls.TextBlock)(target)); return; case 11: this.listeGestes = ((System.Windows.Controls.ListBox)(target)); return; case 12: this.titre2 = ((System.Windows.Controls.TextBlock)(target)); return; case 13: this.listeGestes2 = ((System.Windows.Controls.ListBox)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.tabControl = ((System.Windows.Controls.TabControl)(target)); return; case 2: this.gridSplitter = ((System.Windows.Controls.GridSplitter)(target)); return; case 3: this.dataGridView1 = ((System.Windows.Controls.DataGrid)(target)); return; case 4: this.webPagePreview = ((CefSharp.Wpf.ChromiumWebBrowser)(target)); return; case 5: this.ICEStartButton = ((System.Windows.Controls.Button)(target)); #line 78 "..\..\..\MainWindow.xaml" this.ICEStartButton.Click += new System.Windows.RoutedEventHandler(this.StartButton_Click); #line default #line hidden return; case 6: this.gridSplitter1 = ((System.Windows.Controls.GridSplitter)(target)); return; case 7: this.ICEDownloaderSwitch = ((System.Windows.Controls.Slider)(target)); #line 90 "..\..\..\MainWindow.xaml" this.ICEDownloaderSwitch.ValueChanged += new System.Windows.RoutedPropertyChangedEventHandler <double>(this.slider_ValueChanged); #line default #line hidden return; case 8: this.QueueSelector = ((System.Windows.Controls.ComboBox)(target)); #line 95 "..\..\..\MainWindow.xaml" this.QueueSelector.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.QueueSelector_SelectionChanged); #line default #line hidden return; case 9: this.label = ((System.Windows.Controls.Label)(target)); return; case 10: this.label1 = ((System.Windows.Controls.Label)(target)); return; case 11: this.label2 = ((System.Windows.Controls.Label)(target)); return; case 12: this.ReconSwitch = ((System.Windows.Controls.Slider)(target)); #line 99 "..\..\..\MainWindow.xaml" this.ReconSwitch.ValueChanged += new System.Windows.RoutedPropertyChangedEventHandler <double>(this.slider_ValueChanged); #line default #line hidden return; case 13: this.addressBar = ((System.Windows.Controls.TextBox)(target)); return; case 14: this.label1_Copy = ((System.Windows.Controls.Label)(target)); return; case 15: this.olImporterSwitch = ((System.Windows.Controls.Slider)(target)); #line 106 "..\..\..\MainWindow.xaml" this.olImporterSwitch.ValueChanged += new System.Windows.RoutedPropertyChangedEventHandler <double>(this.slider_ValueChanged); #line default #line hidden return; case 16: this.label1_Copy1 = ((System.Windows.Controls.Label)(target)); return; case 17: this.SchedulerSwitch = ((System.Windows.Controls.Slider)(target)); #line 112 "..\..\..\MainWindow.xaml" this.SchedulerSwitch.ValueChanged += new System.Windows.RoutedPropertyChangedEventHandler <double>(this.slider_ValueChanged); #line default #line hidden return; case 18: this.ICEDownloaderStatus = ((System.Windows.Controls.Label)(target)); return; case 19: this.ICEOLImporterStatus = ((System.Windows.Controls.Label)(target)); return; case 20: this.ICEReconStatus = ((System.Windows.Controls.Label)(target)); return; case 21: this.ICESchedulerStatus = ((System.Windows.Controls.Label)(target)); return; case 22: this.CMEgridSplitter = ((System.Windows.Controls.GridSplitter)(target)); return; case 23: this.CMEdataGridView1 = ((System.Windows.Controls.DataGrid)(target)); return; case 24: this.CMEwebPagePreview = ((CefSharp.Wpf.ChromiumWebBrowser)(target)); return; case 25: this.CMEStartButton = ((System.Windows.Controls.Button)(target)); #line 183 "..\..\..\MainWindow.xaml" this.CMEStartButton.Click += new System.Windows.RoutedEventHandler(this.StartButton_Click); #line default #line hidden return; case 26: this.CMEgridSplitter1 = ((System.Windows.Controls.GridSplitter)(target)); return; case 27: this.CMEslider = ((System.Windows.Controls.Slider)(target)); #line 195 "..\..\..\MainWindow.xaml" this.CMEslider.ValueChanged += new System.Windows.RoutedPropertyChangedEventHandler <double>(this.slider_ValueChanged); #line default #line hidden return; case 28: this.CMEQueueSelector = ((System.Windows.Controls.ComboBox)(target)); #line 200 "..\..\..\MainWindow.xaml" this.CMEQueueSelector.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.QueueSelector_SelectionChanged); #line default #line hidden return; case 29: this.CMElabel = ((System.Windows.Controls.Label)(target)); return; case 30: this.CMElabel1 = ((System.Windows.Controls.Label)(target)); return; case 31: this.CMElabel2 = ((System.Windows.Controls.Label)(target)); return; case 32: this.CMEslider_Copy = ((System.Windows.Controls.Slider)(target)); #line 204 "..\..\..\MainWindow.xaml" this.CMEslider_Copy.ValueChanged += new System.Windows.RoutedPropertyChangedEventHandler <double>(this.slider_ValueChanged); #line default #line hidden return; case 33: this.CMEaddressBar = ((System.Windows.Controls.TextBox)(target)); return; case 34: this.CMElabel1_Copy = ((System.Windows.Controls.Label)(target)); return; case 35: this.CMEslider_Copy1 = ((System.Windows.Controls.Slider)(target)); #line 211 "..\..\..\MainWindow.xaml" this.CMEslider_Copy1.ValueChanged += new System.Windows.RoutedPropertyChangedEventHandler <double>(this.slider_ValueChanged); #line default #line hidden return; } this._contentLoaded = true; }
public MainWindow() { InitializeComponent(); Cef.Initialize(new CefSettings { CachePath = @".\cachepath" }); var urlToNavigate = AppDomain.CurrentDomain.BaseDirectory + @"client\index.html"; var browserSettings = new BrowserSettings { UniversalAccessFromFileUrlsAllowed = true, WebSecurityDisabled = true }; webBrowser = new ChromiumWebBrowser(); webBrowser.Address = urlToNavigate; webBrowser.BrowserSettings = browserSettings; webBrowser.RegisterJsObject("cefCallback", new CefBridge()); CefSharpContainer.Children.Add(webBrowser); }