Пример #1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            string path = Environment.CurrentDirectory + "\\Data.db";

            DbHelper.LoadDb(path);

            DataValidation.IsProtocol   = true;
            DataValidation.ProtocolHead = 2;
            DataValidation.ProtocolEnd  = 3;
            DataValidation.IsValidation = true;

            _mPort = new PortHelper
            {
                PortIsOpenChange = PortOpenOrCloseChange,
                PortDataReceived = PortDataReceived
            };
            _myMutex              = new Mutex();
            _comPort              = new ComPortHelper();
            _comPort.CountChange += ComPortChange;
            _comPort.Start();

            _rect = new Rectangle(p_ComPort.Width / 2 - 20, p_ComPort.Height - 14, 40, 14);

            _mNumber = DbHelper.Db.FirstDefault <ModuleNumber>() ?? new ModuleNumber()
            {
                Number = 1
            };
            tb_ID.Text = _mNumber.Number.ToString();
        }
Пример #2
0
        private void MainForm_Shown(object sender, EventArgs e)
        {
            _m_Port = new PortHelper();
            _m_Port.PortDataReceived = OnPortDataReceived;
            _m_Port.PortIsOpenChange = OnPortOpenAndCloseChange;

            _m_ComPort              = new ComPortHelper();
            _m_ComPort.CountChange += _m_ComPort_CountChange;
            _m_ComPort.Start();

            dgv_CustomerList.Focus();
        }