Beispiel #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);
        }
Beispiel #2
0
        private void toolStripMenuItemViewSend_Click(object sender, EventArgs e)
        {
            if (formDataSend == null || formDataSend.IsDisposed)
            {
                formDataSend = new FormSendData();

                formDataSend.Show(this.dpMain);
            }
            else
            {
                formDataSend.Activate();
            }
        }
Beispiel #3
0
 private void toolStripMenuItemViewSend_Click(object sender, EventArgs e)
 {
     if (formDataSend == null || formDataSend.IsDisposed)
     {
         formDataSend               = new FormSendData();
         formDataSend.MdiParent     = this;
         formDataSend.StartPosition = FormStartPosition.Manual;
         formDataSend.Location      = new Point(this.ClientSize.Width / 2 - 100, 0);
         formDataSend.Size          = new Size(this.ClientSize.Width / 2, this.ClientSize.Height / 2);
         formDataSend.Show();
     }
     else
     {
         formDataSend.Activate();
     }
 }
Beispiel #4
0
        private void toolStripMenuItemViewSend_Click(object sender, EventArgs e)
        {
            if (formDataSend == null || formDataSend.IsDisposed)
            {
                formDataSend = new FormSendData();

                formDataSend.Show(this.dpMain);
            }
            else
            {
                formDataSend.Activate();
            }
        }
Beispiel #5
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);
        }
Beispiel #6
0
 private void toolStripMenuItemViewSend_Click(object sender, EventArgs e)
 {
     if (formDataSend == null || formDataSend.IsDisposed)
     {
         formDataSend = new FormSendData();
         formDataSend.MdiParent = this;
         formDataSend.StartPosition = FormStartPosition.Manual;
         formDataSend.Location = new Point(this.ClientSize.Width / 2-100, 0);
         formDataSend.Size = new Size(this.ClientSize.Width / 2, this.ClientSize.Height / 2);
         formDataSend.Show();
     }
     else
     {
         formDataSend.Activate();
     }
 }