Esempio n. 1
0
        //单击内置模板会载入内置模板
        private void cmbTpl_SelectedIndexChanged(object sender, EventArgs e)
        {
            string tpl_name = this.cmbTpl.Text;//.SelectedIndex. >= 2)

            //如果是自定义模板,则啥也不管
            if (this.cmbTpl.SelectedIndex == 0)
            {
                return;
            }

            //实例化内置模板类
            InnerTpl form_inner_tpl = new InnerTpl();

            //MessageBox.Show(tpl_name);
            //获取模板内容
            Info[,] tpl = form_inner_tpl.getTplByName(tpl_name);


            //先初始化模板-重置所有方格
            DgvCtrl.clearAllCells(this.dataGridView0, this.dataGridView1);


            //中间信息写到界面上
            DataReadWrite.readIntoUI(tpl, this.dataGridView0, this.dataGridView1);
        }
Esempio n. 2
0
        //解析文件
        private void btnOpen_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            //openFileDialog1.InitialDirectory = "E:\\";
            openFileDialog1.Filter           = "mub File(*.mub)|*.mub|All files|*.*";
            openFileDialog1.RestoreDirectory = true;
            openFileDialog1.FilterIndex      = 2;
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                string fName = openFileDialog1.FileName;
                //调用类文件读取文件,并获取模板信息、OD信息
                DataReadWrite dfw = new DataReadWrite();
                plate_info   = dfw.readFromFile(fName); //获取基本信息
                Info[,] tpl  = dfw.getTpl();            //模板信息
                double[,] od = dfw.getOd();             //OD信息



                //输出板子基本信息:标题、日期、单位、模型编号
                //this.richTextBox1.Text = "";

                /*foreach (string item in plate_info.Keys)
                 * {
                 *  string info = this.plate_info[item];
                 *  this.richTextBox1.Text += item + " [:] " + info + "\n";
                 * }*/
                this.textName.Text        = plate_info["Name"];
                this.dateTimePicker1.Text = plate_info["LabDate"];
                this.textLot.Text         = plate_info["Lot"];
                this.txtUnit.Text         = plate_info["Unit"];
                //todo 打开文件时曲线类型没处理
                this.richTextBox1.Text = plate_info["Note"];


                //先初始化模板-重置所有方格 + //清空od数据
                DgvCtrl.clearAllCells(this.dataGridView0, this.dataGridView1, true);



                //从中间数据读取到表格中
                DataReadWrite.readIntoUI(tpl, this.dataGridView0, this.dataGridView1); //模板文件
                DataReadWrite.readIntoUI(od, this.dataGridView1);                      //od文件

                //this.richTextBox1.Text += DataReadWrite.textDebug;
            }
        }