/// <summary> /// Tcp通讯初始化 /// </summary> public void Tcp_Initial() { //绑定日志事件 T_Client.LogErr += Log.WriteError; T_Client.LogInfo += Log.Info; //打开相机 if (SysPara.CamEn) { if (Process_Operate.StartApp("CellLocation"))//打开相机 { Thread.Sleep(2000); T_Client.TCP_Start(SysPara.Server_Ip, SysPara.Server_Port); } else { Log.Info("相机打开失败!!!"); } } }
/// <summary> /// 打开相机 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OpenCambutton_Click(object sender, EventArgs e) { if (Process_Operate.StartApp("CellLocation"))//打开相机 { Thread.Sleep(2000); Program.SystemContainer.T_Client.TCP_Start(Program.SystemContainer.SysPara.Server_Ip, Program.SystemContainer.SysPara.Server_Port); UpdateCamButtonStatus(); //刷新状态 if (!Program.SystemContainer.T_Client.ConnectOk) //连接失败 { DialogResult dr = MessageBox.Show(string.Format("确定关闭相机,取消退出窗口"), "确认窗口", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dr == DialogResult.OK) { Process_Operate.KillApp("CellLocation"); } } } else { MessageBox.Show("相机打开失败!!!"); } }