Esempio n. 1
0
        private void closeformInvoke()
        {
            try
            {
                CommonData.ListeningFlag = false;
                SocketServerListen.StopListen();
            }
            catch (Exception ex1)
            { MessageBox.Show("1:\r\n" + ex1.ToString()); }
            Thread.Sleep(500);

            try
            {
                this.Close();
            }
            catch (Exception ex3)
            { MessageBox.Show("2:\r\n" + ex3.ToString()); }
        }
Esempio n. 2
0
        Thread CheckNet; //检查联网线程
        private void show_Load(object sender, EventArgs e)
        {
            //this.WindowState = FormWindowState.Maximized;

            try
            {
                CommonData.Write2File("192.168.10.180,12345", CommonData.ServerIPpath);
                List <string> str1 = CommonData.GetStringFromFile(CommonData.ServerIPpath);  //获取IP和端口
                CommonData.serverIP   = str1[0].Split(',')[0];
                CommonData.serverPort = int.Parse(str1[0].Split(',')[1]);

                CommonData.Write2File("http://192.168.10.180/webservice/MeasurationMgr.asmx", CommonData.WebServicepath);
                List <string> str2 = CommonData.GetStringFromFile(CommonData.WebServicepath);  //获取数据库以及WebService地址
                CommonData.WebServiceaddress = str2[0];
            }
            catch (Exception ex)
            {
                MessageBox.Show("write" + ex.ToString());
            }

            if (!CheckNetwork())
            {
                return;
            }

            if (!CheckArea())
            {
                closeform();
                return;
            }

            label1.Text = CommonData.localIP + " " + CommonData.Area;


            //barcode21.EnableScanner = true;

            SocketServerListen.SocketListen(CommonData.localIP, CommonData.ListenPort);  //Socket监听远程设备的更改
            test.delecheckSet = ListenRec;

            CheckNet = new Thread(Thread_Chknet);
            CheckNet.IsBackground = true;
            CheckNet.Start();
        }
Esempio n. 3
0
 private void show_FormClosing(object sender, FormClosingEventArgs e)
 {
     CommonData.ListeningFlag = false;
     SocketServerListen.StopListen();
 }