Exemple #1
0
        private async void OnSave(object sender, RoutedEventArgs e)
        {
            var picker = new FileSavePicker();

            picker.DefaultFileExtension   = ".xml";
            picker.SuggestedFileName      = string.Format("MenuCard {0}.xml", card.Title);
            picker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
            picker.FileTypeChoices.Add("XML File", new List <string>()
            {
                ".xml"
            });

            StorageFile file = await picker.PickSaveFileAsync();

            MenuCardStorage storage = new MenuCardStorage();
            await storage.WriteMenuCardToFileAsync(card, file);
        }
        private async void OnSave()
        {
            Contract.Requires <InvalidOperationException>(card != null);

            var picker = new FileSavePicker();

            picker.DefaultFileExtension   = ".xml";
            picker.SuggestedFileName      = string.Format("MenuCard {0}.xml", card.Title);
            picker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
            picker.FileTypeChoices.Add("XML File", new List <string>()
            {
                ".xml"
            });

            StorageFile file = await picker.PickSaveFileAsync();

            var storage = new MenuCardStorage();
            await storage.WriteMenuCardToFileAsync(card, file);
        }