Exemplo n.º 1
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (SettingHelper.IsPc())
            {
                sp_View.DisplayMode = SplitViewDisplayMode.CompactOverlay;
            }
            else
            {
                sp_View.DisplayMode = SplitViewDisplayMode.Overlay;
            }
            ChangeTheme();
            timer          = new DispatcherTimer();
            timer.Interval = new TimeSpan(0, 0, 5);
            timer.Start();
            timer.Tick += Timer_Tick;
            MessageCenter.ChanageThemeEvent   += MessageCenter_ChanageThemeEvent;
            MessageCenter.MianNavigateToEvent += MessageCenter_MianNavigateToEvent;
            MessageCenter.InfoNavigateToEvent += MessageCenter_InfoNavigateToEvent;
            MessageCenter.PlayNavigateToEvent += MessageCenter_PlayNavigateToEvent;
            MessageCenter.HomeNavigateToEvent += MessageCenter_HomeNavigateToEvent;
            MessageCenter.BgNavigateToEvent   += MessageCenter_BgNavigateToEvent;;
            MessageCenter.Logined             += MessageCenter_Logined;
            MessageCenter.ShowOrHideBarEvent  += MessageCenter_ShowOrHideBarEvent;
            MessageCenter.ChangeBg            += MessageCenter_ChangeBg;
            //main_frame.Navigate(typeof(HomePage));
            MessageCenter_ChangeBg();
            main_frame.Visibility   = Visibility.Visible;
            menu_List.SelectedIndex = 0;
            Can_Nav = false;
            bottom.SelectedIndex = 0;
            Can_Nav          = true;
            frame.Visibility = Visibility.Visible;
            frame.Navigate(typeof(BlankPage));

            play_frame.Visibility = Visibility.Visible;
            play_frame.Navigate(typeof(BlankPage));

            if (UserManage.IsLogin())
            {
                MessageCenter_Logined();
            }
            else
            {
                if (SettingHelper.Get_Password().Length != 0)
                {
                    string info = await ApiHelper.LoginBilibili(SettingHelper.Get_UserName(), SettingHelper.Get_Password());

                    if (info != "登录成功")
                    {
                        messShow.Show("过期自动登录失败", 2000);
                    }
                    else
                    {
                        MessageCenter_Logined();
                    }
                }
            }
            LoadPlayApiInfo();

            if (e.Parameter != null)
            {
                var m = e.Parameter as StartModel;
                switch (m.StartType)
                {
                case StartTypes.None:
                    break;

                case StartTypes.Video:
                    MessageCenter.SendNavigateTo(NavigateMode.Info, typeof(VideoViewPage), m.Par1);
                    break;

                case StartTypes.Live:
                    MessageCenter.SendNavigateTo(NavigateMode.Play, typeof(LiveRoomPage), m.Par1);
                    break;

                case StartTypes.Bangumi:
                    break;

                case StartTypes.MiniVideo:
                    MessageCenter.SendNavigateTo(NavigateMode.Info, typeof(WebPage), "http://vc.bilibili.com/mobile/detail?vc=" + m.Par1);
                    break;

                case StartTypes.Web:
                    MessageCenter.SendNavigateTo(NavigateMode.Info, typeof(WebPage), m.Par1);
                    break;

                case StartTypes.File:
                    var files             = m.Par3 as IReadOnlyList <IStorageItem>;
                    List <PlayerModel> ls = new List <PlayerModel>();
                    int i = 1;
                    foreach (StorageFile file in files)
                    {
                        ls.Add(new PlayerModel()
                        {
                            Mode = PlayMode.FormLocal, No = i.ToString(), VideoTitle = "", Title = file.DisplayName, Parameter = file, Aid = file.DisplayName, Mid = file.Path
                        });
                        i++;
                    }
                    MessageCenter.SendNavigateTo(NavigateMode.Play, typeof(PlayerPage), new object[] { ls, 0 });
                    break;

                default:
                    break;
                }
            }


            if (SettingHelper.Get_First())
            {
                TextBlock tx = new TextBlock()
                {
                    Text = @"你好,欢迎使用哔哩哔哩动画第三方UWP,使用此版本前你需要了解以下几点:
1、有些小功能尚未实现,请谅解
2、可能存在些BUG,发现请反馈至[email protected]
3、欢迎加入QQ群一起交流:499690038、530991215
4、哪里做得不好,请轻喷

如果你觉得好用,欢迎给我打赏瓶营养快线:
支付婊:[email protected],**程", IsTextSelectionEnabled = true, TextWrapping = TextWrapping.Wrap
                };
                await new ContentDialog()
                {
                    Content = tx, PrimaryButtonText = "知道了"
                }.ShowAsync();
                SettingHelper.Set_First(false);
            }
        }