1. DaveGx's Avatar
    As Im still very much a beginner, Im having some trouble trying to get the FileSavePicker to work. Essentially, I don't see how you code the source of your file. Ive downloaded a sample, but the sample doesnt contain a real example...its not coded to save an actual file. So its not helping me much. Ive obtain a little help from MSDN, but still stuck. The Save To option comes up in my app, but when I save the file, its basically blank. Shows as 0 bytes.

    So obviously I am not coding the source of the file to be saved correctly. The bold parts below is where I thought id put the code for the file source but its not right at all

    [CODE]namespace xxxxxx.ViewModels
    {
    public class SoundData : 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("appdata:/x.mp3", soundPath);
    savePicker.PickSaveFileAndContinue();

    }
    );
    }

    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.
    CachedFileManager.DeferUpdates(file);
    // write to file
    await 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.
    FileUpdateStatus status = await CachedFileManager.CompleteUpdatesAsync(file);
    if (status == FileUpdateStatus.Complete) ;


    }
    }



    public SoundData()
    {
    SaveSoundAs = new RelayCommand<string>(ExecuteSaveSoundAs);
    }



    }
    }[/CODE]
    06-04-2014 06:59 PM
  2. Arkadiusz Szechlicki's Avatar
    First place to look always should be documentation:
    FileSavePicker class (Windows)

    There is description of this class and example of usage
    06-13-2014 02:09 AM

Similar Threads

  1. Replies: 2
    Last Post: 06-24-2014, 06:56 AM
  2. Does anyone else's Type Cover pre-order show "BackOrdered"?
    By TheJoester09 in forum Microsoft Surface Pro 3
    Replies: 14
    Last Post: 06-18-2014, 01:45 PM
  3. Anyone have this wallpaper?
    By Berry_Pink in forum Wallpapers & Ringtones
    Replies: 2
    Last Post: 06-08-2014, 01:35 PM
  4. Developers now have access to more GPU bandwidth on Xbox One
    By WindowsCentral.com in forum Windows Central News Discussion
    Replies: 0
    Last Post: 06-04-2014, 03:11 PM
  5. Use T-Mobile 925 on AT&T
    By delco24 in forum Nokia Lumia 925
    Replies: 1
    Last Post: 06-04-2014, 11:50 AM
LINK TO POST COPIED TO CLIPBOARD