示例#1
0
        /// <summary>
        /// 数据读取
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btDRead_Click(object sender, EventArgs e)
        {
            FormGaugeP lForm = (FormGaugeP)this.Owner;//把Form2的父窗口指针赋给lForm1

            SensorCalib = lForm.GetSensorCalib();
            SensorItems = lForm.GetSensorItems();
            int len = SensorItems.Length;

            Sensor1Volt = lForm.GetSensorData(0);
            Sensor1Show = lForm.GetSensorData(1);
            Sensor2Volt = lForm.GetSensorData(2);
            Sensor2Show = lForm.GetSensorData(3);
            Sensor3Volt = lForm.GetSensorData(4);
            Sensor3Show = lForm.GetSensorData(5);
            Sensor4Volt = lForm.GetSensorData(6);
            Sensor4Show = lForm.GetSensorData(7);
            Curve_Selected_Fresh(SensorSel);

            cbSenCh1.SelectedIndex = SensorItems[0];
            cbSenCh2.SelectedIndex = SensorItems[1];
            cbSenCh3.SelectedIndex = SensorItems[2];
            cbSenCh4.SelectedIndex = SensorItems[3];

            tbSenCalib1.Text = SensorCalib[0].ToString();
            tbSenCalib2.Text = SensorCalib[1].ToString();
            tbSenCalib3.Text = SensorCalib[2].ToString();
            tbSenCalib4.Text = SensorCalib[3].ToString();

            btDWrite.Enabled = true;    //
        }
示例#2
0
        /// <summary>
        /// 确认
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btYes_Click(object sender, EventArgs e)
        {
            FormGaugeP lForm1 = (FormGaugeP)this.Owner;//把Form2的父窗口指针赋给lForm1
            int        Pol    = cbPolY1.SelectedIndex << 0 | cbPolY2.SelectedIndex << 1 | cbPolY3.SelectedIndex << 2 | cbPolY4.SelectedIndex << 3 |
                      cbPolLed1.SelectedIndex << 4 | cbPolLed2.SelectedIndex << 5 | cbPolLed3.SelectedIndex << 6 | cbPolLed4.SelectedIndex << 7;

            lForm1.SetPolarity(Pol);

            this.Close();
        }
示例#3
0
        private void FormPol_Load(object sender, EventArgs e)
        {
            FormGaugeP lForm1 = (FormGaugeP)this.Owner;//把Form2的父窗口指针赋给lForm1
            int        Pol    = lForm1.GetPolarity();

            cbPolY1.SelectedIndex   = (Pol & 1 << 0) == 0 ? 0 : 1;     //输出口1极性
            cbPolY2.SelectedIndex   = (Pol & 1 << 1) == 0 ? 0 : 1;     //输出口2极性
            cbPolY3.SelectedIndex   = (Pol & 1 << 2) == 0 ? 0 : 1;     //输出口3极性
            cbPolY4.SelectedIndex   = (Pol & 1 << 3) == 0 ? 0 : 1;     //输出口4极性
            cbPolLed1.SelectedIndex = (Pol & 1 << 4) == 0 ? 0 : 1;     //LED1极性
            cbPolLed2.SelectedIndex = (Pol & 1 << 5) == 0 ? 0 : 1;     //LED2极性
            cbPolLed3.SelectedIndex = (Pol & 1 << 6) == 0 ? 0 : 1;     //LED3极性
            cbPolLed4.SelectedIndex = (Pol & 1 << 7) == 0 ? 0 : 1;     //LED4极性
        }
示例#4
0
        private void btDWrite_Click(object sender, EventArgs e)
        {
            FormGaugeP lForm = (FormGaugeP)this.Owner;//把Form2的父窗口指针赋给lForm1

            lForm.SetSensorCalib(SensorCalib);
            SensorItems[0] = cbSenCh1.SelectedIndex;
            SensorItems[1] = cbSenCh2.SelectedIndex;
            SensorItems[2] = cbSenCh3.SelectedIndex;
            SensorItems[3] = cbSenCh4.SelectedIndex;
            lForm.SetSensorItems(SensorItems);
            lForm.SetSensorData(0, Sensor1Volt, Sensor1Show);
            lForm.SetSensorData(1, Sensor2Volt, Sensor2Show);
            lForm.SetSensorData(2, Sensor3Volt, Sensor3Show);
            lForm.SetSensorData(3, Sensor4Volt, Sensor4Show);
        }
