| 71 | } |
| 72 | |
| 73 | void RemoteFile::DownloadAsync(std::string const & filePath, StartDownloadingHandler && startDownloadingHandler, |
| 74 | ResultHandler && resultHandler) const |
| 75 | { |
| 76 | RemoteFile remoteFile = *this; |
| 77 | GetPlatform().RunTask(Platform::Thread::Network, [filePath, remoteFile = std::move(remoteFile), |
| 78 | startDownloadingHandler = std::move(startDownloadingHandler), |
| 79 | resultHandler = std::move(resultHandler)] |
| 80 | { |
| 81 | if (startDownloadingHandler) |
| 82 | startDownloadingHandler(filePath); |
| 83 | auto result = remoteFile.Download(filePath); |
| 84 | if (resultHandler) |
| 85 | resultHandler(std::move(result), filePath); |
| 86 | }); |
| 87 | } |
| 88 | } // namespace platform |