示例#1
0
        private void tsmOpen_Click(object sender, EventArgs e)
        {
            int index = FileUtilty.GetDataGridViewIndex(dataGridView1, "路径");
            int count = dataGridView1.SelectedCells.Count;

            if (count < 1)
            {
                return;
            }
            int    selectedRowIndex = dataGridView1.SelectedCells[0].RowIndex;
            string FileName         = dataGridView1.Rows[selectedRowIndex].Cells[index].Value.ToString();

            FileName = FileName.Trim();
            System.Diagnostics.Process.Start(FileName);
        }
示例#2
0
 private void tsmOpenDirect_Click(object sender, EventArgs e)
 {
     try
     {
         int index = FileUtilty.GetDataGridViewIndex(dataGridView1, "路径");
         int count = dataGridView1.SelectedCells.Count;
         if (count < 1)
         {
             return;
         }
         int    selectedRowIndex = dataGridView1.SelectedCells[0].RowIndex;
         string FileName         = dataGridView1.Rows[selectedRowIndex].Cells[index].Value.ToString();
         string direct           = FileUtilty.FullNameToDirectionary(FileName);
         direct = direct.Trim();
         System.Diagnostics.Process.Start(direct);
     }
     catch (Exception err)
     {
         MessageBox.Show(err.ToString());
     }
 }
示例#3
0
        public void UpdataGridView(ArrayList FileInfoCollector)
        {
            SetCol();
            dataGridView1.Rows.Clear();
            dataGridView1.Rows.Insert(0, 100);

            int serialIndex   = FileUtilty.GetDataGridViewIndex(dataGridView1, "序号");
            int fileNameIndex = FileUtilty.GetDataGridViewIndex(dataGridView1, "文件名");
            int pathIndex     = FileUtilty.GetDataGridViewIndex(dataGridView1, "路径");

            const string dbPath = ExistFiles.dbPath;

            if (!System.IO.File.Exists(dbPath))
            {
                return;
            }


            SQLiteDBHelper db  = new SQLiteDBHelper(dbPath);
            string         sql = "select * from " + ExistFiles.existFilessName;

            using (SQLiteDataReader reader = db.ExecuteReader(sql, null))
            {
                int index = 0;
                while (reader.Read())
                {
                    if (index > dataGridView1.Rows.Count - 2)
                    {
                        dataGridView1.Rows.Add();
                    }

                    dataGridView1.Rows[index].Cells[serialIndex].Value   = index.ToString();
                    dataGridView1.Rows[index].Cells[fileNameIndex].Value = reader["name"].ToString();
                    dataGridView1.Rows[index].Cells[pathIndex].Value     = reader["filePath"].ToString();
                    ++index;
                }
            }
        }
示例#4
0
 protected int GetColIndex(string name)
 {
     return(FileUtilty.GetDataGridViewIndex(dataGridView, name));
 }