private void olvFiles_ItemActivate(object sender, EventArgs e) { Object rowObject = this.olvFiles.SelectedObject; if (rowObject == null) { return; } if (rowObject is DirectoryInfo) { this.textBoxFolderPath.Text = ((DirectoryInfo)rowObject).FullName; this.buttonGo.PerformClick(); } else { ShellUtilities.Execute(((FileInfo)rowObject).FullName); } }
/// <summary> /// Execute the default verb on the file or directory identified by the given path. /// For documents, this will open them with their normal application. For executables, /// this will cause them to run. /// </summary> /// <param name="path">The file or directory to be executed</param> /// <returns>Values < 31 indicate some sort of error. See ShellExecute() documentation for specifics.</returns> /// <remarks>The same effect can be achieved by <code>System.Diagnostics.Process.Start(path)</code>.</remarks> public static int Execute(string path) { return(ShellUtilities.Execute(path, "")); }