private void listBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { ListBox lb = sender as ListBox; if (ReferenceEquals(lb, null)) { return; } if (lb.SelectedItems.Count != 1) { return; } FileBasedLogEntry item = lb.SelectedItems[0] as FileBasedLogEntry; if (ReferenceEquals(item, null)) { return; } string extension = Path.GetExtension(item.Filepath); if (extension == null) { return; } switch (extension.ToLower()) { case ".xml": case ".mkv": //todo: make it async MatroskaTags tags = MatroskaLoader.ReadTag(item.Filepath); textEditor.Text = MatroskaLoader.GetXML(tags); break; } }
private void listBox_MouseDoubleClick(object sender, MouseButtonEventArgs e) { ListBox lb = sender as ListBox; if (ReferenceEquals(lb, null)) { return; } if (lb.SelectedItems.Count != 1) { return; } FileBasedLogEntry item = lb.SelectedItems[0] as FileBasedLogEntry; if (ReferenceEquals(item, null)) { return; } item.OpenExplorerFileSelected(); }