private void ShowProperties(string fileName)
{
var properties = GetFileProperties(fileName);
lvProperties.BeginUpdate();
lvProperties.Items.Clear();
var groupByName = new Dictionary<string, ListViewGroup>();
foreach (var property in properties)
{
var listItem = new ListViewItem { Text = property.ShortName };
listItem.SubItems.Add(property.Value);
if (property.GroupName.Length > 0)
{
ListViewGroup listGroup;
if (!groupByName.TryGetValue(property.GroupName, out listGroup))
{
listGroup = new ListViewGroup(property.GroupName);
groupByName.Add(property.GroupName, listGroup);
lvProperties.Groups.Add(listGroup);
}
listItem.Group = listGroup;
}
lvProperties.Items.Add(listItem);
}
lvProperties.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
lvProperties.EndUpdate();
}