private async void ExportCommandCommandHandler() { var downloadData = await _statisticsRepository.GetAllForDownload(); var picker = new FileSavePicker { SuggestedStartLocation = PickerLocationId.DocumentsLibrary, }; picker.FileTypeChoices.Add("CSV", new List <string> { ".csv" }); picker.SuggestedFileName = "DartsScoreMasterStats"; var file = await picker.PickSaveFileAsync(); if (file != null) { CachedFileManager.DeferUpdates(file); await FileIO.WriteTextAsync(file, downloadData); var status = await CachedFileManager.CompleteUpdatesAsync(file); if (status != FileUpdateStatus.Complete) { throw new Exception($"File could not be saved, status was {status}."); } } }