Beispiel #1
0
        private async Task DoFileDownloadAsync(MobileServiceFile file)
        {
            var filepath = await FileHelper.GetLocalFilePathAsync(file.ParentId);

            var storagePath = FileSystem.Current.LocalStorage.Path;

            var fullpath = Path.Combine(storagePath, filepath);

            using (System.IO.Stream stream = File.Create(fullpath)) { }

            await saleItemsTable.DownloadFileAsync(file, fullpath);

            await SaleItemDataService.Instance.MobileService.EventManager
            .PublishAsync(new FileDownloadedEvent { Name = file.ParentId });
        }
        public async Task DownloadFileAsync <T>(IMobileServiceSyncTable <T> table, MobileServiceFile file)
        {
            var path = await FileHelper.GetLocalFilePathAsync(file.ParentId, file.Name);

            var folder = Path.GetDirectoryName(path);

            var storageFolder = await StorageFolder.GetFolderFromPathAsync(folder);

            if (await storageFolder.TryGetItemAsync(file.Name) == null)
            {
                await storageFolder.CreateFileAsync(file.Name);
            }

            await table.DownloadFileAsync(file, path);
        }
        public async Task DownloadFileAsync <T>(IMobileServiceSyncTable <T> table, MobileServiceFile file, string targetPath, int attempt = 0)
        {
            try
            {
                await table.DownloadFileAsync(file, targetPath);
            }
            catch (UnauthorizedAccessException)
            {
                DeleteLocalFile(file);

                if (attempt < 3)
                {
                    await Task.Delay(300)
                    .ContinueWith(async t => await DownloadFileAsync(table, file, targetPath, attempt++));
                }
            }
        }
        internal async Task DownloadFileAsync(MobileServiceFile file)
        {
            var path = await FileHelper.GetLocalFilePathAsync(file.ParentId, file.Name);

            await sightFileTable.DownloadFileAsync(file, path);
        }
 public async Task DownloadFileAsync <T> (IMobileServiceSyncTable <T> table, MobileServiceFile file, string targetPath)
 {
     await table.DownloadFileAsync(file, targetPath);
 }
Beispiel #6
0
        public async Task DownloadFileAsync <T>(IMobileServiceSyncTable <T> table, MobileServiceFile file, string filename)
        {
            var path = await FileHelper.GetLocalFilePathAsync(file.ParentId, file.Name);

            await table.DownloadFileAsync(file, path);
        }