예제 #1
0
        private void EditIPForm_Load(object sender, EventArgs e)
        {
            DataTable dt = new ClientInfoDal().GetDSById(id);

            if (dt != null)
            {
                tbIpName.Text    = dt.Rows[0]["name"].ToString();
                tbCode.Text      = dt.Rows[0]["code"].ToString();
                tbIp.Text        = dt.Rows[0]["ip"].ToString();
                tbIpPort.Text    = dt.Rows[0]["port"].ToString();
                tbIpTimoOut.Text = dt.Rows[0]["timeouts"].ToString();
                if (dt.Rows[0]["status"].ToString() == "1")
                {
                    rb1.Checked = true;
                    rb0.Checked = false;
                }
                else
                {
                    rb0.Checked = true;
                    rb1.Checked = false;
                }
            }

            tbIpName.Focus();
        }
예제 #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            RobotInfo.DeviceCode = ConfigurationManager.AppSettings["devicecode"];

            List <ClientIpInfoModel> list = new List <ClientIpInfoModel>();
            DataTable dt = new ClientInfoDal().GetDS();

            if (dt != null && dt.Rows.Count > 0)
            {
                int width = 0;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ClientIpInfoModel model = new ClientIpInfoModel();
                    model.Id       = Convert.ToInt32(dt.Rows[i]["id"].ToString());
                    model.Code     = dt.Rows[i]["code"].ToString();
                    model.Name     = dt.Rows[i]["name"].ToString();
                    model.IP       = dt.Rows[i]["ip"].ToString();
                    model.Port     = dt.Rows[i]["port"].ToString();
                    model.Timeouts = Convert.ToInt32(dt.Rows[i]["timeouts"].ToString());
                    model.Status   = Convert.ToInt32(dt.Rows[i]["status"].ToString());
                    list.Add(model);

                    PCUserControl pc = new PCUserControl();
                    pc.LabelText(model.Name);
                    pc.Location = new Point(width, 0);
                    width       = width + pc.Width;
                    panelPC.Controls.Add(pc);
                }
            }
            AppInfo.ClientInfoList = list;

            //串口打开
            try
            {
                if (!serialPort1.IsOpen)
                {
                    serialPort1.Open();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
예제 #3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //当前设备编码
            RobotInfo.DeviceCode       = ConfigurationManager.AppSettings["devicecode"];
            this.Text                  = this.Text + RobotInfo.DeviceCode;//当前编码
            SystemInfo.ClientInfoList  = new List <ClientInfo>();
            SystemInfo.clientRequestCQ = new  ConcurrentQueue <ClientRquestInfo>();
            List <ClientIpInfoModel> list = new List <ClientIpInfoModel>();
            DataTable dt = new ClientInfoDal().GetDS();

            if (dt != null && dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ClientIpInfoModel model = new ClientIpInfoModel();
                    model.Id       = Convert.ToInt32(dt.Rows[i]["id"].ToString());
                    model.Code     = dt.Rows[i]["code"].ToString();
                    model.Name     = dt.Rows[i]["name"].ToString();
                    model.IP       = dt.Rows[i]["ip"].ToString();
                    model.Port     = dt.Rows[i]["port"].ToString();
                    model.Timeouts = Convert.ToInt32(dt.Rows[i]["timeouts"].ToString());
                    model.Status   = Convert.ToInt32(dt.Rows[i]["status"].ToString());
                    list.Add(model);

                    ClientInfo info = new ClientInfo();
                    info.Code = dt.Rows[i]["code"].ToString();
                    info.Name = dt.Rows[i]["name"].ToString();
                    info.Ip   = dt.Rows[i]["ip"].ToString();
                    SystemInfo.ClientInfoList.Add(info);
                }
            }
            AppInfo.ClientInfoList = list;

            LoadFctPos();
            LoadIOPos();
            SystemInfo.FctPosList = fctPosList;
            SystemInfo.IoInfoList = ioInfoList;


            try
            {
                button1_Click(null, null);
            }
            catch (Exception ex)
            {
                LogHelper.Log("服务端启动失败" + ex.Message);
                MessageBox.Show("服务端启动失败" + ex.Message);
                return;
            }


            u1 = new UcFlow();
            tabPage5.Controls.Add(u1);
            ioCard = RobotApp.IoCard;

            homeControl      = new HomeControl();
            homeControl.Dock = DockStyle.Fill;
            panel2.Controls.Add(homeControl);

            TaskContinue.Start(delegate
            {
                if (!RobotApp.BRun)
                {
                    return(false);
                }
                bool b = true;
                if (bRefresh)
                {
                    b = ioCard.RefreshDI();
                }
                return(b);
            }, 100, "IoCard");

            u1.ConsoleMsgEvent  += u1_ConsoleMsgEvent;
            u1.SendMessageEvent += u1_SendMessageEvent;
            u1.RobotStatusEvent += u1_RobotStatusEvent;

            homeControl.SendMessageEvent += u1_SendMessageEvent;


            Task.Factory.StartNew(() => {
                WriteLog();
            });
            //日志处理
        }
예제 #4
0
        public void BindClientIPInfo()
        {
            DataTable dt = new ClientInfoDal().GetDS();

            dgvClientInfo.DataSource = dt;
        }