Example #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            string jxDB        = ConfigurationManager.AppSettings["JXDataBase"];
            string jxDBUserPwd = ConfigurationManager.AppSettings["JXDataBaseUserPwd"];

            jxDBUserPwd = EncAndDec.Decode(jxDBUserPwd, "zwx", "xwz");
            if (string.IsNullOrEmpty(jxDBUserPwd))
            {
                MessageBox.Show("数据库连接信息错误");
                return;
            }
            PubConstant.ConnectionString = jxDB + jxDBUserPwd;

            this.comboBoxPlcObjList.SelectedIndex = 0;


            //  this.tabPage1.Enabled = false;
            devBll                   = new DeviceBll();
            ctlTaskBll               = new ControlTaskBll();
            ctlTaskIFBll             = new ControlInterfaceBll();
            palletBll                = new OCVPalletBll();
            batteryBll               = new OCVBatteryBll();
            manTaskBll               = new ManageTaskBll();
            makeCardBll              = new MakeCardRecordBll();
            plcRwObj                 = new PLCRW();
            plcRwObj.eventLinkLost  += PlcLostConnectHandler;
            plcRwObj2                = new PLCRWNet();
            plcRwObj2.eventLinkLost += PlcLostConnectHandler;
            if (this.comboBoxPlcObjList.Text == "PLC控件")
            {
                plcRwIF = plcRwObj;
            }
            else if (this.comboBoxPlcObjList.Text == "重新实现MC协议")
            {
                plcRwIF = plcRwObj2;
            }

            plcFx485 = new PlcRW485BD();
            plcFx485.StationNumber = 1;
            HFReaderIF readerIF = new HFReaderIF();

            rfidRW          = new SgrfidRW(1);
            rfidRW.ReaderIF = readerIF;
            this.comboBoxComports.Items.Clear();

            string[] ports = System.IO.Ports.SerialPort.GetPortNames();
            foreach (string port in ports)
            {
                this.comboBoxComports.Items.Add(port);
                this.comboBoxFXComs.Items.Add(port);
            }
            if (ports != null && ports.Count() > 0)
            {
                this.comboBoxComports.Text = ports[0];
                this.comboBoxFXComs.Text   = ports[0];
            }
            makeCardCount = makeCardBll.GetRecordCount(" ");
            this.labelMakeCardCount.Text = "计数:" + makeCardCount.ToString();
        }
Example #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            ctlManager = new ECAMWCS();
            ctlManager.AttachErrorHandler(ErrorEventHandler);
            ctlManager.AttachLogHandler(LogEventHandler);
            this.buttonStart.Enabled = false;
            this.buttonStop.Enabled  = false;
            //  this.tabPage1.Enabled = false;
            devBll                  = new DeviceBll();
            ctlTaskBll              = new ControlTaskBll();
            ctlTaskIFBll            = new ControlInterfaceBll();
            palletBll               = new OCVPalletBll();
            batteryBll              = new OCVBatteryBll();
            manTaskBll              = new ManageTaskBll();
            plcRwObj                = new PLCRW();
            plcRwObj.eventLinkLost += PlcLostConnectHandler;
            HFReaderIF readerIF = new HFReaderIF();

            rfidRW = new SgrfidRW(1);

            this.comboBoxComports.Items.Clear();
            int i = 0;

            string[] ports = System.IO.Ports.SerialPort.GetPortNames();
            foreach (string port in ports)
            {
                this.comboBoxComports.Items.Add(port);
                i++;
            }
            if (ports != null && ports.Count() > 0)
            {
                this.comboBoxComports.Text = ports[0];
            }

            rfidWorkingThread = new Thread(new ThreadStart(SysWorkingProc));
            rfidWorkingThread.IsBackground = true;
            rfidWorkingThread.Name         = "RFID读写卡测试线程";
        }