Esempio n. 1
0
 private void ShowPoolMsg()
 {
     while (true)
     {
         Thread.Sleep(10000);
         if (ControlCommandThread.PoolA != null)
         {
             lblAmin.BeginInvoke(new Action <Label, int>(UploadControl), lblAmin, ControlCommandThread.PoolA.GetMin());
             lblAmax.BeginInvoke(new Action <Label, int>(UploadControl), lblAmax, ControlCommandThread.PoolA.GetMax());
             lblApublicpool.BeginInvoke(new Action <Label, int>(UploadControl), lblApublicpool, ControlCommandThread.PoolA.GetPublicPoolCount());
             lblAfreequeue.BeginInvoke(new Action <Label, int>(UploadControl), lblAfreequeue, ControlCommandThread.PoolA.GetFreeQueueCount());
             lblAworking.BeginInvoke(new Action <Label, int>(UploadControl), lblAworking, ControlCommandThread.PoolA.GetWorkingCount());
             lblAwaitlist.BeginInvoke(new Action <Label, int>(UploadControl), lblAwaitlist, ControlCommandThread.PoolA.GetWaitListCount());
         }
         if (AutoCollectionThread.PoolB != null)
         {
             lblBmin.BeginInvoke(new Action <Label, int>(UploadControl), lblBmin, AutoCollectionThread.PoolB.GetMin());
             lblBmax.BeginInvoke(new Action <Label, int>(UploadControl), lblBmax, AutoCollectionThread.PoolB.GetMax());
             lblBpublicpool.BeginInvoke(new Action <Label, int>(UploadControl), lblBpublicpool, AutoCollectionThread.PoolB.GetPublicPoolCount());
             lblBfreequeue.BeginInvoke(new Action <Label, int>(UploadControl), lblBfreequeue, AutoCollectionThread.PoolB.GetFreeQueueCount());
             lblBworking.BeginInvoke(new Action <Label, int>(UploadControl), lblBworking, AutoCollectionThread.PoolB.GetWorkingCount());
             lblBwaitlist.BeginInvoke(new Action <Label, int>(UploadControl), lblBwaitlist, AutoCollectionThread.PoolB.GetWaitListCount());
         }
         if (HeartbeatThread.PoolC != null)
         {
             lblCmin.BeginInvoke(new Action <Label, int>(UploadControl), lblCmin, HeartbeatThread.PoolC.GetMin());
             lblCmax.BeginInvoke(new Action <Label, int>(UploadControl), lblCmax, HeartbeatThread.PoolC.GetMax());
             lblCpublicpool.BeginInvoke(new Action <Label, int>(UploadControl), lblCpublicpool, HeartbeatThread.PoolC.GetPublicPoolCount());
             lblCfreequeue.BeginInvoke(new Action <Label, int>(UploadControl), lblCfreequeue, HeartbeatThread.PoolC.GetFreeQueueCount());
             lblCworking.BeginInvoke(new Action <Label, int>(UploadControl), lblCworking, HeartbeatThread.PoolC.GetWorkingCount());
             lblCwaitlist.BeginInvoke(new Action <Label, int>(UploadControl), lblCwaitlist, HeartbeatThread.PoolC.GetWaitListCount());
         }
         if (GPRSControl.DTU_NetServer.PoolD != null)
         {
             lblDmin.BeginInvoke(new Action <Label, int>(UploadControl), lblDmin, GPRSControl.DTU_NetServer.PoolD.GetMin());
             lblDmax.BeginInvoke(new Action <Label, int>(UploadControl), lblDmax, GPRSControl.DTU_NetServer.PoolD.GetMax());
             lblDpublicpool.BeginInvoke(new Action <Label, int>(UploadControl), lblDpublicpool, GPRSControl.DTU_NetServer.PoolD.GetPublicPoolCount());
             lblDfreequeue.BeginInvoke(new Action <Label, int>(UploadControl), lblDfreequeue, GPRSControl.DTU_NetServer.PoolD.GetFreeQueueCount());
             lblDworking.BeginInvoke(new Action <Label, int>(UploadControl), lblDworking, GPRSControl.DTU_NetServer.PoolD.GetWorkingCount());
             lblDwaitlist.BeginInvoke(new Action <Label, int>(UploadControl), lblDwaitlist, GPRSControl.DTU_NetServer.PoolD.GetWaitListCount());
         }
         if (V88CommunicationThread.getInstance().PoolE != null)
         {
             lblEmin.BeginInvoke(new Action <Label, int>(UploadControl), lblEmin, V88CommunicationThread.getInstance().PoolE.GetMin());
             lblEmax.BeginInvoke(new Action <Label, int>(UploadControl), lblEmax, V88CommunicationThread.getInstance().PoolE.GetMax());
             lblEpublicpool.BeginInvoke(new Action <Label, int>(UploadControl), lblEpublicpool, V88CommunicationThread.getInstance().PoolE.GetPublicPoolCount());
             lblEfreequeue.BeginInvoke(new Action <Label, int>(UploadControl), lblEfreequeue, V88CommunicationThread.getInstance().PoolE.GetFreeQueueCount());
             lblEworking.BeginInvoke(new Action <Label, int>(UploadControl), lblEworking, V88CommunicationThread.getInstance().PoolE.GetWorkingCount());
             lblEwaitlist.BeginInvoke(new Action <Label, int>(UploadControl), lblEwaitlist, V88CommunicationThread.getInstance().PoolE.GetWaitListCount());
         }
         //lblAinterval.Text = (SysConfig.userProfile.GongKuangConfigInterval / 1000).ToString();
         //lblBinterval.Text = (SysConfig.userProfile.RequestToClientInterval / 1000).ToString();
         //lblCinterval.Text = (SysConfig.userProfile.HeartbeatInterval / 1000).ToString();
         lblAinterval.BeginInvoke(new Action <Label, int>(UploadControl), lblAinterval, (int)SysConfig.userProfile.GongKuangConfigInterval / 1000);
         lblBinterval.BeginInvoke(new Action <Label, int>(UploadControl), lblBinterval, (int)SysConfig.userProfile.RequestToClientInterval / 1000);
         lblCinterval.BeginInvoke(new Action <Label, int>(UploadControl), lblCinterval, (int)SysConfig.userProfile.HeartbeatInterval / 1000);
     }
 }
