How to correctly forward an event so that it opens when you double-click on a term in the listview folder with the file?

How to open the folder with the file I know, the question is how to organize an event. My ways are obtained in the brute force collection. I do not know how to pull them for the event. Here is what it is:

 // сам класс где создаются данные для отображения. public class Controller { public List<info> PrintKeys(string rkey) { List<info> stroka=new List<info>(); bool F = true; bool G = true; String rp = rkey; RegistryKey rk; using (rk = Registry.LocalMachine.OpenSubKey(rp)) { var e = rk.GetValueNames().Select(n => new { Name = n, Value = rk.GetValue(n), Exec = rk.GetValue(n).ToString() .Split('"').Where(i => !String.IsNullOrEmpty(i)).First() }); foreach (var x in e) { var icon1 = Icon.ExtractAssociatedIcon(x.Exec).ToBitmap(); stroka.Add(new info() { A = icon1, F1 = F,G1 = G,Namefile1 = x.Name, Path1 = x.Value}); } } return stroka; } } //вот класс самой формы public partial class Form1 : Form { Controller c=new Controller(); public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { listView1.Items.Clear(); string r1 = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; // реестр local mashin string r2 = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; //реестр СCurren user string rp3 = @".DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; //реестр user List<info> a = c.PrintKeys(r1); for (int i = 0; i < a.Count; i++) { listView1.Items.Add(a[i].Namefile1); listView1.Items[i].SubItems.Add((string) a[i].Path1); listView1.Items[i].SubItems.Add(a[i].F1.ToString()); listView1.Items[i].SubItems.Add(a[i].G1.ToString()); } } } //И сам класс для данных public class info { public Bitmap A { get; set; } // иконка файла public string Namefile1 { get; set; } //Имя исполняемого файла. //public string C1 { get; private set; } //Параметры командной строки для запуска файла. public object Path1 { get; set; }// путь public bool F1 { get; set; }//Флаг наличия цифровой подписи. public bool G1 { get; set; }//Флаг корректности цифровой подписи public info() { } } 
  • one
    You need a ListView.ItemActivate event and the ListView.SelectedItems property. Your items contain a path, so read it from the properties of the item in the event handler. The activated item will definitely be in the SelectedItems collection - rdorn
  • @rdorn Thanks helped - Vladimr Vladimirovoch

0