private void trmCheckConnection_Tick(object sender, EventArgs e) { if (frmMain != null) { //ShowTipOnWindow("开始提交下注"); //lblState.Text = frmMain.FengPan ? "aaa" : "bbb"; } bool isSuccess = false; if (cbStart.Checked) { isSuccess = ServerFeiPan.checkLogin(); } if (isSuccess == true) { ServerFeiPan.getYuE(); lblState.Text = "使用中"; } else { lblState.Text = "已停止"; } lblYuE.Text = ServerFeiPan.KeYongYuE.ToString(); lblServer.Text = ServerFeiPan.FeidanUrl; lblName.Text = ServerFeiPan.LoginName; }
public void TryConnect() { if (ServerFeiPan.checkLogin() == true) { //已登录 function.log("已经登录 【TryConnect】"); return; } //加载服务器 DataTable dtServer = SQLiteHelper.ExecuteDataTable("select * from fuwuqi_" + (String.IsNullOrWhiteSpace(Seq) ? CacheData.Seq : Seq), null); if (dtServer.Rows.Count > 0) { foreach (DataRow row in dtServer.Rows) { string _serverType = row["类型"].ToString(); string _serverUrl = row["服务器地址"].ToString(); string _userName = row["用户名"].ToString(); string _userPass = row["密码"].ToString(); // System.Windows.Forms.ListViewItem.ListViewSubItem subItem = null; foreach (ListViewItem item in lvSerState.Items) { if (item.SubItems[2].Text.Equals(_serverUrl)) { subItem = item.SubItems[4]; } } subItem.Text = "链接中.."; if (subItem != null) { if (_serverType.Equals("顺丰")) { ServerFeiPan.login(_serverUrl, _userName, _userPass, _serverType); } else if (_serverType.Equals("永利")) { ServerFeiPan.login(_serverUrl, _userName, _userPass, _serverType); } // subItem.Text = ServerFeiPan.IsLoginSuccess ? "使用中" : "已停止"; if (ServerFeiPan.IsLoginSuccess) { lblYuE.Text = ServerFeiPan.KeYongYuE.ToString(); lblServer.Text = ServerFeiPan.FeidanUrl; lblName.Text = ServerFeiPan.LoginName; lblState.Text = "使用中"; break; } else { lblYuE.Text = ServerFeiPan.KeYongYuE.ToString(); lblServer.Text = ServerFeiPan.FeidanUrl; lblName.Text = ServerFeiPan.LoginName; lblState.Text = "已停止"; } } function.log("测试登录 【TryConnect】" + _serverType); } } // if (cbStart.Checked && ServerFeiPan.IsLoginSuccess == false) { playFaileSound(); frmMessageTimer frmMessage = new frmMessageTimer("盘口可能坏了,请检查是否可用?"); frmMessage.Show(); cbStart.Checked = false; } }
/// <summary> /// 下注 /// </summary> public feiPanJieGuo StartXiaZhu(xztj xztj, string qiHao) { feiPanJieGuo fpjgData = new feiPanJieGuo(); fpjgData.serverUrl = ""; fpjgData.yuE = "0"; lblYuE.Text = "0"; lblServer.Text = ""; lblName.Text = ""; lblState.Text = "链接中"; if (cbStart.Checked == true) { string useServer = ""; //尝试下注 if (ServerFeiPan.checkLogin() == false) { ServerFeiPan.loginAgain(); } if (ServerFeiPan.checkLogin() == true) { if (ServerFeiPan.ServerType.Equals("顺丰")) { fpjgData.isSuccess = true; fpjgData.serverUrl += ServerFeiPan.FeidanUrl + ";"; fpjgData = ServerFeiPan.xiaZhu_shunfen(xztj, qiHao, fpjgData); } else if (ServerFeiPan.ServerType.Equals("永利")) { fpjgData.isSuccess = true; fpjgData.serverUrl += ServerFeiPan.FeidanUrl + ";"; fpjgData = ServerFeiPan.xiaZhu_yongli(xztj, qiHao, fpjgData); } useServer = ServerFeiPan.ServerType + ServerFeiPan.LoginName; } foreach (ListViewItem item in lvSerState.Items) { item.SubItems[4].Text = "已停止"; } //重新遍历服务器列表 if (fpjgData.isSuccess == false) { //加载服务器 DataTable dtServer = SQLiteHelper.ExecuteDataTable("select * from fuwuqi_" + (String.IsNullOrWhiteSpace(Seq) ? CacheData.Seq : Seq), null); if (dtServer.Rows.Count > 0) { foreach (DataRow row in dtServer.Rows) { string _serverType = row["类型"].ToString(); string _serverUrl = row["服务器地址"].ToString(); string _userName = row["用户名"].ToString(); string _userPass = row["密码"].ToString(); if (_serverType.Equals(_serverType + _userName)) { function.log("提交失败:" + _serverType + _userName); continue; } if (_serverType.Equals("顺丰")) { ServerFeiPan.login(_serverUrl, _userName, _userPass, _serverType); if (ServerFeiPan.IsLoginSuccess == false && cbIsTryCon.Checked) { frmMessageTimer frmMessage = new frmMessageTimer("服务器" + _serverUrl + "不能使用"); frmMessage.Show(); Application.DoEvents(); } if (ServerFeiPan.IsLoginSuccess == true) { fpjgData = ServerFeiPan.xiaZhu_shunfen(xztj, qiHao, fpjgData); } } else if (_serverType.Equals("永利")) { ServerFeiPan.login(_serverUrl, _userName, _userPass, _serverType); if (ServerFeiPan.IsLoginSuccess == false && cbIsTryCon.Checked) { frmMessageTimer frmMessage = new frmMessageTimer("服务器" + _serverUrl + "不能使用"); frmMessage.Show(); Application.DoEvents(); } if (ServerFeiPan.IsLoginSuccess == true) { fpjgData = ServerFeiPan.xiaZhu_yongli(xztj, qiHao, fpjgData); } } // if (ServerFeiPan.IsLoginSuccess) { lblYuE.Text = ServerFeiPan.KeYongYuE.ToString(); lblServer.Text = ServerFeiPan.FeidanUrl; lblName.Text = ServerFeiPan.LoginName; lblState.Text = "使用中"; } else { lblYuE.Text = ServerFeiPan.KeYongYuE.ToString(); lblServer.Text = ServerFeiPan.FeidanUrl; lblName.Text = ServerFeiPan.LoginName; lblState.Text = "已停止"; } foreach (ListViewItem item in lvSerState.Items) { if (item.SubItems[2].Text.Equals(_serverUrl)) { item.SubItems[4].Text = ServerFeiPan.IsLoginSuccess ? "使用中" : "已停止"; } } // if (fpjgData.isSuccess) { break; } } } } } else { fpjgData = ServerCommon.SetFeiPanJieGuo(fpjgData, true); fpjgData.errorMessage = "未开启"; //关闭直接返回 return(fpjgData); } if (fpjgData.isSuccess == false) { playFaileSound(); if (cbStart.Checked && ServerFeiPan.IsLoginSuccess == false) { frmMessageTimer frmMessage = new frmMessageTimer("盘口可能坏了,请检查是否可用?"); frmMessage.Show(); cbStart.Checked = false; } } //for (int i = 0; i < 4; i++)//总和组合 //{ // fpjgData.ZHZHDXDS[i] = true; //} // //lblYuE.Text = fpjgData.yuE; //插入 feiPanJieGuoInsert(xztj, fpjgData, qiHao); //查询最新 chaXunZuiXin(); return(fpjgData); // //string result = HttpHelps.Post("", _feidanUrl + "/user/cql_cqsc_lm.aspx?t=all", // _webCookie, Encoding.Default); }