private void ListView_SelectedChange(object sender, PathEventArgs e) { Repository selected = fileSystem.FindDirectory(e.Path); if (selected != null) { listView.ClearList(); bool previousExpandCondition = selected.IsExpand; selected.IsExpand = true; fileSystem.Expand(selected); foreach (var item in selected.Entries) { if (item is Repository repository) { if (!repository.HasAccessRight) { listView.AddInaccessibleFolder(repository.Name); } else { listView.AddFolder(repository.Name); } } else { listView.AddFile(item.Name, item.Path, Converter.BytesToString(((File)item).Size)); } } selected.IsExpand = previousExpandCondition; } }