Exemple #1
0
 /// <summary>
 /// Downloads a <paramref name="file"/> and saves it to the local device using the provided <paramref name="targetPath"/>.
 /// </summary>
 /// <typeparam name="T">The type of the instances in the table.</typeparam>
 /// <param name="table">The table instance that contains the record associated with the <see cref="MobileServiceFile"/>.</param>
 /// <param name="file">The <see cref="MobileServiceFile"/> instance representing the file to be downloaded.</param>
 /// <param name="targetPath">The path that will be used to save the downloaded file.</param>
 /// <returns>A <see cref="Task"/> that completes when the download has finished.</returns>
 public async static Task DownloadFileAsync <T>(this IMobileServiceTable <T> table, MobileServiceFile file, string targetPath)
 {
     using (IO.Stream stream = await File.CreateAsync(targetPath))
     {
         await table.DownloadFileToStreamAsync(file, stream);
     }
 }