// Refresh left list public void refreshList() { try { inListView.Items.Clear(); // Clear list foreach (String path in Directory.GetFiles(Reference.PlaylistsPath + playlistsList.Text)) { String ext = Path.GetExtension(path); if (ext != ".info" && ext != ".playinfo") { WatchFile file = new WatchFile(Path.GetFileNameWithoutExtension(path), Path.GetExtension(path)); ListViewItem item = new ListViewItem(file.ToString()); item.Tag = file; item.SubItems.Add(file.Description); item.SubItems.Add(file.Duration); inListView.Items.Add(item); } } } catch (Exception ex) { MetroMessageBox.Show(this, ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void inListView_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) { wFile = (WatchFile)e.Item.Tag; }