Beispiel #1
0
        private void imptmpdata(string filepath)
        {
            List <string> aList = File.ReadAllLines(filepath, Encoding.UTF8).ToList();

            session.first_array = aList.First().Split('\t');
            int len = aList.First().Split('\t').Length;

            foreach (var item1 in aList)
            {
                string[]    a  = item1.Split('\t');
                tmpdata     td = new tmpdata();
                System.Type t  = td.GetType();
                try
                {
                    for (int i = 0; i < len; i++)
                    {
                        string       tmpfiled = string.Format("tmpfiled{0}", i + 1);
                        PropertyInfo filed    = t.GetProperty(tmpfiled);
                        filed.SetValue(td, a[i], null);
                    }
                    blist.Add(td);
                }
                catch (Exception)
                {
                    blist.Add(td);
                }
            }
        }
Beispiel #2
0
        private void btntest_Click(object sender, EventArgs e)
        {
            tmpdata td = session.blist.First();

            System.Type  t        = td.GetType();
            PropertyInfo pi       = t.GetProperty(comboBox4.Text);
            string       filepath = pi.GetValue(td, null).ToString();

            filepath = filepath.Replace(textBox4.Text, textBox9.Text);
            try
            {
                System.Diagnostics.Process.Start(filepath);
            }
            catch (Exception)
            {
                MessageBox.Show("系统找不到指定文件!");
            }
        }
Beispiel #3
0
        private void txt_edit_Load(object sender, EventArgs e)
        {
            List <string> heardlist = new List <string>();
            tmpdata       td        = session.blist.First();

            System.Type    t  = td.GetType();
            PropertyInfo[] ps = t.GetProperties();
            foreach (PropertyInfo i in ps)
            {
                object value = i.GetValue(td, null);
                if (value != null)
                {
                    string name = i.Name;
                    heardlist.Add(name);
                }
            }

            for (int i = 0; i < heardlist.Count; i++)
            {
                DataGridViewButtonColumn Column = new DataGridViewButtonColumn();
                string name = string.Format("tmpfiled{0}", i + 1);
                Column.Text             = name;
                Column.Name             = name;
                Column.HeaderText       = name;
                Column.DataPropertyName = name;
                dataGridView1.Columns.Add(Column);
            }
            dataGridView1.Font = new Font("宋体", 11, FontStyle.Regular);
            dataGridView1.AutoGenerateColumns = false;
            dataGridView1.DataSource          = session.blist.Take(5).ToList();
            comboBox1.DataSource = heardlist.Take(heardlist.Count()).ToList();
            comboBox1.Text       = heardlist[0].ToString();
            comboBox2.DataSource = heardlist.Take(heardlist.Count()).ToList();
            comboBox2.Text       = heardlist[1].ToString();
            comboBox3.DataSource = heardlist.Take(heardlist.Count()).ToList();
            comboBox3.Text       = heardlist[2].ToString();
            comboBox4.DataSource = heardlist.Take(heardlist.Count()).ToList();
            comboBox4.Text       = heardlist[3].ToString();
            comboBox5.DataSource = heardlist.Take(heardlist.Count()).ToList();
            comboBox5.Text       = heardlist[4].ToString();
            //comboBox6.DataSource = heardlist.Take(heardlist.Count()).ToList();
            //comboBox6.Text = heardlist[5].ToString();
        }