Beispiel #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);
        }
Beispiel #2
0
        /// <summary>
        /// 打开目录响应函数
        /// </summary>
        public void OpenDirectionary(string Path)
        {
            ArrayList FileList = FileUtilty.GetAllFilesFullName(Path);

            for (int i = 0; i < FileList.Count; i++)
            {
                ExistFiles.FileInformation fi = new ExistFiles.FileInformation();
                fi.FileName = FileUtilty.FullNameToName(FileList[i].ToString());
                fi.FullName = FileList[i].ToString();
                fi.Lable    = "Lable:";
                ExistFiles.g_FileInfoCollector.Add(fi);
            }

            ExistFiles.SentToDB();

            SetCol();
            SetDataGridView1Width();
        }
Beispiel #3
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());
     }
 }
Beispiel #4
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;
                }
            }
        }
Beispiel #5
0
 protected int GetColIndex(string name)
 {
     return(FileUtilty.GetDataGridViewIndex(dataGridView, name));
 }