private void RefreshFolder() { //if ((Application.CurrentInstance.CurrentFolder.Name == folder.Name || Application.CurrentInstance.CurrentItem.Name == folder.Name) && // lastChangedDirectory != lastRefreshedDirectory) { Async.Queue("File Watcher Refresher", () => { Logger.ReportInfo("Refreshing " + Application.CurrentInstance.CurrentFolder.Name + " due to change in " + folder.Name); Logger.ReportInfo(" Directory changed was: " + lastChangedDirectory); lastRefreshedDirectory = lastChangedDirectory; folder.ValidateChildren(); foreach (var item in folder.RecursiveChildren) { if (item is Folder) { (item as Folder).ValidateChildren(); } } //and go back through to find the item that actually changed and update its metadata - as long as it wasn't the root that changed if (!isTopLevel(folder.FolderMediaLocation as VirtualFolderMediaLocation, lastChangedDirectory)) { foreach (var item in folder.RecursiveChildren) { if (item.Path.ToLower().StartsWith(lastChangedDirectory)) { Logger.ReportInfo("Refreshing metadata on " + item.Name + "(" + item.Path + ") because change was in " + lastChangedDirectory); item.RefreshMetadata(Metadata.MetadataRefreshOptions.Force); item.ReCacheAllImages(); } } } else { Logger.ReportInfo("Not refreshing all items because change was at root level: " + lastChangedDirectory); } //Refresh whatever folder we are currently viewing plus all parents up the tree FolderModel aFolder = Application.CurrentInstance.CurrentFolder; while (aFolder != Application.CurrentInstance.RootFolderModel && aFolder != null) { aFolder.RefreshUI(); aFolder = aFolder.PhysicalParent; } Application.CurrentInstance.RootFolderModel.RefreshUI(); }); } }