Exemplo n.º 1
0
        /// <summary>
        /// 播放视频
        /// </summary>
        /// <param name="aid">AV号</param>
        /// <param name="sender">触发控件(用于查找封面以实现连接动画)</param>
        /// <param name="fromSign">来源参数</param>
        public void PlayVideo(int aid, object sender = null, string fromSign = "")
        {
            //App._watch.Start();
            CurrentSubPageControl.CheckSubReplyPage();
            SelectedSideMenuItem = null;
            if (sender != null && IsEnableAnimation && !IsVideoPageInit)
            {
                //var image = VisualTreeExtension.VisualTreeFindName<FrameworkElement>((FrameworkElement)sender, "VideoCover");
                string animationName = "VideoConnectedAnimation" + Guid.NewGuid().ToString("N");
                ConnectAnimationName = animationName;
                ConnectedAnimationService.GetForCurrentView().PrepareToAnimate(animationName, sender as UIElement);
            }
            else
            {
                ConnectAnimationName = "";
            }
            if (App._isTabletMode)
            {
                CurrentTopPanel.SetSelectedItem(AppMenuItemType.Line);
                TabletMainPage.Current.NavigateToPage(AppMenuItemType.VideoPlayer, aid);
            }
            else
            {
                CurrentSidePanel.SetSelectedItem(AppMenuItemType.Line);
                CurrentPagePanel.NavigateToPage(AppMenuItemType.VideoPlayer, new Tuple <int, string>(aid, fromSign));
            }

            //App._watch.Stop();
        }
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            Window.Current.SetTitleBar(TitleContainer);
            if (e.NavigationMode == NavigationMode.Back || _isInit)
            {
                return;
            }
            bool isSideOpen = AppTool.GetBoolSetting(BiliBili_Lib.Enums.Settings.IsLastSidePanelOpen);

            AppSplitView.IsPaneOpen = isSideOpen;
            App.AppViewModel.CheckAppUpdate();
            var popup = new WaitingPopup("正在初始化");

            popup.ShowPopup();
            bool isCanRequest = await App.BiliViewModel._client.ValidateRequestAsync();

            if (isCanRequest)
            {
                try
                {
                    await App.BiliViewModel.GetRegionsAsync();

                    App.AppViewModel.FontInit();
                    Window.Current.Dispatcher.AcceleratorKeyActivated += App.AppViewModel.AccelertorKeyActivedHandle;
                    if (e.Parameter != null && e.Parameter is string argument && !string.IsNullOrEmpty(argument) && argument.Contains("action"))
                    {
                        App.AppViewModel.AppInitByActivated(argument);
                    }
                    else
                    {
                        PagePanel.NavigateToPage(Models.Enums.AppMenuItemType.Home);
                    }
                }