/**
         * 根据选择的步骤加载数据
         * */
        private void step_ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (step_ListBox.Items.Count < 1)
            {
                return;
            }
            string         step_name      = ((ListBoxItem)step_ListBox.SelectedItem).Content.ToString();
            TEMPLATE_Model tEMPLATE_Model = new TEMPLATE_Model();

            foreach (var item in DATA)
            {
                if (step_name.Equals(item.Step_name))
                {
                    tEMPLATE_Model = item;
                    break;
                }
            }
            /*在页面上填入数据*/
            FillData(tEMPLATE_Model);
        }
 /**
  * 页面填入数据
  * */
 public void FillData(TEMPLATE_Model tEMPLATE_Model)
 {
     last_time_TextBox.Text = tEMPLATE_Model.Pulse_width;
     pressure_TextBox.Text  = tEMPLATE_Model.Rail_pressure.ToString();
     oil_p_hor_TextBox.Text = tEMPLATE_Model.Oil_p_standard;
     oil_p_ver_TextBox.Text = tEMPLATE_Model.Oil_p_deviation;
     oil_h_hor_TextBox.Text = tEMPLATE_Model.Oil_h_standard;
     oil_h_ver_TextBox.Text = tEMPLATE_Model.Oil_h_pressure;
     //脉宽和时间的区分?
     test_time_TextBox.Text = tEMPLATE_Model.Control_last_time;
     if (null == tEMPLATE_Model.Curve || tEMPLATE_Model.Curve.Length == 0)
     {
         curve_TextBox.Text = null;
     }
     else
     {
         curve_TextBox.Text = tEMPLATE_Model.Curve.ToString();
     }
     magn_TextBox.Text    = tEMPLATE_Model.Manufacturer;
     period_TextBox.Text  = "未设定";
     voltage_TextBox.Text = tEMPLATE_Model.Voltage;
     //读取数据后设置不可读
 }
Пример #3
0
        public static TEMPLATE_Model StringToTEMPLATEModel(int length, string[] readline)
        {
            TEMPLATE_Model tEMPLATE_Model = new TEMPLATE_Model();

            tEMPLATE_Model.Manufacturer      = readline[0];
            tEMPLATE_Model.Curve             = readline[1];
            tEMPLATE_Model.Step_name         = readline[2];
            tEMPLATE_Model.Round_speed       = readline[3];
            tEMPLATE_Model.Oil_p_standard    = readline[4];
            tEMPLATE_Model.Oil_p_deviation   = readline[5];
            tEMPLATE_Model.Oil_h_standard    = readline[6];
            tEMPLATE_Model.Oil_h_deviation   = readline[7];
            tEMPLATE_Model.Pulse_width       = readline[8];
            tEMPLATE_Model.Rail_pressure     = readline[9];
            tEMPLATE_Model.Oil_j_pressure    = readline[10];
            tEMPLATE_Model.Oil_h_pressure    = readline[11];
            tEMPLATE_Model.Punmp_pressure    = readline[12];
            tEMPLATE_Model.Control_last_time = readline[13];
            tEMPLATE_Model.Voltage           = readline[14];
            tEMPLATE_Model.Oil_tank_T        = readline[15];
            tEMPLATE_Model.Oil_j_T           = readline[16];
            tEMPLATE_Model.Oil_h_T           = readline[17];
            return(tEMPLATE_Model);
        }
Пример #4
0
        /**
         * 根据type和模板编号获取模板信息
         **/
        public static List <TEMPLATE_Model> QueryByTypeAndTEMPNo(string type, string no)
        {
            List <TEMPLATE_Model> tEMPLATE_Models = new List <TEMPLATE_Model>();
            /* type 转大写*/
            string H_type = type.ToUpper();

            string     filePath = "../Data/TPL/" + H_type + "/" + no + ".txt";
            FileStream fs       = new FileStream(filePath, FileMode.Open, FileAccess.ReadWrite);

            StreamReader rd = new StreamReader(fs, Encoding.Default);
            string       readLine;

            while ((readLine = rd.ReadLine()) != null)
            {
                string[]       data           = readLine.Split(',');
                int            length         = data.Length;
                TEMPLATE_Model tEMPLATE_Model = new TEMPLATE_Model();
                tEMPLATE_Model = StringToTEMPLATEModel(length, data);
                tEMPLATE_Models.Add(tEMPLATE_Model);
            }
            rd.Close();
            fs.Close();
            return(tEMPLATE_Models);
        }