/// <summary> /// Initializes a new instance of the <see cref="StorageFolder"/> class. /// </summary> /// <param name="parentFolder"> /// The parent folder. /// </param> /// <param name="folder"> /// The associated <see cref="StorageFolder"/> /// </param> internal StorageFolder(IStorageFolder parentFolder, Windows.Storage.IStorageFolder folder) { if (folder == null) { throw new ArgumentNullException(nameof(folder)); } this.folder = folder; this.Parent = parentFolder; }
/// <inheritdoc/> public async Task <bool> PickFolder() { var folderPicker = new Windows.Storage.Pickers.FolderPicker(); folderPicker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.Desktop; folderPicker.SettingsIdentifier = "D6EDA6465535"; folderPicker.FileTypeFilter.Add("*"); _pickedFolder = await folderPicker.PickSingleFolderAsync(); return(_pickedFolder != null); }
/// <inheritdoc/> public async Task <Stream> TryOpenResourceStream(string domain, string languageCode) { string resourceFileName = BuildResourceFilePath(string.Empty, domain, languageCode); try { Windows.Storage.IStorageFolder appFolder = Windows.ApplicationModel.Package.Current.InstalledLocation; return(await appFolder.OpenStreamForReadAsync(resourceFileName)); } catch (Exception) { return(null); } }
/// <summary> /// Sets the library location. /// </summary> /// <param name="cache">The new library location.</param> public static void SetLibraryLocation(Windows.Storage.IStorageFolder cache) { Contract.Assume(Windows.Storage.AccessCache.StorageApplicationPermissions.FutureAccessList != null); if (cache == null) { if (GetLibraryLocationStatus()) { Windows.Storage.AccessCache.StorageApplicationPermissions.FutureAccessList.Remove("LibraryFolderToken"); } } else { Windows.Storage.AccessCache.StorageApplicationPermissions.FutureAccessList.AddOrReplace("LibraryFolderToken", cache); } }