/// <summary> /// “设置Cookie”按钮点击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSetCookie_Click(object sender, EventArgs e) { string url = this.txtUrl.Text.Trim(); string cookie = this.txtCookie.Text.Trim(); bool result = PapdHelper.SetIECookie(url, cookie); this.btnOpenIE.Enabled = result; this.btnOpenBrowser.Enabled = result; MsgBox.ShowInfo("设置" + (result ? "成功" : "失败") + "!"); }
/// <summary> /// 游戏图片点击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GamePictureOnClick(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Left) { return; } if (!GlobalContext.CheckLoginState()) { return; } string gameUrl = (sender as PictureBox).Tag.ToString(); //var frmWeb = new FrmWeb(gameUrl); ThreadPool.QueueUserWorkItem(o => { try { this.m_cookie = GlobalContext.CurrentCookieString; if (gameUrl.Contains("http://wap.pahys.com")) { Output("正在获取游戏Cookie..."); this.m_gameCookie = GlobalContext.PH.GetGameCookie( GlobalContext.CurrentCookieString, gameUrl); this.m_cookie = this.m_gameCookie; } Output("获取成功,正在打开页面..."); PapdHelper.SetIECookie(gameUrl, this.m_cookie); //frmWeb.Show(); System.Diagnostics.Process.Start("iexplore.exe", gameUrl); Output("执行成功!"); } catch (Exception ex) { Output("执行失败," + ex.Message); //frmWeb.Dispose(); } }); }