private void OpenPath(string path) { if (!File.Exists(path)) { MessageBox.Show(path + " is not a valid file path"); return; } Title = DefaultTitle + " - " + path; ListViewProcess.Items.Clear(); try { using var session = RestartManager.CreateSession(); session.RegisterFile(path); var processes = session.GetProcessesLockingResources(); if (processes.Count == 0) { MessageBox.Show("The file is not locked"); } else { foreach (var process in processes) { ListViewProcess.Items.Add(process); } } } catch (Exception ex) { MessageBox.Show("An error occured: " + ex); } }