public LibraryLocationItem(ShellLibraryItem shellLibrary) { Section = SectionType.Library; Text = shellLibrary.DisplayName; Path = shellLibrary.FullPath; DefaultSaveFolder = shellLibrary.DefaultSaveFolder; Folders = shellLibrary.Folders == null ? null : new ReadOnlyCollection <string>(shellLibrary.Folders); IsDefaultLocation = shellLibrary.IsPinned; }
public LibraryLocationItem(ShellLibraryItem shellLibrary) { Section = SectionType.Library; Text = shellLibrary.DisplayName; Path = shellLibrary.FullPath; Icon = new Windows.UI.Xaml.Media.Imaging.SvgImageSource(GlyphHelper.GetIconUri(shellLibrary.DefaultSaveFolder)); IconSource = GlyphHelper.GetIconUri(shellLibrary.DefaultSaveFolder); DefaultSaveFolder = shellLibrary.DefaultSaveFolder; Folders = shellLibrary.Folders == null ? null : new ReadOnlyCollection <string>(shellLibrary.Folders); IsDefaultLocation = shellLibrary.IsPinned; }
public LibraryLocationItem(ShellLibraryItem shellLibrary) { Section = SectionType.Library; MenuOptions = new ContextMenuOptions { IsLocationItem = true, ShowProperties = true, ShowShellItems = true, ShowUnpinItem = !shellLibrary.IsPinned, }; Text = shellLibrary.DisplayName; Path = shellLibrary.FullPath; DefaultSaveFolder = shellLibrary.DefaultSaveFolder; Folders = shellLibrary.Folders is null ? null : new ReadOnlyCollection <string>(shellLibrary.Folders); IsDefaultLocation = shellLibrary.IsPinned; }
public static ShellLibraryItem GetShellLibraryItem(ShellLibrary2 library, string filePath) { var libraryItem = new ShellLibraryItem { FullPath = filePath, AbsolutePath = library.GetDisplayName(ShellItemDisplayString.DesktopAbsoluteParsing), RelativePath = library.GetDisplayName(ShellItemDisplayString.ParentRelativeParsing), DisplayName = library.GetDisplayName(ShellItemDisplayString.NormalDisplay), IsPinned = library.PinnedToNavigationPane, }; var folders = library.Folders; if (folders.Count > 0) { libraryItem.DefaultSaveFolder = SafetyExtensions.IgnoreExceptions(() => library.DefaultSaveFolder.FileSystemPath); libraryItem.Folders = folders.Select(f => f.FileSystemPath).ToArray(); } return(libraryItem); }
public async Task HandleWin32LibraryEvent(ShellLibraryItem library, string oldPath) { string path = oldPath; if (string.IsNullOrEmpty(oldPath)) { path = library?.FullPath; } await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { var changedLibrary = Libraries.FirstOrDefault(l => string.Equals(l.Path, path, StringComparison.OrdinalIgnoreCase)); if (changedLibrary != null) { Libraries.Remove(changedLibrary); } // library is null in case it was deleted if (library != null) { Libraries.AddSorted(new LibraryLocationItem(library)); } }); }