Esempio n. 2
0
 private void GenerateXML()
 {
     while (true)
     {
         Thread.Sleep(30 * 60 * 1000);  //10分钟
         SysConfig.DTU_StationConfig.GenerateFromDbToXML();
         SysConfig.DTU_StationConfig.ReadConfig();
         V88CommunicationThread.getInstance().readConfig();
         DTU_ClientManager.Update();
     }
 }
Esempio n. 3
0
        //服务开启
        private void btn_Start_Click(object sender, EventArgs e)
        {
            try
            {
                if (test_connection() == false)
                {
                    listBox1.Items.Add("连接数据库失败");
                    listBox1.Items.Add("请确保数据库服务已开启,并且数据库连接填写正确");
                    return;
                }

                ServerSocketHelper.Init();
                ServerSocketHelper.StartListen(txt_ServerIp.Text.Trim(), txt_Port_SWS.Text.Trim());


                GPRSControl.DTU_NetServer.Init();
                // GPRSControl.GPRSControlNetServer.StartListen("192.168.1.8","5678");
                GPRSControl.DTU_NetServer.StartListen(txt_ServerIp.Text.Trim(), txt_port_DTU.Text.Trim());

                V88CommunicationThread.getInstance().Start();
                UdpV88Server.getInstance().StartListen(txt_ServerIp.Text.Trim(), txt_port_udp.Text.Trim());

                //心跳线程开启
                HeartbeatThread.Start();
                //主动发指令的线程开启
                ControlCommandThread.Start();
                //定时发指令的线程开启
                AutoCollectionThread.Start();

                save();

                btn_Start.Enabled = false;
                btn_Stop.Enabled  = true;

                ///关闭自动启动服务的定时器
                if (AutoStartTimer != null)
                {
                    AutoStartTimer.Stop();
                }
                listBox1.Items.Add("服务已成功开启");
            }
            catch (Exception ex)
            {
                ServerSocketHelper.Close();
                //  DTU_NetServer.Close();

                LogMg.AddError(ex);
                listBox1.Items.Add(ex.Message);
                //  MessageBox.Show(ex.Message);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 读取配置文件数据
        /// </summary>
        public static void ReadConfig()
        {
            DateTime start = DateTime.Now;

            userProfile.ReadConfig();
            orgConfig.ReadConfig();
            DTU_StationConfig.ReadConfig();

            DBCJconfig.ReadConfig();
            clientConfig.ReadConfig();
            GD_Config.GenerateConfig();

            V88CommunicationThread.getInstance().readConfig();
            DateTime end = DateTime.Now;

            LogMg.AddInfo(DateUtil.datediff(start, end));
        }
Esempio n. 5
0
 private void btnEsetMax_Click(object sender, EventArgs e)
 {
     SetMaxValue(V88CommunicationThread.getInstance().PoolE, tbEmax);
 }