private void fileOpenFolderToolStripMenuItem_Click(object sender, EventArgs e) { DataGridViewCell cell = filesDataGridView.SelectedCells[0]; Models.File file = (Models.File)cell.OwningRow.DataBoundItem; string filePath; if (cell.ColumnIndex == 1) { filePath = file.FullPath; } else { filePath = file.OutputPath; } FileInfo fileInfo = new FileInfo(filePath); string directoryPath = fileInfo.DirectoryName; if (System.IO.Directory.Exists(directoryPath)) { Process process = new Process(); process.StartInfo.FileName = directoryPath; process.Start(); } }
private void fileSelectOutputToolStripMenuItem_Click(object sender, EventArgs e) { DataGridViewCell cell = filesDataGridView.SelectedCells[0]; Models.File file = (Models.File)cell.OwningRow.DataBoundItem; FileInfo fileInfo = new FileInfo(file.OutputPath); outputFileDialog.InitialDirectory = fileInfo.DirectoryName; outputFileDialog.FileName = fileInfo.Name; if (outputFileDialog.ShowDialog() == true) { file.OutputPath = outputFileDialog.FileName; filesDataGridView_DataChanged(); Program.Settings.SaveSettings(); } }
private void filesDataGridView_OpenSelectedFile() { DataGridViewCell cell = filesDataGridView.SelectedCells[0]; Models.File file = (Models.File)cell.OwningRow.DataBoundItem; string filePath; if (cell.ColumnIndex == 1) { filePath = file.FullPath; } else { filePath = file.OutputPath; } if (System.IO.File.Exists(filePath)) { Process process = new Process(); process.StartInfo.FileName = filePath; process.Start(); } }