//생산시작 private void btnProduceStart_Click(object sender, EventArgs e) { if (dgvPerformance.SelectedRows.Count < 1) { CustomMessageBox.ShowDialog(Resources.MsgProduceStartResultHeader , Resources.MsgProduceStartResultContent, MessageBoxIcon.Warning); return; } // 처음 접속인 경우 if (client == null) { // 서버와 연결함 ConnectServer(); Thread.Sleep(100); ProduceStart(); } else { // 기존 서버와 연결을 끊고 다시 생산시작을 가동 client = null; btnProduceStart.PerformClick(); } dgvWork.DataSource = null; dgvProduce.DataSource = null; dgvPerformance.DataSource = null; lblWorker.Text = string.Empty; }
// 서버에 연결하는 코드 private void ConnectServer() { client = new POPClient() { LineID = WorkerInfo.LineID }; client.Received += new ReceiveEventHandler(Receive); if (client.Connect()) { client.LineID = WorkerInfo.LineID; client.IsLine = true; client.Certification(); } }