예제 #1
0
        public async Task Load()
        {
            var file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///TestFiles/comic.xspf"));

            using (Stream stream = await file.OpenStreamForReadAsync())
                xspf = Xspf.Load(stream);
        }
예제 #2
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            if (xspf == null)
            {
                try
                {
                    file = e.Parameter as StorageFile;
                    using (Stream stream = await file.OpenStreamForReadAsync())
                        xspf = Xspf.Load(stream);
                    displayList.DataContext = xspf.TrackList;

                    var mru = StorageApplicationPermissions.MostRecentlyUsedList;
                    mru.Add(file);
                }
                catch
                {
                    MessageDialog msgDialog = new MessageDialog("打开文件失败");
                }
            }
        }