|
与 Geckofx 浏览器组件交互
引用 Geckofx-Core 和 Geckofx-Winforms using Gecko; private GeckoWebBrowser GeckoList; GeckoList = new GeckoWebBrowser(); GeckoList.Parent = this.palList; GeckoList.Dock = DockStyle.Fill; GeckoList.Location = new System.Drawing.Point(0, 0); GeckoList.Size = new System.Drawing.Size(804, 653); GeckoList.DocumentCompleted += new EventHandler GeckoList.Navigate(website); private void GeckoList_DocumentCompleted(object sender, Gecko.Events.GeckoDocumentCompletedEventArgs e) { GeckoList.DocumentTitleChanged += new EventHandler(GeckoList_DocumentTitleChanged); GeckoList.Navigate("JavaScript:void(setorder.set_order_data('" + order_json + "'))"); } private void GeckoList_DocumentTitleChanged(object sender, EventArgs e) { if (GeckoList.DocumentTitle.Substring(0, 2) == "v`") { // label2.Visible = false; } if (GeckoList.DocumentTitle.Substring(0, 2) == "e`") { AppExit(); } if (GeckoList.DocumentTitle.Substring(0, 2) == "m`") { this.Hide(); } if (GeckoList.DocumentTitle.Substring(0, 2) == "d`") { CNN.TestLog(GeckoList.DocumentTitle); } if (GeckoList.DocumentTitle.Substring(0, 2) == "i`") {//改单 string[] tag = GeckoList.DocumentTitle.Replace("i`", "").Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); string order_json = GeckoList.Document.GetElementById("order_json").TextContent; } } |