コード例 #1
0
        private void AddData()
        {
            lock (TcpControl.DataQueue)
            {
                while (TcpControl.DataQueue.Count > 0)
                {
                    string str  = TcpControl.DataQueue.Dequeue();
                    string temp = ExecServiceList.UpdLsm(str);
                    temp = ExecServiceList.UpdDBConnectionState(temp);
                    temp = ExecRTUList.Updrdm(temp);
                    temp = ExecCommandList.UpdCommand(temp);
                    temp = synxml(temp);


                    Text = temp.Replace("++", "");
                }
            }

            TcpControl.SendData();
            if (!TcpControl.Connected)
            {
                ExecServiceList.UpdLsm();
                ExecRTUList.Updrdm();
                ExecServiceList.ServiceDBConnectionState = false;
            }
        }
コード例 #2
0
 public void buttonItem_ReadRTU_Click(object sender, EventArgs e)
 {
     if (TcpControl.Connected)
     {
         TcpControl.SendUItoServiceCommand("--rtu|");
     }
     else
     {
         DevComponents.DotNetBar.MessageBoxEx.Show("与服务端通讯异常,无法重置信息!", "[提示]", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #3
0
 private void ThreadReConnect()
 {
     while (true)
     {
         if (!TcpControl.Connected)
         {
             TcpControl.TcpClient_Init();
         }
         Thread.Sleep(1000);
     }
 }
コード例 #4
0
 private void buttonItem_SendMail_Click(object sender, EventArgs e)
 {
     if (TcpControl.Connected)
     {
         TcpControl.SendUItoServiceCommand("--mal|");
     }
     else
     {
         DevComponents.DotNetBar.MessageBoxEx.Show("与服务端通讯异常,无法发送命令!", "[提示]", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #5
0
        private void toolStripMenuItem_SetTime_Click(object sender, EventArgs e)
        {
            var com = from t in ExecServiceList.Lsm where t.SERVICETYPE == "COM" select t;

            if (com.Count() > 0)
            {
                if (TcpControl.Connected)
                {
                    string command = "--com|tim";

                    bool b = TcpControl.SendUItoServiceCommand(command);
                    if (!b)
                    {
                        DevComponents.DotNetBar.MessageBoxEx.Show("命令发送失败!", "[提示]", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    DevComponents.DotNetBar.MessageBoxEx.Show("与服务端通讯异常,无法重启各信道服务!", "[提示]", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
コード例 #6
0
        void ri_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            string tag         = (sender as DevComponents.DotNetBar.Controls.ReflectionImage).Tag.ToString();
            var    ser         = from s in ExecServiceList.Lsm where (s.SERVICETYPE + s.SERVICEID) == tag select s;
            string SERVICETYPE = ser.First().SERVICETYPE;

            ser = from s in ExecServiceList.Lsm where s.SERVICETYPE == SERVICETYPE select s;
            OperateXML.serviceModel[] sers = ser.ToArray <OperateXML.serviceModel>();
            string Index = "";

            for (int i = 0; i < ser.Count(); i++)
            {
                if (sers[i].SERVICETYPE + sers[i].SERVICEID == tag)
                {
                    Index += "0:";
                }
                else
                {
                    Index += "1:";
                }
            }

            if (TcpControl.Connected && Index.Length > 0)
            {
                Index = Index.Substring(0, Index.Length - 1);
                string command = "--" + SERVICETYPE.ToLower() + "|" + Index;
                bool   b       = TcpControl.SendUItoServiceCommand(command);
                if (!b)
                {
                    DevComponents.DotNetBar.MessageBoxEx.Show("命令发送失败!", "[提示]", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                DevComponents.DotNetBar.MessageBoxEx.Show("与服务端通讯异常,无法重启各信道服务!", "[提示]", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #7
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            PubObject.PubObjectInit(imageList2);
            IList <Service.Model.YY_RTU_Basic> rtus = null;

            ExecCommandList.LC = new List <Command>();


            ExecServiceList.Lsm = Program.wrx.XMLObj.LsM; //读取服务信息
            buttonItem1.Text   += "[" + ProName + "]";


            AddControls();               //根据xml文件动态添加服务显示灯控件
            TcpControl.TcpClient_Init(); //tcp与服务交互初始化


            PublicBD.Path = Program.xmlpath;
            PublicBD.ReInit();
            //连接数据库
            if (PublicBD.ConnectState)
            {
                //得到RTU列表
                rtus = Service.PublicBD.db.GetRTUList("");
                //得到命令列表
                ExecCommandList.Commands = Service.PublicBD.db.GetRTUCommandList();
                //得到命令临时表中的要发送的召测命令
                ExecRTUList.SetLrdm(rtus);

                //提示可能是自动入库的测站信息
                AlertFomrShow(rtus);

                //显示数据窗体控件
                buttonItem_dataShow_Click(null, null);
            }
            else
            {
                //显示系统设置窗体控件
                buttonItem_SetSystem_Click(null, null);
            }



            ////根据服务在线状态更新服务显示灯
            Thread updcontrols = new Thread(new ThreadStart(ThreadUpdControls));

            // 设置为背景线程,主线程一旦退出,该线程也不等待而立即结束
            updcontrols.IsBackground = true;
            updcontrols.Start();



            //添加明文数据
            Thread adddata = new Thread(new ThreadStart(ThreadAddData));

            // 设置为背景线程,主线程一旦退出,该线程也不等待而立即结束
            adddata.IsBackground = true;
            adddata.Start();


            Thread ReConnect = new Thread(new ThreadStart(ThreadReConnect));

            ReConnect.IsBackground = true;
            ReConnect.Start();
        }