Esempio n. 1
0
        public void get_mente_state()//读取维修的状态项目
        {
            listBox6.Items.Clear();
            short  a    = 1;  //开始
            short  b    = 10; //数量
            short  ret  = Fanuc.cnc_rdpm_item(Fanuc.h, a, ref b, inte);
            string str1 = "data";

            System.Type type = inte.GetType();//返回Type类型的当前对象的类型。


            if (ret == 0)
            {
                for (int i = 1; i < b; i++)
                {
                    str1 = "data" + i;
                    object      obj   = type.GetField(str1).GetValue(inte);
                    System.Type type1 = obj.GetType();
                    listBox6.Items.Add(i + "   " + type1.GetField("name").GetValue(obj).ToString() + " 寿命  " + type1.GetField("total").GetValue(obj).ToString() + type1.GetField("type").GetValue(obj).ToString());
                    listBox6.Items.Add("状态:   " + type1.GetField("stat").GetValue(obj).ToString());
                }
            }
            else
            {
                MessageBox.Show(ret + " ");
            }
        }