locked
UWP PickSaveFileAsync() not showing, Windows Iot10 RRS feed

  • Question

  • Hi!

    I want to store a file on Windows IOT10, UWP. The dialog doesn't comes up ...

    Can anyone help ...

     private async void SaveFile()
            {
                var savePicker = new Windows.Storage.Pickers.FileSavePicker();
                savePicker.SuggestedStartLocation =
                    Windows.Storage.Pickers.PickerLocationId.DocumentsLibrary;
                // Dropdown of file types the user can save the file as
                savePicker.FileTypeChoices.Add("Plain Text", new List<string>() { ".txt" });
                // Default file name if the user does not type one in or select a file to replace
                savePicker.SuggestedFileName = "New Document";
    
    
    
                Windows.Storage.StorageFile file = await savePicker.PickSaveFileAsync();
    
                if (file != null)
                {
                    // Prevent updates to the remote version of the file until
                    // we finish making changes and call CompleteUpdatesAsync.
                    Windows.Storage.CachedFileManager.DeferUpdates(file);
                    // write to file
                    await Windows.Storage.FileIO.WriteTextAsync(file, file.Name);
                    // Let Windows know that we're finished changing the file so
                    // the other app can update the remote version of the file.
                    // Completing updates may require Windows to ask for user input.
                    Windows.Storage.Provider.FileUpdateStatus status =
                        await Windows.Storage.CachedFileManager.CompleteUpdatesAsync(file);
                    if (status == Windows.Storage.Provider.FileUpdateStatus.Complete)
                    {
                        TbInfo1.Text = "File " + file.Name + " was saved.";
                    }
                    else
                    {
                        TbInfo1.Text = "File " + file.Name + " couldn't be saved.";
                    }
                }
                else
                {
                    TbInfo1.Text = "Operation cancelled.";
                }
            }

    Wednesday, October 3, 2018 11:10 AM