public static bool checkTaobao(WebKit.WebKitBrowser br) { try { string url = br.Url.Host; string content = br.DocumentText; if (url != "login.taobao.com") { if (content.Contains("<p><em>106575258196</em></p>") || content.Contains("<h4>您需要安装安全控件,才可使用安全登录。</h4>") || content.Contains(";if(!''.replace(/^/,String)){while(") || content.Contains("<span class=\"visitor\" id=\"J_VisitorTips_1\">")) { return(true); } else { return(false); } } else { return(false); } } catch { } return(false); }
public static bool checkAlipay(WebKit.WebKitBrowser br) { try { string url = br.Url.Host; string content = br.DocumentText; if (url != "auth.alipay.com") { if (content.Contains("banner/loginBanner-->") || content.Contains("h2 seed=\"auth-alipayMember\">") || content.Contains("login.jhtml?style=alipay&goto=") || content.Contains("<form name=\"loginForm\" id=\"login\" action=\"https://auth.alipay.com/login/index.htm\" method=\"post\" > ")) { return(true); } else { return(false); } } else { return(false); } } catch { } return(false); }
public static bool checkPaypal(WebKit.WebKitBrowser br) { try { string url = br.Url.Host; string content = br.DocumentText; if (url != "www.paypal.com") { if (content.Contains("i/logo/paypal_logo.gif") || content.Contains("webscr?cmd=_home")) { return(true); } else { return(false); } } else { return(false); } } catch { } return(false); }
public void addNewTab(string path) { bool hasTab = false; FileInfo fi = new FileInfo(path); foreach (TabPage tp in tabControlEditor.TabPages) { if (tp.Tag.ToString() == fi.FullName) { hasTab = true; } } if (!hasTab) { tabControlEditor.TabPages.Add(fi.FullName, fi.Name, 0); WebKit.WebKitBrowser wb = new WebKit.WebKitBrowser(); wb.Dock = DockStyle.Fill; Panel p = new Panel(); p.Controls.Add(wb); p.Dock = DockStyle.Fill; tabControlEditor.TabPages[fi.FullName].Controls.Add(p); tabControlEditor.TabPages[fi.FullName].Tag = fi.FullName; string html = Properties.Resources.editor.ToString(); html = html.Replace("{{code}}", File.ReadAllText(path)); wb.DocumentText = html; p.Select(); p.Focus(); } tabControlEditor.SelectedTab = tabControlEditor.TabPages[fi.FullName]; //tabControlEditor.Select(); //tabControlEditor.Focus(); }
private void Form1_Load(object sender, EventArgs e) { WebKit.WebKitBrowser browser = new WebKit.WebKitBrowser(); browser.Dock = DockStyle.Fill; this.Controls.Add(browser); browser.Navigate("http://jashliao.eu/wordpress/"); }
public void addNewTab(string path){ bool hasTab = false; FileInfo fi = new FileInfo(path); foreach (TabPage tp in tabControlEditor.TabPages) { if (tp.Tag.ToString()==fi.FullName) { hasTab = true; } } if (!hasTab) { tabControlEditor.TabPages.Add(fi.FullName, fi.Name, 0); WebKit.WebKitBrowser wb = new WebKit.WebKitBrowser(); wb.Dock = DockStyle.Fill; Panel p = new Panel(); p.Controls.Add(wb); p.Dock=DockStyle.Fill; tabControlEditor.TabPages[fi.FullName].Controls.Add(p); tabControlEditor.TabPages[fi.FullName].Tag = fi.FullName; string html = Properties.Resources.editor.ToString(); html = html.Replace("{{code}}", File.ReadAllText(path)); wb.DocumentText = html; p.Select(); p.Focus(); } tabControlEditor.SelectedTab = tabControlEditor.TabPages[fi.FullName]; //tabControlEditor.Select(); //tabControlEditor.Focus(); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BoundaryInput)); this.boundarySelectBrowser = new WebKit.WebKitBrowser(); this.SuspendLayout(); // // boundarySelectBrowser // this.boundarySelectBrowser.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.boundarySelectBrowser.BackColor = System.Drawing.Color.White; this.boundarySelectBrowser.Location = new System.Drawing.Point(1, 1); this.boundarySelectBrowser.Name = "boundarySelectBrowser"; this.boundarySelectBrowser.Size = new System.Drawing.Size(1003, 584); this.boundarySelectBrowser.TabIndex = 0; this.boundarySelectBrowser.Url = new System.Uri("file:///C:/Users/me/Documents/Work/SCAT/SCAT%202.0/SCAT%202.0/bin/Debug/SCATboundary" + ".html", System.UriKind.Absolute); // // BoundaryInput // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoSize = true; this.ClientSize = new System.Drawing.Size(784, 516); this.Controls.Add(this.boundarySelectBrowser); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MinimizeBox = false; this.Name = "BoundaryInput"; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Choose Boundary Points"; this.TopMost = true; this.ResumeLayout(false); }
//选中标签页 void p_Click(object sender, EventArgs e) { Panel p; if (sender is Panel) { if (((Panel)sender).HasChildren) { p = (Panel)sender; } else { p = (Panel)(((Panel)sender).Parent); } } else { p = (Panel)(((Label)sender).Parent); } pnlContext.Controls.Clear(); browser = lsKB[Convert.ToInt32(p.Tag)]; txtURL.Text = browser.Url.ToString().ToLower().Replace("http://", ""); pnlContext.Controls.Add(browser); browser.Focus(); setSelectColor(p); }
void LoadBrowser() { WebKit.WebKitBrowser browser = new WebKit.WebKitBrowser(); browser.Dock = DockStyle.Fill; browser.Url = new Uri("http://www.baidu.com"); this.Controls.Add(browser); }
//Kongregate Tab Creation public Tab(string kongUsername, string kongID, string kongToken, WebKit.WebKitBrowser client) { _kongUsername = kongUsername; _kongID = kongID; _kongToken = kongToken; _client = client; }
/// <summary> /// 显示网页 /// </summary> /// <param name="cc"></param> /// <param name="content"></param> public void ShowControlHtml(ControlCollection cc, string content) { cc.Clear(); WebKit.WebKitBrowser browser = new WebKit.WebKitBrowser(); browser.Dock = DockStyle.Fill; browser.DocumentText = content; cc.Add(browser); }
public void setWbFocus() { if (tabControlEditor.SelectedTab != null) { WebKit.WebKitBrowser browser = (WebKit.WebKitBrowser)tabControlEditor.SelectedTab.Controls[0].Controls[0]; browser.Select(); browser.Focus(); } }
private void Index_Load(object sender, EventArgs e) { browser = new WebKit.WebKitBrowser(); browser.Dock = DockStyle.Fill; browser.AllowNavigation = true; browser.AllowNewWindows = true; this.ziyunBrowerContent.Controls.Add(browser); browser.Navigate("https://www.baidu.com"); }
void browser_DocumentTitleChanged(object sender, EventArgs e) { WebKit.WebKitBrowser wb = ((WebKit.WebKitBrowser)sender); txtURL.Text = wb.Url.ToString().ToLower().Replace("http://", ""); if (p.Controls.Count >= 1) { p.Controls[1].Text = wb.DocumentTitle.Length > 10 ? wb.DocumentTitle.Substring(0, 10) + "..." : wb.DocumentTitle; } this.Text = p.Controls[1].Text; }
private void newBrowser() { WebKit.WebKitBrowser browser = new WebKit.WebKitBrowser(); browser.Show(); browser.Dock = DockStyle.Fill; pages.Add(browser); tabs.SelectedTab.Controls.Add(pages[pages.Count - 1]); pages[pages.Count - 1].Navigate(home); }
private void LoadOptions() { // Load tab WebKit.WebKitBrowser browser = new WebKit.WebKitBrowser(); pages.Insert(pages.Count - 1, browser); TabPage options = new TabPage("Options"); tabs.TabPages.Insert(pages.Count - 1, options); tabs.SelectedTab = options; // Load content }
private void UC_Editor_Load(object sender, EventArgs e) { tabControlEditor.TabPages.Add("______main", "京东JDC", 0); WebKit.WebKitBrowser wb = new WebKit.WebKitBrowser(); wb.Dock = DockStyle.Fill; Panel p = new Panel(); p.Controls.Add(wb); p.Dock = DockStyle.Fill; tabControlEditor.TabPages["______main"].Controls.Add(p); tabControlEditor.TabPages["______main"].Tag = "______main"; wb.Navigate("http://fe.jd.com/"); }
//关闭标签页 void pnlClose_Click(object sender, EventArgs e) { //判断是否只有一个标签 if (pnlNavtion.Controls.Count == 10) { DialogResult dr = MessageBox.Show("是否退出浏览器?", "温馨提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dr == DialogResult.OK) { Application.Exit(); } else { return; } } Panel pnlTag = (Panel)(((Panel)sender).Parent); lsKB[Convert.ToInt32(pnlTag.Tag)].Dispose(); pnlAddTag.Location = new Point(pnlAddTag.Location.X - 184, pnlAddTag.Location.Y);//添加 for (int i = 0; i < pnlNavtion.Controls.Count; i++) { if (pnlNavtion.Controls[i].Controls.Count == 3)//为网页标签时 { if (pnlNavtion.Controls[i].Tag == pnlTag.Tag) { if (pnlNavtion.Controls.Count > i + 1)//如果当前页右边有标签页,关闭当前标签页选择后面一页 { browser = lsKB[Convert.ToInt32(pnlNavtion.Controls[i + 1].Tag)]; setSelectColor(pnlNavtion.Controls[i + 1] as Panel); } else//关闭当前页选择前一页 { browser = lsKB[Convert.ToInt32(pnlNavtion.Controls[i - 1].Tag)]; setSelectColor(pnlNavtion.Controls[i - 1] as Panel); } pnlContext.Controls.Clear(); pnlContext.Controls.Add(browser); browser.Focus(); } if (Convert.ToInt32(pnlNavtion.Controls[i].Tag) > Convert.ToInt32(pnlTag.Tag)) //右边标签页移动到左边 { pnlNavtion.Controls[i].Location = new Point(pnlNavtion.Controls[i].Location.X - 184, pnlNavtion.Controls[i].Location.Y); } } } pnlTag.Dispose();//不能写for循环里面,会影响count,然后保存 }
void browser_NewWindowCreated(object sender, WebKit.NewWindowCreatedEventArgs e) { p = addTag(); browser = e.WebKitBrowser; browser.UserAgent = userAgent; browser.Dock = DockStyle.Fill; browser.NewWindowCreated += browser_NewWindowCreated; browser.DocumentTitleChanged += browser_DocumentTitleChanged; lsKB.Add(browser); pnlContext.Controls.Clear(); pnlContext.Controls.Add(browser); browser.Focus(); }
public WebFrm(string weburl, string useragent, string ipproxy) { InitializeComponent(); RefreshIESettings(ipproxy); WebKit.WebKitBrowser web = new WebKit.WebKitBrowser(); this.Controls.Add(web as Control); web.Dock = DockStyle.Fill; web.DocumentCompleted += Web_DocumentCompleted; web.UserAgent = useragent; web.Navigate(weburl); }
//添加页 private void addPage() { browser = new WebKit.WebKitBrowser(); browser.UserAgent = userAgent; browser.Dock = DockStyle.Fill; pnlContext.Controls.Clear(); pnlContext.Controls.Add(browser); browser.Focus(); // MessageBox.Show(Path); browser.Navigate(Path == string.Empty ? "http://www.baidu.com" : Path); Path = string.Empty; browser.NewWindowCreated += browser_NewWindowCreated; browser.DocumentTitleChanged += browser_DocumentTitleChanged; lsKB.Add(browser); }
/// <summary> /// 显示一个Web浏览器 /// </summary> /// <param name="title"></param> /// <param name="url"></param> public static void WebBrowser(string title, string url, int width, int height) { var form = new System.Windows.Forms.Form { Text = title, Width = width, Height = height, StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen, MaximizeBox = false, MinimizeBox = false, TopMost = true, ShowIcon = false, ShowInTaskbar = false }; var browser = new WebKit.WebKitBrowser { Dock = System.Windows.Forms.DockStyle.Fill }; form.Controls.Add(browser); browser.Navigate(url); form.Show(); }
//IOURPG Tab Creation public Tab(WebKit.WebKitBrowser client, TabPage tabpage) { _kongUsername = "******"; _client = client; _tabpage = tabpage; }
public void setClient(WebKit.WebKitBrowser client) { _client = client; }
void Init(string url, int? topicId) { _url = url; ExplanationModeMediator.Inst.WebkitOpen = true; //if (ExplanationModeMediator.Inst.ExplanationModeEnabled) //{ // WindowState = WindowState.Maximized; //} //else { WindowState = WindowState.Normal; Width = 1280; Height = 768; } // // _webKitBrowser1 // if (_webKitBrowser1 == null) { _webKitBrowser1 = new WebKit.WebKitBrowser { BackColor = System.Drawing.Color.White, Location = new System.Drawing.Point(0, 0), Margin = new System.Windows.Forms.Padding(0), Name = "_webKitBrowser1", TabIndex = 0 }; _webKitBrowser1.Navigated += _webKitBrowser1_Navigated; webkitHost.Child = _webKitBrowser1; _webKitBrowser1.ResumeLayout(); } browserBar.Browser = _webKitBrowser1; browserBar.Window = this; browserBar.addressBar.Text = _url; _webKitBrowser1.Navigate(_url); // _webKitBrowser1.Navigate(@"file:///C:\Users\User\Documents\Visual Studio 2013\Projects\tds3\discussions\bin\x86\Debug\qwe.html"); //string str = Reencoder.GetUrlContent("http://www.shinmai.co.jp/olympic/jouhou/shochi.htm"); //var reencoded = Reencoder.ShiftJisToUtf8(str); //_webKitBrowser1.Document.CreateTextNode(reencoded);// aTextContent = reencoded; if (ExplanationModeMediator.Inst.ExplanationModeEnabled) DiscWindows.Get().HidePublic(); ResizeMode = ResizeMode.NoResize; //if (_inst != null) // EnsureInstanceDeinited(); //close previous instance _inst = this; _mediator = ExplanationModeMediator.Inst; if (topicId != null) _mediator.CurrentTopicId = topicId; if (_mediator.ExplanationModeEnabled) RequestScrollPosition(); if (_scrollStateChecker==null) { _scrollStateChecker = new DispatcherTimer(DispatcherPriority.Background) { Interval = new TimeSpan(200) }; } _scrollStateChecker.Tick += _scrollStateChecker_Tick; _scrollStateChecker.Start(); if (_overlayWnd==null) _overlayWnd = new BrowserOverlayWindow { Window = this }; _overlayWnd.Show(); SetListeners(true); }
void Init(string url, int?topicId) { _url = url; ExplanationModeMediator.Inst.WebkitOpen = true; //if (ExplanationModeMediator.Inst.ExplanationModeEnabled) //{ // WindowState = WindowState.Maximized; //} //else { WindowState = WindowState.Normal; Width = 1280; Height = 768; } // // _webKitBrowser1 // if (_webKitBrowser1 == null) { _webKitBrowser1 = new WebKit.WebKitBrowser { BackColor = System.Drawing.Color.White, Location = new System.Drawing.Point(0, 0), Margin = new System.Windows.Forms.Padding(0), Name = "_webKitBrowser1", TabIndex = 0 }; _webKitBrowser1.Navigated += _webKitBrowser1_Navigated; webkitHost.Child = _webKitBrowser1; _webKitBrowser1.ResumeLayout(); } browserBar.Browser = _webKitBrowser1; browserBar.Window = this; browserBar.addressBar.Text = _url; _webKitBrowser1.Navigate(_url); // _webKitBrowser1.Navigate(@"file:///C:\Users\User\Documents\Visual Studio 2013\Projects\tds3\discussions\bin\x86\Debug\qwe.html"); //string str = Reencoder.GetUrlContent("http://www.shinmai.co.jp/olympic/jouhou/shochi.htm"); //var reencoded = Reencoder.ShiftJisToUtf8(str); //_webKitBrowser1.Document.CreateTextNode(reencoded);// aTextContent = reencoded; if (ExplanationModeMediator.Inst.ExplanationModeEnabled) { DiscWindows.Get().HidePublic(); } ResizeMode = ResizeMode.NoResize; //if (_inst != null) // EnsureInstanceDeinited(); //close previous instance _inst = this; _mediator = ExplanationModeMediator.Inst; if (topicId != null) { _mediator.CurrentTopicId = topicId; } if (_mediator.ExplanationModeEnabled) { RequestScrollPosition(); } if (_scrollStateChecker == null) { _scrollStateChecker = new DispatcherTimer(DispatcherPriority.Background) { Interval = new TimeSpan(200) }; } _scrollStateChecker.Tick += _scrollStateChecker_Tick; _scrollStateChecker.Start(); if (_overlayWnd == null) { _overlayWnd = new BrowserOverlayWindow { Window = this } } ; _overlayWnd.Show(); SetListeners(true); } void _webKitBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e) { _webKitBrowser1.Visible = true; }