Exemplo n.º 1
0
        public void flushf3test(List <string> Cangets, int flushtype, Form3 f3) //flushtype无效
        {
            Analysis      ay = new Analysis();
            List <string> AnalysisOK;

            foreach (string Canget in Cangets)
            {
                if (string.Equals("t", Canget.Substring(0, 1)) || string.Equals("T", Canget.Substring(0, 1)))
                {
                    AnalysisOK = ay.canReceiptAnalysis(Canget);
                    foreach (string CanData in AnalysisOK)
                    {
                        string[] Data = CanData.Split(',');
                        //Console.WriteLine(Data[0] + "----------" + Data[1]);
                        ListViewItem listv = new ListViewItem();
                        listv.Text = Data[0];        //第一列
                        listv.SubItems.Add(Data[1]); //没有报错提示

                        //Data[1]是数值
                        CanMesslistView.Items.Add(listv);


                        //给出选择的器件序号


                        //找出器件的值


                        //刷新LED


                        //ay.getCanAllInfoFromDatabase();
                        //f3.changeLED("10,000");
                    }

                    if (f3 != null)
                    {
                        List <string> retCanIDandlocal = f3.retCanIDandlocal;

                        string anaresultID = Canget;

                        int IDlen = 3;
                        if (string.Equals(anaresultID.Substring(0, 1), "t")) //标准帧
                        {
                            IDlen = 3;
                        }
                        else if (string.Equals(anaresultID.Substring(0, 1), "T")) //扩展帧
                        {
                            IDlen = 8;
                        }
                        anaresultID = Canget.Substring(1, IDlen);
                        anaresultID = (Int32.Parse(anaresultID, System.Globalization.NumberStyles.HexNumber)).ToString(); //16转10进制
                                                                                                                          //判断是否在选中的ID中
                        foreach (string Canselected in retCanIDandlocal)
                        {
                            string[] Canblock = Canselected.Split(' ');
                            if (string.Equals(Canblock[0], anaresultID.ToString()))
                            {
                                //Data[1];
                                string[] select = Canselected.Split(' ');
                                int      num    = Convert.ToInt32(select[1]);
                                string[] LED    = AnalysisOK[num].Split(',');
                                //string Canvalue = string.Format("{0:0000.0}", Convert.ToDouble(LED[1]));
                                //string Canvalue = string.Format("{0:0000.0}", Convert.ToDouble("-1"));
                                //string Canvalue = "12.2";
                                //加入判断,如果有
                                string Canvalue = LED[1];


                                f3.changearcScale(Convert.ToSingle(LED[2]), Convert.ToSingle(LED[3]), Convert.ToSingle(LED[1]));
                                //f3.changearcScale(0F,100F,50F);
                                f3.changeLED(Canvalue);
                            }
                        }
                    }
                }
                else
                {
                    ListViewItem listv = new ListViewItem();
                    listv.Text = Canget;
                    CanMesslistView.Items.Add(listv);
                }
            }

            //f3.changeLED("10,000");
        }
Exemplo n.º 2
0
 private void showconwindbutton_Click(object sender, EventArgs e)
 {
     f3 = new Form3(new SetVisiableHandler(SetVisiable1), new SetVisiableHandler(SetVisiable0));
     f3.Show();
 }