Beispiel #1
0
        private int[] fctext = new int[50];//故障配置
        
        //public FaultInfoConfigForm(SerialPort paramPortDev)
        public FaultInfoConfigForm(DevExpress.XtraBars.Ribbon.RibbonForm form)
        {
            InitializeComponent();
            //mSerialPort = paramPortDev;
            //mSerialPort.ReceivedBytesThreshold = 1; 
            this._form = form;

            //初始化配置值
            //获取静态配置类中的配置值
            List<string> configList = FaultInfoConfigValue.getConfigList();
            if (null == configList || configList.Count != 25)
            {
                 
            }
            else
            {
                //1-23循环显示在相应输入框
                for (int i = 1; i <= 23; i++)
                {
                    string configVal = configList[i - 1];
                    Control control = Controls.Find("numericUpDown" + Convert.ToString(i), true)[0];
                    control.GetType().GetProperty("Text").SetValue(control, configVal, null);
                    //String value = control.GetType().GetProperty("Text").GetValue(control, null).ToString();
                }

                //combox设置值
                for (int i = 1; i <= 2; i++)
                { 
                    Control control = Controls.Find("comboBox" + Convert.ToString(i), true)[0]; 
                    control.GetType().GetProperty("SelectedIndex").SetValue(control, configList[22 + i] == "0" ? 1 : 0, null);
                }
            }

        }
Beispiel #2
0
        /// <summary>
        /// 获取故障配置值,并显示在相应输入框中【已废弃】
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click_used(object sender, EventArgs e)
        {
            //获取静态配置类中的配置值
            List<string> configList = FaultInfoConfigValue.getConfigList();
            if (null == configList || configList.Count != 25) {
                XtraMessageBox.Show("读取失败,请完成配置再读取哦!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            //1-23循环显示在相应输入框
            for (int i = 1; i <= 23; i++)
            {
                string configVal = configList[i-1]; 
                Control control = Controls.Find("numericUpDown" + Convert.ToString(i), true)[0];
                control.GetType().GetProperty("Text").SetValue(control, configVal, null);
                //String value = control.GetType().GetProperty("Text").GetValue(control, null).ToString();
            }

            //combox设置值
            for (int i = 1; i <= 2; i++)
            { 
                Control control = Controls.Find("comboBox" + Convert.ToString(i), true)[0]; 

                control.GetType().GetProperty("SelectedIndex").SetValue(control, configList[22 + i] == "0" ? 1:0, null);
            }

            XtraMessageBox.Show("指令已下发!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

        } 
Beispiel #3
0
        /// <summary>
        /// 监听故障信息检测
        /// 
        /// </summary>
        /// <param name="lastUpdateTime"></param>
        public void listenFaultInfoConfigValue(Object lastUpdateTime) { 
            int index = 0;
            while (true)
            {
                //超时
                if (index >= 10)
                {
                    XtraMessageBox.Show("读取超时,请稍后重试!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    break;
                }
                //未配置
                if (FaultInfoConfigValue.updateTime < Convert.ToInt64(lastUpdateTime))
                {
                    XtraMessageBox.Show("故障信息未配置!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    break;
                }
                //读取配置成功
                if (FaultInfoConfigValue.updateTime > Convert.ToInt64(lastUpdateTime))
                {
                    Action action = () =>
                    {
                        //获取静态配置类中的配置值
                        List<string> configList = FaultInfoConfigValue.getConfigList();
                        if (configList.Count != 25)
                        {
                            XtraMessageBox.Show("读取失败,配置信息不完整!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }
                        //1-23循环显示在相应输入框
                        for (int i = 1; i <= 23; i++)
                        {
                            string configVal = configList[i - 1];
                            Control control = Controls.Find("numericUpDown" + Convert.ToString(i), true)[0];
                            control.GetType().GetProperty("Text").SetValue(control, configVal, null);
                            //String value = control.GetType().GetProperty("Text").GetValue(control, null).ToString();
                        }

                        //combox设置值
                        for (int i = 1; i <= 2; i++)
                        {
                            Control control = Controls.Find("comboBox" + Convert.ToString(i), true)[0];

                            control.GetType().GetProperty("SelectedIndex").SetValue(control, configList[22 + i] == "0" ? 1 : 0, null);
                        }
                    };
                    Invoke(action);   

                    XtraMessageBox.Show("读取成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    break;
                }
                index++;
                Thread.Sleep(1000);
            } 
        }