Beispiel #1
0
 public StorageEntry(StorageFile file, StorageEntryUsage usage)
 {
     this.EntryType    = StorageEntryType.File;
     this.ContentType  = SEContentAgency.AnyalizeStorageEntryContent(file);
     this._storageItem = file;
     this.LoadThumbnail(usage);
 }
Beispiel #2
0
 // Constructor
 public StorageEntry(StorageFolder folder, StorageEntryUsage usage)
 {
     this.EntryType    = StorageEntryType.Folder;
     this.ContentType  = SEContent.Folder;
     this._storageItem = folder;
     this.LoadThumbnail(usage);
 }
Beispiel #3
0
 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);
     }
 }
Beispiel #4
0
        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;
        }
Beispiel #5
0
        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);
            }
        }
Beispiel #6
0
        /// <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);
            }
        }