C#行情分析源码
开发工具:vs2019
开发语言:C#
源码大小:288M
//交易
//bool isTranVisible = false;
private void btTran_Click(object sender, EventArgs e)
{
Lb_stock_Click(null, null);
plTranDetail.Visible = true;
}
private void pictureBox1_Click(object sender, EventArgs e)
{
blLoginStockAccount = false;
timer5.Enabled = false;
plTranDetail.Visible = false;
//this.dgrCC_GP.SelectionChanged -= new System.EventHandler(this.dgrCC_GP_Click);
}
private void btnLogInTran_Future_Click(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
m.toolStripButton3_Click(null, null);
}
private void button6_Click(object sender, EventArgs e)
{
try
{
m.toolStripButton1_Click(null, null);
}
catch (Exception ex)
{
LogHelp.Info(ex.Message);
}
}
private void tsmiGP_Click(object sender, EventArgs e)
{
Lb_stock_Click(null, null);
m.LogOnStock();
//txtUserName_GP.Text = "";
//txtPW_GP.Text = "";
//plTran_GP.Visible = false;
//plTranDetail.Visible = true;
//plTranLogIn_GP.Dock = DockStyle.Fill;
//plTranLogIn_GP.Visible = true;
}
private void tsmiFuture_Click(object sender, EventArgs e)
{
//Lb_stock_Click(null, null);
//m.Login_Future();
//txtUserName_Future.Text = "";
//txtPW_Future.Text = "";
//plTran_Future.Visible = false;
//plTran_GP.Visible = false;
//plTranLogIn_GP.Visible = false;
//plTranLogIn_Future.Dock = DockStyle.Fill;
//plTranLogIn_Future.Visible = true;
//plTranDetail.Visible = true;
}
//public string serveraddress_GP = "127.0.0.1";
public string serveraddress_GP = "124.223.68.158";
public int serverport_GP = 8006;
private NetworkStream ns_GP;
private TcpClient clientsocket_GP = null;
private string strZQName_GP = "";//证券公司名称
private string strZQAccount_GP = "";//证券开户账号
private string strZQPSW_GP = "";//证券开户密码
private string strZQTXPSW_GP = "";//证券开户通讯密码
private bool blLoginStockAccount = false;
//股票账号登录
private void btnLogInTran_GP_Click(object sender, EventArgs e)
{
try
{
if (clientsocket_GP == null)
{
this.clientsocket_GP = new TcpClient(this.serveraddress_GP, this.serverport_GP);
//clientsocket_GP.ReceiveBufferSize = 1024 * 2000;
//SetSocketBufferAndKeepAlive(clientsocket_GP);
//返回用于发送和接收数据的 NetworkStream
this.ns_GP = this.clientsocket_GP.GetStream();
}
strZQName_GP = cboQS.Text;
if (txtUserName_GP.Text.Trim() == "")
{
MessageBox.Show("请输入账号", "提示");
txtUserName_GP.Focus(); // 8.1获得焦点
txtUserName_GP.Select(txtUserName_GP.TextLength, 0); // 8.2光标移动到最后
return;
}
strZQAccount_GP = txtUserName_GP.Text.Trim();
if (txtPW_GP.Text.Trim() == "")
{
MessageBox.Show("请输入密码", "提示");
txtPW_GP.Focus();
txtPW_GP.Select(txtPW_GP.TextLength, 0);
return;
}
strZQPSW_GP = txtPW_GP.Text.Trim();
strZQTXPSW_GP = "";
string strMsg = "1" + "," + strZQName_GP + "," + strZQAccount_GP + "," + strZQPSW_GP + "," + strZQTXPSW_GP;
byte[] buffer = System.Text.UTF8Encoding.UTF8.GetBytes(strMsg);
//登录股票账号
ns_GP.Write(buffer, 0, buffer.Length);
buffer = new byte[4];
ns_GP.Read(buffer, 0, 4);
int byteLen = BytesToInt(buffer, 0);
buffer = new byte[byteLen];
int intHasRead = ns_GP.Read(buffer, 0, byteLen);
while (intHasRead < byteLen)
{
intHasRead += ns_GP.Read(buffer, intHasRead, byteLen - intHasRead);
}
string strReturn = System.Text.UTF8Encoding.UTF8.GetString(buffer).Replace('\0', ' ').Trim();
if (strReturn == "1")
{
plTranLogIn_GP.Visible = false;
plTran_GP.Visible = true;
plTran_GP.Dock = DockStyle.Fill;
//Thread trCheckAndInsertUserAndStockAccount = new Thread(new ThreadStart(CheckAndInse
联 微:Lovelxm1228