Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    May 2014

    FileSavePicker. How to code source path?

    I think Im getting closer. But have two errors:

    Error 2 The best overloaded method match for 'Windows.Storage.Streams.IInputStream.ReadAsync(Windows.Storage.Streams.IBuffer, uint, Windows.Storage.Streams.InputStreamOptions)' has some invalid arguments

    Error 3 Argument 1: cannot convert from 'System.Linq.IQueryable<byte>' to 'Windows.Storage.Streams.IBuffer'

    public class SaveData : ViewModelBase
            public string Title { get; set; }
            public string FilePath { get; set; }
            public RelayCommand<string> SaveSoundAs { get; set; }
            private void ExecuteSaveSoundAs(string soundPath)
                App.Current.RootVisual.Dispatcher.BeginInvoke(() =>
                        FileSavePicker savePicker = new FileSavePicker();
                        savePicker.SuggestedStartLocation = PickerLocationId.Downloads;
                        savePicker.FileTypeChoices.Add("MP3", new List<string>() { ".mp3" });
                        savePicker.ContinuationData.Add("SourceSound", soundPath);
                        savePicker.SuggestedFileName = this.Title;
            public async void ContinueFileSavePicker(FileSavePickerContinuationEventArgs args)
                string soundPath = (string)args.ContinuationData["SourceSound"];
                StorageFile file = args.File;
                if (file != null)
                    // Prevent updates to the remote version of the file until we finish making changes and call CompleteUpdatesAsync.
                    // write to file
                    var sourceFile= await Windows.ApplicationModel.Package.Current.InstalledLocation
                       .GetFileAsync(@"appdata:/" + this.FilePath);
    var sourceStream = await sourceFile.OpenAsync(FileAccessMode.Read);
    var bytes = new byte[sourceStream.Size];
    var sourceBuffer = await sourceStream.ReadAsync(bytes.AsQueryable(), (uint)sourceStream.Size, Windows.Storage.Streams.InputStreamOptions.None);
                    await FileIO.WriteTextAsync(file, sourceBuffer);
                    // 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.
                    FileUpdateStatus status = await CachedFileManager.CompleteUpdatesAsync(file);
                    if (status == FileUpdateStatus.Complete) ;
            public SaveData()
                SaveSoundAs = new RelayCommand<string>(ExecuteSaveSoundAs);
    Last edited by ChuckJ; 2014-06-09 at 13:08.

  2. #2
    Regular Contributor
    Join Date
    Aug 2012
    Rhine Valley

    Re: FileSavePicker. How to code source path?

    Do you call ContinueFileSavePicker in your page's OnNavigatedTo override and save the FileSavePickerContinuationEventArgs in your app's ContractActivated handler?

    Getting the pickers to work is a bit complicated but there is some sample code. I used a folder picker and it took some time until it worked...
    - <a href="http://www.dvlup.com/influencer/invite">Visit DVLUP and earn rewards</a>

  3. #3
    Regular Contributor
    Join Date
    Oct 2013
    Pennsauken, NJ, USA

    Re: FileSavePicker. How to code source path?

    You need to add the interface IFileSavePickerContinuable to your SoundData class, add the class ContinuationManager to your solution (from the File Picker sample), and load it in your App.xaml.cs file.

Similar Threads

  1. S^3 SDK and PDK source code
    By lenclud in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2011-07-18, 09:31
  2. How can I set the default source code research path.
    By useryy in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 5
    Last Post: 2010-04-13, 04:40
  3. want source code
    By lopesrohan1988 in forum Symbian User Interface
    Replies: 1
    Last Post: 2009-02-22, 19:27
  4. Source Code for API PDF Doc
    By goopot in forum Symbian
    Replies: 3
    Last Post: 2007-10-08, 13:47

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts