Ejemplo n.º 1
0
        /// <summary>
        /// 窗体初始化
        /// </summary>
        public FormMailPartition()
        {
            InitializeComponent();
            wrapper    = ModBusTCPIPWrapper.Instance();
            obrWrapper = new OBRClientWrapper();
            sqlHandler = SqlHelper.Instance();

            //委托实例化
            UpdateUIFunction      = new receiveUpdateUI(UpdateUIAction);
            UpdateBarcodeFunction = new barcodeUpdateUI(UpdateBarcodeAction);
            UpdateTimerFunction   = new UpdataTimer(UpdateTimerAction);
            UpdatePicFunction     = new UpdatePic(UpdatePicAction);

            //PLC IP 文本框及状态更新
            this.textBoxPLCIP.Text       = ConfigurationManager.AppSettings["PLCIP"];
            this.pictureBoxPLCConn.Image = Flag.BmpGray;
            //OBR IP 文本框及状态更新
            this.textBoxOBRIP.Text       = ConfigurationManager.AppSettings["OBRIP"];
            this.pictureBoxOBRConn.Image = Flag.BmpGray;

            //连接状态更新计时器开启
            this.timerStatus.Start();

            //开启服务端监听即接收线程和客户端发送线程
            StartListenThread();
            StartConnectPLCThread();
            StartConnectOBRThread();

            //开启更新UI文本框线程
            UpdateUIThread();
        }
        /// <summary>
        /// 窗体初始化
        /// </summary>
        public FormMailPartition()
        {
            InitializeComponent();
            wrapper = ModBusTCPIPWrapper.Instance();
            obrWrapper = new OBRClientWrapper();
            sqlHandler = SqlHelper.Instance();

            //委托实例化
            UpdateUIFunction = new receiveUpdateUI(UpdateUIAction);
            UpdateBarcodeFunction = new barcodeUpdateUI(UpdateBarcodeAction);
            UpdateTimerFunction = new UpdataTimer(UpdateTimerAction);
            UpdatePicFunction = new UpdatePic(UpdatePicAction);

            //PLC IP 文本框及状态更新
            this.textBoxPLCIP.Text = ConfigurationManager.AppSettings["PLCIP"];
            this.pictureBoxPLCConn.Image = Flag.BmpGray;
            //OBR IP 文本框及状态更新
            this.textBoxOBRIP.Text = ConfigurationManager.AppSettings["OBRIP"];
            this.pictureBoxOBRConn.Image = Flag.BmpGray;

            //连接状态更新计时器开启
            this.timerStatus.Start();

            //开启服务端监听即接收线程和客户端发送线程
            StartListenThread();
            StartConnectPLCThread();
            StartConnectOBRThread();

            //开启更新UI文本框线程
            UpdateUIThread();
        }