Ejemplo n.º 1
0
 private async void PlayNext()
 {
     if (Item_list.Count != 0)
     {
         currentIndex = Math.Abs((currentIndex + 1) % Item_list.Count);
         PlayBackList.SelectedIndex = currentIndex;
         PlayBackList.ScrollIntoView(Item_list[currentIndex]);
         await setNewMediaSource(Item_list[currentIndex]);
     }
 }
Ejemplo n.º 2
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            var Items_in = (Items)e.Parameter;

            Item_ = Items_in;
            CoverIMG.Visibility = Visibility.Collapsed;
            PlayArea.Visibility = Visibility.Collapsed;
            await setNewMediaSource(Items_in);

            base.OnNavigatedTo(e);

            ConnectedAnimation animation =
                ConnectedAnimationService.GetForCurrentView().GetAnimation("forwardAnimation_mc");
            ConnectedAnimation animation_info =
                ConnectedAnimationService.GetForCurrentView().GetAnimation("forwardAnimation_mcinfo");

            if (animation != null)
            {
                animation.TryStart(CoverIMG);
            }
            if (animation_info != null)
            {
                animation_info.TryStart(LogoAndTitle, new UIElement[] { PlayArea, Info, PlayBackList });
            }

            CoverIMG.Visibility = Visibility.Visible;
            PlayArea.Visibility = Visibility.Visible;
            int count_ = 0;

            try
            {
                for (int i = 0; i < ItemAccess.Cache.Count; i++)
                {
                    if (FileType_check(ItemAccess.Cache[i]) == "Music")
                    {
                        Item_list.Add(new Items {
                            AccessSource = null, Date = ItemAccess.Cache[i].DateCreated.ToString(), Type = ItemAccess.Cache[i].DisplayType, Name = ItemAccess.Cache[i].Name, Path = ItemAccess.Cache[i].Path, StorageFile_ = ItemAccess.Cache[i], Size = await SizeOfFileAsync(ItemAccess.Cache[i]), Count = count_
                        });
                        if (Items_in.Name == ItemAccess.Cache[i].Name)
                        {
                            PlayBackList.SelectedIndex = count_;
                            PlayBackList.ScrollIntoView(Item_list[count_]);
                            currentIndex = count_;
                        }
                        count_++;
                    }
                }
            }
            catch (Exception e1)
            {
                //TODO: 保存用户数据
                await new ContentDialog
                {
                    Title           = "Error Occored",
                    Content         = e1.Message,
                    CloseButtonText = "Closed",
                    DefaultButton   = ContentDialogButton.Close
                }.ShowAsync();
            }
            finally
            {
                //毁灭性错误
            }
        }