예제 #1
0
 private void FrmMain_Load(object sender, EventArgs e)
 {
     tCPServer = new TCPServer();
     //tCPServer.OnConnected += TCPServer_OnConnected;
     //tCPServer.OnReceiveMessage += TCPServer_OnReceiveMessage;
     //tCPServer.OnDisConnect += TCPServer_OnDisConnect;
     if (tCPServer.OpenServer(5000))
     {
         fv.tCPServer = tCPServer;
         Console.WriteLine("端口5000监听成功" + "\r\t");
     }
     if (DeserializationCameraFile() == 0)
     {
         if (CommonMethods.cameraInfos.Count > 0)
         {
             if (!CommonMethods.cameraInfos[0].IsOpen)
             {
                 if (CameraDevice.OpenDevice(CommonMethods.cameraInfos[0].SeriaNumber) == 0)
                 {
                     CommonMethods.cameraInfos[0].IsOpen = true;
                     // MessageBox.Show("相机打开成功");
                 }
                 else
                 {
                     MessageBox.Show("相机打开失败");
                 }
             }
             else
             {
                 MessageBox.Show("相机已被打开");
             }
         }
     }
     //FrmView fv = new FrmView();
     //if (!CloseWindow(fv))
     //{
     //    OpenWindow(fv);
     //    fv.SetReadWrite(siemensTcpNet);
     //}
     OpenWindow(fv);
     OpenWindow(frmView);
     OpenWindow(fcc);
 }