Пример #1
0
 public static void EditFile(string file)
 {
     ShellExecute shellExecute = new ShellExecute();
     shellExecute.Verb = ShellExecute.EditFile;
     shellExecute.Path = file;
     shellExecute.Execute();
 }
        public static void Open(string path)
        {
            var execute = new ShellExecute
            {
                Verb = ShellExecute.OpenFile,
                Path = path
            };

            execute.Execute();
        }
Пример #3
0
        /// <summary>
        ///   A double click occured´in the list view
        ///   If an item was selected, open it with the default program
        /// </summary>
        /// <param name = "sender"></param>
        /// <param name = "e"></param>
        private void listViewNonMusicFiles_DoubleClick(object sender, EventArgs e)
        {
            ListViewHitTestInfo hitInfo = listViewNonMusicFiles.HitTest(listViewNonMusicFiles.PointToClient(MousePosition));

            if (listViewNonMusicFiles.SelectedItems.Count > 0)
            {
                ListViewItem item = listViewNonMusicFiles.SelectedItems[0];
                if (item == hitInfo.Item)
                {
                    ShellExecute shell = new ShellExecute();
                    shell.Path = (string)item.Tag;
                    shell.Execute();
                }
            }
        }
Пример #4
0
 public static void ExploreFolder(string directory, IntPtr handle)
 {
     ShellExecute shellExecute = new ShellExecute();
     shellExecute.Verb = ShellExecute.ExploreFolder;
     shellExecute.Path = directory;
     shellExecute.OwnerHandle = handle;
     shellExecute.Execute();
 }
Пример #5
0
 public static void ShowFile(string file)
 {
     ShellExecute shellExecute = new ShellExecute();
     shellExecute.Path = file;
     shellExecute.Execute();
 }