Example #1
0
        public Task <ILocalItem> TryGetItemAsync(string name)
        {
            return(_storageFolder.TryGetItemAsync(name)
                   .AsTask()
                   .ContinueWith(
                       storageItem => {
                var item = storageItem.Result;

                ILocalItem localItem = null;

                if (item == null)
                {
                    return localItem;
                }

                if (item.IsOfType(StorageItemTypes.File))
                {
                    localItem = new LocalFile((StorageFile)item);
                }

                if (item.IsOfType(StorageItemTypes.Folder))
                {
                    localItem = new LocalDirectory((StorageFolder)item);
                }

                return localItem;
            }));
        }
Example #2
0
 public Task <ILocalDirectory> CreateFolderAsync(string name)
 {
     return(_storageFolder.CreateFolderAsync(name)
            .AsTask()
            .ContinueWith(
                storageFolder => {
         var localDirectory = new LocalDirectory(storageFolder.Result);
         return (ILocalDirectory)localDirectory;
     }));
 }