Exemplo n.º 1
0
        protected override async void LoadState(object param, Dictionary <string, object> pageState)
        {
            base.LoadState(param, pageState);
            int           id   = (int)param;
            VideoDataItem item = VideoDataSource.GetItem(id);

            if (item != null)
            {
                OpenFile(item.File);
            }
            else if (pageState["fileToken"] != null)
            {
                StorageItemAccessList future = StorageApplicationPermissions.FutureAccessList;
                StorageFile           file   = await future.GetFileAsync(pageState["fileToken"] as string);

                future.Clear();
                OpenFile(file);
            }
            if (pageState != null)
            {
                MediaPlayerState state = pageState["MediaState"] as MediaPlayerState;
                if (state != null)
                {
                    MediaPlayer.RestorePlayerState(state);
                }
            }
        }
Exemplo n.º 2
0
 protected override void OnNavigatedTo(NavigationEventArgs e)   //当本页面成为框架中的活动页时调用
 {
     //确保我们不会耗尽StoreItemAccessList条目
     //当我们不需要坚持这个跨应用程序会话页
     //每次结算应该足够。
     storageItemAccessList = StorageApplicationPermissions.FutureAccessList;
     storageItemAccessList.Clear();
 }
Exemplo n.º 3
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     // Make sure we don't run out of entries in StoreItemAccessList.
     // As we don't need to persist this across app sessions/pages
     // every time should be sufficient for us.
     storageItemAccessList = StorageApplicationPermissions.FutureAccessList;
     storageItemAccessList.Clear();
 }
Exemplo n.º 4
0
        private static async Task <StorageFolder> PickFolder()
        {
            FolderPicker picker = new FolderPicker();

            picker.FileTypeFilter.Add(".");
            StorageFolder picked = await picker.PickSingleFolderAsync();

            Fal.Clear();
            Fal.Add(picked);
            return(picked);
        }
Exemplo n.º 5
0
        protected override void SaveState(Dictionary <string, object> pageState)
        {
            MediaPlayerState      state  = MediaPlayer.GetPlayerState();
            StorageItemAccessList future = StorageApplicationPermissions.FutureAccessList;

            future.Clear();
            string token = future.Add(file);

            pageState.Add("MediaState", state);
            pageState.Add("fileToken", token);
            base.SaveState(pageState);
            if (teardown)
            {
                MediaPlayer.Dispose();
            }
        }
 public MainPage()
 {
     this.InitializeComponent();
     fal.Clear();
 }