示例#5
0
        /// <summary>
        /// 切换上位机版本
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tscbVer_SelectedIndexChanged(object sender, EventArgs e)
        {
            data.VerUper = tscbVer.SelectedIndex;

            if (data.VerUper == 0)          //自动检测
            {
                btnCheck.Enabled = true;
                btnCheck.Visible = true;

                btnNett.Enabled = true;
                btnNett.Visible = true;

                if (formS1 != null)
                {
                    formS1.Hide();                  //Dispose Hide
                }
                if (formS2 != null)
                {
                    formS2.Hide();
                }
                if (formGaugeP != null)
                {
                    formGaugeP.Hide();
                }
                if (formYKUCC52 != null)
                {
                    formYKUCC52.Hide();
                }
            }
            else if (data.VerUper == 1)     //S1卡
            {
                btnCheck.Enabled = false;
                btnCheck.Visible = false;

                btnNett.Enabled = false;
                btnNett.Visible = false;

                if (formS2 != null)
                {
                    formS2.Hide();
                }
                if (formGaugeP != null)
                {
                    formGaugeP.Hide();
                }
                if (formYKUCC52 != null)
                {
                    formYKUCC52.Hide();
                }

                panel.Controls.Clear();//移除所有控件
                if (formS1 == null)
                {
                    formS1 = new FormS1();
                }
                formS1.Owner           = this;                 //标注父窗体
                formS1.FormBorderStyle = FormBorderStyle.None; //隐藏子窗体边框(去除最小花,最大化,关闭等按钮)
                formS1.TopLevel        = false;                //指示子窗体非顶级窗体
                panel.Controls.Add(formS1);                    //将子窗体载入panel
                formS1.Show();
            }
            else if (data.VerUper == 2)     //S2卡
            {
                btnCheck.Enabled = false;
                btnCheck.Visible = false;

                btnNett.Enabled = true;
                btnNett.Visible = true;

                if (formS1 != null)
                {
                    formS1.Hide();
                }
                if (formGaugeP != null)
                {
                    formGaugeP.Hide();
                }
                if (formYKUCC52 != null)
                {
                    formYKUCC52.Hide();
                }

                panel.Controls.Clear();//移除所有控件
                if (formS2 == null)
                {
                    formS2 = new FormS2();                     //避免重复创建窗口,只创建一次,之后使用Hide()与Show()实现窗体的变化
                }
                formS2.Owner           = this;                 //标注父窗体
                formS2.FormBorderStyle = FormBorderStyle.None; //隐藏子窗体边框(去除最小花,最大化,关闭等按钮)
                formS2.TopLevel        = false;                //指示子窗体非顶级窗体
                panel.Controls.Add(formS2);                    //将子窗体载入panel
                formS2.Show();
            }
            else if (data.VerUper == 3)     //负压表
            {
                btnCheck.Enabled = false;
                btnCheck.Visible = false;

                btnNett.Enabled = false;
                btnNett.Visible = false;

                if (formS1 != null)
                {
                    formS1.Hide();
                }
                if (formS2 != null)
                {
                    formS2.Hide();
                }
                if (formYKUCC52 != null)
                {
                    formYKUCC52.Hide();
                }

                panel.Controls.Clear();//移除所有控件
                if (formGaugeP == null)
                {
                    formGaugeP = new FormGaugeP();                 //避免重复创建窗口,只创建一次,之后使用Hide()与Show()实现窗体的变化
                }
                formGaugeP.Owner           = this;                 //标注父窗体
                formGaugeP.FormBorderStyle = FormBorderStyle.None; //隐藏子窗体边框(去除最小花,最大化,关闭等按钮)
                formGaugeP.TopLevel        = false;                //指示子窗体非顶级窗体
                panel.Controls.Add(formGaugeP);                    //将子窗体载入panel
                formGaugeP.Show();
            }
            else if (data.VerUper == 4)     //调光器
            {
                btnCheck.Enabled = false;
                btnCheck.Visible = false;

                btnNett.Enabled = false;
                btnNett.Visible = false;

                if (formS1 != null)
                {
                    formS1.Hide();
                }
                if (formS2 != null)
                {
                    formS2.Hide();
                }
                if (formGaugeP != null)
                {
                    formGaugeP.Hide();
                }

                panel.Controls.Clear();//移除所有控件
                if (formYKUCC52 == null)
                {
                    formYKUCC52 = new FormYKUCC52();                //避免重复创建窗口,只创建一次,之后使用Hide()与Show()实现窗体的变化
                }
                formYKUCC52.Owner           = this;                 //标注父窗体
                formYKUCC52.FormBorderStyle = FormBorderStyle.None; //隐藏子窗体边框(去除最小花,最大化,关闭等按钮)
                formYKUCC52.TopLevel        = false;                //指示子窗体非顶级窗体
                panel.Controls.Add(formYKUCC52);                    //将子窗体载入panel
                formYKUCC52.Show();
            }
        }