private void FormMain_Load(object sender, EventArgs e) { _CpStockCode = new CPUTILLib.CpStockCode(); _CpCodeMgr = new CPUTILLib.CpCodeMgr(); _CpTdUtil = new CPTRADELib.CpTdUtil(); _CpConclusion = new DSCBO1Lib.CpConclusion(); _CpConclusion.Received += new DSCBO1Lib._IDibEvents_ReceivedEventHandler(CpConclusion_Received);//_CpConclusion_Received; _CpCybos = new CPUTILLib.CpCybos(); _CpCybos.OnDisconnect += _CpCybos_OnDisconnect; _stockTable = new DataTable(); _checkedTradeInit = false; stockCode = "A003540"; stockName = "대신증권"; labelStatus.Visible = false; _stockTradeTable = new DataTable(); accountNo = ""; accountGoodsStock = ""; }
private void ChangeMainTitleConnection() { _CpCybos = null; _CpCybos = new CPUTILLib.CpCybos(); if (_CpCybos.IsConnect == 1) { if (_timerConnection != null) { _timerConnection.Stop(); _timerConnection.Dispose(); _timerConnection = null; } _timerCount = 0; menuStrip1.BackColor = Color.FromArgb(228, 254, 226); Invoke(new MethodInvoker(ConnectionCompleted)); MessageBox.Show("대신증권 플러스에 연결되었습니다."); LoadStockCodes(); } else { this.Text = "대신증권 플러스 Sample for C# (연결 안됨)"; if (_timerCount == 0) { DialogConnection dialog = new DialogConnection(); dialog.SetParent(this); dialog.ShowDialog(this); } } }
private void _CpCybos_OnDisconnect() { _CpCybos = null; menuStrip1.BackColor = Color.FromArgb(255, 230, 230); this.Text = "대신증권 플러스 Sample for C# (연결 안됨)"; MessageBox.Show("대신증권 플러스 연결이 종료되었습니다."); }
private void 러스접속ToolStripMenuItem_Click(object sender, EventArgs e) { _CpCybos = null; _CpCybos = new CPUTILLib.CpCybos(); if (_CpCybos.IsConnect == 1) { MessageBox.Show("대신증권 플러스에 이미 연결된 상태입니다."); return; } ; if (_timerConnection != null) { _timerConnection.Stop(); _timerConnection.Dispose(); _timerConnection = null; } _timerCount = 0; ChangeMainTitleConnection(); }