public StorageEntry(StorageFile file, StorageEntryUsage usage) { this.EntryType = StorageEntryType.File; this.ContentType = SEContentAgency.AnyalizeStorageEntryContent(file); this._storageItem = file; this.LoadThumbnail(usage); }
// Constructor public StorageEntry(StorageFolder folder, StorageEntryUsage usage) { this.EntryType = StorageEntryType.Folder; this.ContentType = SEContent.Folder; this._storageItem = folder; this.LoadThumbnail(usage); }
public StorageEntry(IStorageItem item, StorageEntryUsage usage) { if (item is StorageFile file) { this.EntryType = StorageEntryType.File; this.ContentType = SEContentAgency.AnyalizeStorageEntryContent(file); this._storageItem = item; this.LoadThumbnail(usage); } else { this.EntryType = StorageEntryType.Folder; this.ContentType = SEContent.Folder; this._storageItem = item; this.LoadThumbnail(usage); } }
public override async Task<IStorageItem> CreateStorageEntry(StorageEntry destFolder, StorageEntryType type) { var createdItem = await base.CreateStorageEntry(destFolder, type); if(createdItem != null) { var newEntry = new StorageEntry(createdItem, StorageEntryUsage.TilesFieldItem); entries.Add(newEntry); TilesView.SelectedItem = newEntry; } return createdItem; }
public virtual async Task <IStorageItem> CreateStorageEntry(StorageEntry destFolder, StorageEntryType type) { (string result, string newName) = await Excutor.ShowSingleLineInputDialog(null, "Message", "Please Input the new name", "Confirm", "Cancel"); if (result == "Confirm" && !string.IsNullOrEmpty(newName)) { var isExisted = await StorageEntry.CheckStorageEntryExistAsync(newName, destFolder.Folder); // 检测该文件名是否冲突 if (isExisted) { string collisionAction = await Excutor.ShowMultiplyChooseDialogAsync( "Warning", $"{newName} has already existed in {destFolder.RawEntry.Name} folder.", "Generate new name", "Replace it", "Cancel"); switch (collisionAction) { case "Generate new name": return(await Excutor.CreatedNewEntry(destFolder, newName, type, CreationCollisionOption.GenerateUniqueName)); case "Replace it": return(await Excutor.CreatedNewEntry(destFolder, newName, type, CreationCollisionOption.ReplaceExisting)); case "Cancel": default: return(null); } } else { return(await Excutor.CreatedNewEntry(destFolder, newName, type, CreationCollisionOption.FailIfExists)); } } else { return(null); } }
/// <summary> 常见一个新的文件或文件夹 </summary> /// <param name="destFolder">目标文件夹</param> /// <param name="name">文件项名</param> /// <param name="type">文件项的类型(文件或文件夹)</param> /// <returns>创建成功返回true,否则返回false</returns> public async Task <IStorageItem> CreatedNewEntry(StorageEntry destFolder, string name, StorageEntryType type, CreationCollisionOption option) { switch (type) { case StorageEntryType.File: return(await destFolder.Folder.CreateFileAsync(name, option)); case StorageEntryType.Folder: return(await destFolder.Folder.CreateFolderAsync(name, option)); default: return(null); } }