public override void LoadContainers(bool refresh) { if (refresh || ContainerChildren.Count == 0 || ContainerChildren.FirstOrDefault() == ContainerVM.PLACE_HOLDER) { // due to nature of shell enumeration // we can load both file and folders together. ContainerChildren.Clear(); SingleChildren.Clear(); foreach (ShellObject sub in Folder) { var folder = sub as ShellFolder; if (folder != null) { ContainerChildren.Add(new ShellFolderVM(Provider, this, folder)); } else { var file = sub as ShellFile; if (file != null) { SingleChildren.Add(new ShellFileVM(Provider, this, file)); } else { sub.Dispose(); } } } } }
/// <summary> /// Loads the <see cref="ContainerChildren"/> collection. /// </summary> /// <param name="refresh">if set to <c>true</c> then always load, otherwise it'll only load when necessary.</param> public virtual void LoadContainers(bool refresh) { if (refresh || ContainerChildren.Count == 0 || ContainerChildren.FirstOrDefault() == PLACE_HOLDER) { ContainerChildren.Clear(); foreach (var c in Provider.GetContainerChildren(this)) { ContainerChildren.Add(c); } } }