Example #1
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            cmbWorkPort.Items.AddRange(SerialPort.GetPortNames());
            cmbMeterPort.Items.AddRange(SerialPort.GetPortNames());
            if (cmbWorkPort.Items.Count > 0)
            {
                cmbWorkPort.SelectedIndex = 0;
            }
            toolStripComboBox2.Items.AddRange(new string[] { "9600", "38400", "57600", "115200", "500000" });
            toolStripComboBox2.SelectedIndex = 2;

            formDataReceive  = new FormReceiveData();
            formDataSend     = new FormSendData();
            frmAnalogDisplay = new FrmAnalogDisplay();
            formBoardFuncSet = new FormBoardFuncSet();

            frmMeter = new FromMeter();
            formDataReceive.Show(this.dpMain);
            formDataSend.Show(formDataReceive.Pane, DockAlignment.Right, 0.5);
            frmAnalogDisplay.Show(dpMain);


            formBoardFuncSet.Show(dpMain);
            // frmMeter.Show(dpMain);
            Protocol.FrameReceive.Start();



            XmlDocument document = new XmlDocument();

            try
            {
                document.Load(".\\MySetting.XML");
                XmlNode node = document.SelectSingleNode("/Config/Board/BoardAddr");

                txtBoardAddr.Text = node.InnerXml;
                node = document.SelectSingleNode("/Config/Board/BoardStyle");
                cmbCardStyle.SelectedIndex = int.Parse(node.InnerXml);
                node = document.SelectSingleNode("/Config/Board/BoardStyle");
                cmbCardStyle.SelectedIndex = int.Parse(node.InnerXml);
                node = document.SelectSingleNode("/Config/Ports/Work/Port");
                cmbWorkPort.SelectedIndex = int.Parse(node.InnerXml);
                node = document.SelectSingleNode("/Config/Ports/Meter/Port");
                cmbMeterPort.SelectedIndex = int.Parse(node.InnerXml);
            }
            catch (System.Exception ex)
            {
                txtBoardAddr.Text          = "3";
                cmbCardStyle.SelectedIndex = 0;
            }

            Thread485.RdAddrFinish += ReadAddr_Finish;
            Thread485.WrAddrFinish += new Thread485.WriteAddrFinish(Thread485_WrAddrFinish);
        }
Example #2
0
 private void toolStripMenuItemFuncSet_Click(object sender, EventArgs e)
 {
     if (formBoardFuncSet == null || formBoardFuncSet.IsDisposed)
     {
         formBoardFuncSet           = new FormBoardFuncSet();
         formBoardFuncSet.MdiParent = this;
         formBoardFuncSet.Show();
     }
     else
     {
         formBoardFuncSet.Activate();
     }
 }
Example #3
0
        private void toolStripMenuItemFuncSet_Click(object sender, EventArgs e)
        {
            if (formBoardFuncSet == null || formBoardFuncSet.IsDisposed)
            {
                formBoardFuncSet = new FormBoardFuncSet();

                formBoardFuncSet.Show(dpMain);

            }
            else
            {
                formBoardFuncSet.Activate();
            }
        }
Example #4
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            cmbWorkPort.Items.AddRange(SerialPort.GetPortNames());
            cmbMeterPort.Items.AddRange(SerialPort.GetPortNames());
            if (cmbWorkPort.Items.Count > 0)
            {
                cmbWorkPort.SelectedIndex = 0;
            }
            toolStripComboBox2.Items.AddRange(new string[] { "9600", "38400", "57600","115200","500000" });
            toolStripComboBox2.SelectedIndex = 2;

            formDataReceive = new FormReceiveData();
            formDataSend = new FormSendData();
            frmAnalogDisplay = new FrmAnalogDisplay();
            formBoardFuncSet = new FormBoardFuncSet();

            frmMeter = new FromMeter();
            formDataReceive.Show(this.dpMain);
            formDataSend.Show(formDataReceive.Pane,DockAlignment.Right,0.5);
            frmAnalogDisplay.Show(dpMain);

            formBoardFuncSet.Show(dpMain);
             // frmMeter.Show(dpMain);
            Protocol.FrameReceive.Start();

            XmlDocument document = new XmlDocument();
            try
            {
                document.Load(".\\MySetting.XML");
                XmlNode node= document.SelectSingleNode("/Config/Board/BoardAddr");

                txtBoardAddr.Text = node.InnerXml;
                node = document.SelectSingleNode("/Config/Board/BoardStyle");
                cmbCardStyle.SelectedIndex = int.Parse(node.InnerXml);
                node = document.SelectSingleNode("/Config/Board/BoardStyle");
                cmbCardStyle.SelectedIndex = int.Parse(node.InnerXml);
                node = document.SelectSingleNode("/Config/Ports/Work/Port");
                cmbWorkPort.SelectedIndex = int.Parse(node.InnerXml);
                node = document.SelectSingleNode("/Config/Ports/Meter/Port");
                cmbMeterPort.SelectedIndex = int.Parse(node.InnerXml);

            }
            catch (System.Exception ex)
            {
                txtBoardAddr.Text = "3";
                cmbCardStyle.SelectedIndex = 0;
            }

            Thread485.RdAddrFinish += ReadAddr_Finish;
            Thread485.WrAddrFinish += new Thread485.WriteAddrFinish(Thread485_WrAddrFinish);
        }