protected override void OnFileActivated(FileActivatedEventArgs args) { RegisterExceptionHandlingSynchronizationContext(); StartModel par = new StartModel() { StartType = StartTypes.File, Par3 = args.Files }; Frame rootFrame = Window.Current.Content as Frame; if (rootFrame == null) { SYEngine.Core.Initialize(); rootFrame = new Frame(); Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { rootFrame.Navigate(typeof(SplashPage), par); Window.Current.Activate(); return; } rootFrame.Navigate(typeof(SplashPage), par); Window.Current.Activate(); }
protected async override void OnNavigatedTo(NavigationEventArgs e) { #region switch (new Random().Next(1, 4)) { case 1: txt_Load.Text = "爱国、敬业、诚信、友善"; break; case 2: txt_Load.Text = "富强、民主、文明、和谐"; break; case 3: txt_Load.Text = "自由、平等、公正、法治"; break; default: break; } try { await RegisterBackgroundTask(); DownloadHelper2.LoadDowned(); ApiHelper.SetRegions(); LiveRoom.GetTitleItems(); ApiHelper.SetEmojis(); } catch (Exception) { } #endregion //await Task.Delay(2000); m = e.Parameter as StartModel; timer = new DispatcherTimer(); timer.Interval = new TimeSpan(0, 0, 1); timer.Tick += Timer_Tick; timer.Start(); if (m.StartType == StartTypes.None && SettingHelper.Get_LoadSplash()) { await GetResults(); } else { // await Task.Delay(2000); // this.Frame.Navigate(typeof(MainPage), m); } }
protected override async void OnNavigatedTo(NavigationEventArgs e) { switch (new Random().Next(1, 4)) { case 1: LoadText.Text = "爱国、敬业、诚信、友善"; break; case 2: LoadText.Text = "富强、民主、文明、和谐"; break; case 3: LoadText.Text = "自由、平等、公正、法治"; break; default: break; } try { RegisterBackgroundTask(); DownloadHelper2.LoadDowned(); ApiHelper.SetRegions(); LiveRoom.GetTitleItems(); ApiHelper.SetEmojis(); } catch (Exception ex) { Debug.WriteLine(ex); } m = e.Parameter as StartModel; if (m.StartType == StartTypes.None && SettingHelper.LoadSplash) { await GetResults(); this.Frame.Navigate(typeof(MainPage), m); } }
protected override async void OnFileActivated(FileActivatedEventArgs args) { StartModel par = new StartModel() { StartType = StartTypes.File, Par3 = args.Files }; Frame rootFrame = Window.Current.Content as Frame; if (rootFrame == null) { rootFrame = new Frame(); Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { rootFrame.Navigate(typeof(MainPage), par); } // 确保当前窗口处于活动状态 Window.Current.Activate(); rootFrame.Navigate(typeof(MainPage), par); await JYAnalytics.StartTrackAsync(ApiHelper.JyAppkey); }
protected async override void OnActivated(IActivatedEventArgs args) { RegisterExceptionHandlingSynchronizationContext(); //bilibili://bangumi/season/21715 //bilibili://live/5619438 //bilibili://video/19239064 //bilibili://clip/1399466 //bilibili://pgc/review/11592?url_from_h5=1 点评 //bilibili://article/242568 //bilibili://music/detail/247991?name=2018%E5%B8%9D%E7%8E%96%E6%BC%94%E5%A5%8F%E8%AE%A1%E5%88%92%EF%BC%9A%E4%BA%A4%E5%93%8D%E7%BB%84%E6%9B%B2%E3%80%8C%E5%90%9B%E3%81%AE%E5%90%8D%E3%81%AF%E3%80%82%E3%80%8D&cover_url=http:%2F%2Fi0.hdslb.com%2Fbfs%2Fmusic%2F9892d28aa5858a571e4a832d314e2136211ad7f7.jpg&from=outer_h5 //bilibili://album/2403422 //bilibili://author/2622476 // bilibili://music/menu/detail/78723 if (args.Kind == ActivationKind.Protocol) { Frame rootFrame = Window.Current.Content as Frame; StartModel par = new StartModel() { StartType = StartTypes.HandelUri }; ProtocolActivatedEventArgs eventArgs = args as ProtocolActivatedEventArgs; par.Par1 = eventArgs.Uri.AbsoluteUri; //string video = Regex.Match(eventArgs.Uri.AbsoluteUri, @"video/(\d+)").Groups[1].Value; //string video2 = Regex.Match(eventArgs.Uri.AbsoluteUri.Replace("/","").Replace("=",""), @"av(\d+)").Groups[1].Value; //string live = Regex.Match(eventArgs.Uri.AbsoluteUri, @"live/(\d+)").Groups[1].Value; //string minivideo = Regex.Match(eventArgs.Uri.AbsoluteUri, @"clip/(\d+)").Groups[1].Value; //string bangumi = Regex.Match(eventArgs.Uri.AbsoluteUri, @"season/(\d+)").Groups[1].Value; //string music = Regex.Match(eventArgs.Uri.AbsoluteUri, @"music/detail/(\d+)").Groups[1].Value; //string album = Regex.Match(eventArgs.Uri.AbsoluteUri, @"album/(\d+)").Groups[1].Value; //string article = Regex.Match(eventArgs.Uri.AbsoluteUri, @"article/(\d+)").Groups[1].Value; //string author = Regex.Match(eventArgs.Uri.AbsoluteUri, @"author/(\d+)").Groups[1].Value; if (rootFrame != null) { if (!await MessageCenter.HandelUrl(eventArgs.Uri.AbsoluteUri)) { ContentDialog contentDialog = new ContentDialog() { PrimaryButtonText = "确定", Title = "不支持跳转的地址" }; TextBlock textBlock = new TextBlock() { Text = eventArgs.Uri.AbsoluteUri, IsTextSelectionEnabled = true }; contentDialog.Content = textBlock; contentDialog.ShowAsync(); } } else { SYEngine.Core.Initialize(); // 创建要充当导航上下文的框架,并导航到第一页 rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; // 将框架放在当前窗口中 Window.Current.Content = rootFrame; rootFrame.Navigate(typeof(SplashPage), par); Window.Current.Activate(); } //if (live.Length != 0) //{ // par.StartType = StartTypes.Live; // par.Par1 = live; // if (rootFrame!=null) // { // MessageCenter.SendNavigateTo(NavigateMode.Play, typeof(LiveRoomPage), live); // return; // } //} //if (video.Length != 0) //{ // par.StartType = StartTypes.Video; // par.Par1 = video; // if (rootFrame != null) // { // MessageCenter.SendNavigateTo(NavigateMode.Info, typeof(VideoViewPage), video); // return; // } //} //if (video2.Length != 0) //{ // par.StartType = StartTypes.Video; // par.Par1 = video2; // if (rootFrame != null) // { // MessageCenter.SendNavigateTo(NavigateMode.Info, typeof(VideoViewPage), video2); // return; // } //} //if (minivideo.Length != 0) //{ // par.StartType = StartTypes.MiniVideo; // par.Par1 = minivideo; // if (rootFrame != null) // { // MessageCenter.ShowMiniVideo(minivideo); // return; // } //} //if (bangumi.Length != 0) //{ // par.StartType = StartTypes.Bangumi; // par.Par1 = bangumi; // if (rootFrame != null) // { // MessageCenter.SendNavigateTo(NavigateMode.Info, typeof(BanInfoPage), bangumi); // return; // } //} //if (album.Length != 0) //{ // par.StartType = StartTypes.Album; // par.Par1 = album; // if (rootFrame != null) // { // MessageCenter.SendNavigateTo(NavigateMode.Info, typeof(DynamicInfoPage), album); // return; // } //} //if (music.Length != 0) //{ // par.StartType = StartTypes.Music; // par.Par1 = music; // if (rootFrame != null) // { // MessageCenter.SendNavigateTo(NavigateMode.Play, typeof(MusicInfoPage), music); // return; // } //} //if (musicmenu.Length != 0) //{ // par.StartType = StartTypes.Music; // par.Par1 = music; // if (rootFrame != null) // { // MessageCenter.SendNavigateTo(NavigateMode.Play, typeof(MusicInfoPage), music); // return; // } //} //if (article.Length != 0) //{ // par.StartType = StartTypes.Article; // par.Par1 = "https://www.bilibili.com/read/app/" + article; // if (rootFrame != null) // { // MessageCenter.SendNavigateTo(NavigateMode.Info, typeof(ArticleContentPage), "https://www.bilibili.com/read/app/" + article); // return; // } //} //if (author.Length != 0) //{ // par.StartType = StartTypes.User; // par.Par1 = author; // if (rootFrame != null) // { // MessageCenter.SendNavigateTo(NavigateMode.Info, typeof(UserInfoPage), author); // return; // } //} } }
/// <summary> /// 在应用程序由最终用户正常启动时进行调用。 /// 将在启动应用程序以打开特定文件等情况下使用。 /// </summary> /// <param name="e">有关启动请求和过程的详细信息。</param> protected override void OnLaunched(LaunchActivatedEventArgs e) { SYEngine.Core.Initialize(); RegisterExceptionHandlingSynchronizationContext(); #if DEBUG if (System.Diagnostics.Debugger.IsAttached) { this.DebugSettings.EnableFrameRateCounter = true; } #endif Frame rootFrame = Window.Current.Content as Frame; // 不要在窗口已包含内容时重复应用程序初始化, // 只需确保窗口处于活动状态 if (rootFrame == null) { // 创建要充当导航上下文的框架,并导航到第一页 rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: 从之前挂起的应用程序加载状态 } // 将框架放在当前窗口中 Window.Current.Content = rootFrame; } if (e.PrelaunchActivated == false) { ApiHelper.access_key = SettingHelper.Get_Access_key(); UserManage.access_key = SettingHelper.Get_Access_key(); var par = new StartModel() { StartType = StartTypes.None }; if (e.Arguments.Length != 0) { var d = e.Arguments.Split(','); if (d.Length > 1) { if (d[0] == "bangumi") { par.StartType = StartTypes.Bangumi; par.Par1 = d[1]; } if (d[0] == "live") { par.StartType = StartTypes.Live; par.Par1 = d[1]; } } else { par.StartType = StartTypes.Video; par.Par1 = e.Arguments; } } if (SettingHelper.Get_PlayerMode()) { rootFrame.Navigate(typeof(PlayerModePage)); } else { if (rootFrame.Content == null) { rootFrame.Navigate(typeof(SplashPage), par); } else { if (par.StartType == StartTypes.Video) { MessageCenter.SendNavigateTo(NavigateMode.Info, typeof(VideoViewPage), par.Par1); } if (par.StartType == StartTypes.Bangumi) { MessageCenter.SendNavigateTo(NavigateMode.Info, typeof(BanInfoPage), par.Par1); } if (par.StartType == StartTypes.Live) { MessageCenter.SendNavigateTo(NavigateMode.Info, typeof(LiveRoomPage), par.Par1); } } } // 确保当前窗口处于活动状态 } Window.Current.Activate(); }
protected async override void OnNavigatedTo(NavigationEventArgs e) { #region switch (new Random().Next(1, 20)) { case 1: txt_Load.Text = "爱国、敬业、诚信、友善"; break; case 2: txt_Load.Text = "富强、民主、文明、和谐"; break; case 3: txt_Load.Text = "自由、平等、公正、法治"; break; case 4: txt_Load.Text = "新版本,新的开始"; break; case 5: txt_Load.Text = "这里放广告?"; break; case 6: txt_Load.Text = "橙子贼帅!"; break; case 7: txt_Load.Text = "请背会社会主义核心价值观"; break; case 8: txt_Load.Text = "子曰:要善于 发现"; break; case 9: txt_Load.Text = "哔哩哔哩动画 UWP"; break; case 10: txt_Load.Text = "只有帅的人才能看到这句话"; break; case 11: txt_Load.Text = "+1S"; break; case 12: txt_Load.Text = "蛤蛤蛤蛤蛤蛤蛤蛤"; break; case 13: txt_Load.Text = "垃圾橙子,应用做得这么烂!"; break; case 14: txt_Load.Text = "听说背景可以自定义了"; break; case 15: txt_Load.Text = "听说下载位置也可以自定义了"; break; case 16: txt_Load.Text = "招女友,条件:女的,会帮我写代码"; break; case 17: txt_Load.Text = "偷偷放个网址,应该没人知道:nsapp.win"; break; case 18: txt_Load.Text = "招女友,条件:女的,LOL王者段位"; break; case 19: txt_Load.Text = "哔哩哔哩动画 UWP"; break; //case 5: // txt_Load.Text = "→_→ 橙子是个帅哥"; // break; //case 6: // txt_Load.Text = "BUG什么最讨厌了 o( ̄ヘ ̄*o)"; // break; //case 7: // txt_Load.Text = "23333333"; // break; //case 8: // txt_Load.Text = "哔哩哔哩动画 UWP"; // break; //case 9: // txt_Load.Text = "只有帅的人才能看到这句话"; // break; //case 10: // txt_Load.Text = "C#是世界上最好的语言!"; // break; //case 11: // txt_Load.Text = "看到不爽的弹幕就要屏蔽掉"; // break; //case 12: // txt_Load.Text = "书上说,看到白学家就要打死"; // break; //case 13: // txt_Load.Text = "有妹子用这软件吗?"; // break; //case 14: // txt_Load.Text = "看到这句话的自动为长者+1S"; // break; //case 15: // txt_Load.Text = "年轻人不要整天习习蛤蛤的(好像打错字了"; // break; //case 16: // txt_Load.Text = "写代码的怎么可能有女朋友..."; // break; //case 17: // txt_Load.Text = "自由、平等、公正、法治"; // break; //case 18: // txt_Load.Text = "注意到这句话证明你很无聊"; // break; //case 19: // txt_Load.Text = "欢迎使用全球最大同性交友网站的UWP客户端"; // break; //case 20: // txt_Load.Text = "好无聊...好无聊...好无聊..."; // break; //case 21: // txt_Load.Text = "收集齐启动界面的全部句子可以找橙子拿奖励哦"; // break; //case 22: // txt_Load.Text = "垃圾橙子,应用做得这么烂!"; // break; //case 23: // txt_Load.Text = "~E·M·T! E·M·T! E·M·T!~"; // break; //case 24: // txt_Load.Text = "看见零学家也要打死"; // break; //case 25: // txt_Load.Text = "看漫画就用动漫之家UWP"; // break; //case 26: // txt_Load.Text = "那啥追番UWP,追番神器!"; // break; //case 27: // txt_Load.Text = "富强、民主、文明、和谐"; // break; //case 28: // txt_Load.Text = "突然觉得雷姆才是真爱"; // break; //case 29: // txt_Load.Text = "去试试我的其他应用啊"; // break; //case 30: // txt_Load.Text = "不想当段子手的死宅不是好程序员"; // break; //case 31: // txt_Load.Text = "想不出梗了...这里该怎么写呢..."; // break; //case 32: // txt_Load.Text = "交流♂群530991215"; // break; //case 33: // txt_Load.Text = "Are you OK?"; // break; //case 34: // txt_Load.Text = "《C#从入门到精神病院》"; // break; //case 35: // txt_Load.Text = "富强、民主、文明、和谐"; // break; //case 36: // txt_Load.Text = "自由、平等、公正、法治"; // break; //case 37: // txt_Load.Text = "爱国、敬业、诚信、友善"; // break; default: break; } try { //SettingHelper strring = new SettingHelper(); await RegisterBackgroundTask(); DownloadHelper.GetDownedList(); //if (!CheckNetworkHelper.CheckNetwork()) //{ // new MessageDialog("请检查网络连接!").ShowAsync(); //} } catch (Exception) { } #endregion //await Task.Delay(2000); m = e.Parameter as StartModel; timer = new DispatcherTimer(); timer.Interval = new TimeSpan(0, 0, 1); timer.Tick += Timer_Tick; timer.Start(); if (m.StartType == StartTypes.None && SettingHelper.Get_LoadSplash()) { await GetResults(); } else { // await Task.Delay(2000); // this.Frame.Navigate(typeof(MainPage), m); } }
internal async Task LoadAsync(LaunchActivatedEventArgs e) { await Task.Delay(100); Frame rootFrame = Window.Current.Content as Frame; // 不要在窗口已包含内容时重复应用程序初始化, // 只需确保窗口处于活动状态 if (rootFrame == null) { // 创建要充当导航上下文的框架,并导航到第一页 rootFrame = new Frame(); rootFrame.NavigationFailed += ((App)App.Current).OnNavigationFailed; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: 从之前挂起的应用程序加载状态 } } if (e.PrelaunchActivated) { return; } ApiHelper.access_key = SettingHelper.Get_Access_key(); UserManage.access_key = SettingHelper.Get_Access_key(); var par = new StartModel() { StartType = StartTypes.None }; if (e.Arguments.Length != 0) { var d = e.Arguments.Split(','); if (d.Length > 1) { if (d[0] == "bangumi") { par.StartType = StartTypes.Bangumi; par.Par1 = d[1]; } if (d[0] == "live") { par.StartType = StartTypes.Live; par.Par1 = d[1]; } } else { par.StartType = StartTypes.Video; par.Par1 = e.Arguments; } } if (SettingHelper.Get_PlayerMode()) { rootFrame.Navigate(typeof(PlayerModePage)); } else { if (rootFrame.Content == null || rootFrame.Content is PreSplashPage) { rootFrame.Navigate(typeof(SplashPage), par); } else { if (par.StartType == StartTypes.Video) { MessageCenter.SendNavigateTo(NavigateMode.Info, typeof(VideoViewPage), par.Par1); } if (par.StartType == StartTypes.Bangumi) { MessageCenter.SendNavigateTo(NavigateMode.Info, typeof(BanInfoPage), par.Par1); } if (par.StartType == StartTypes.Live) { MessageCenter.SendNavigateTo(NavigateMode.Info, typeof(LiveRoomPage), par.Par1); } } } // 将框架放在当前窗口中 Window.Current.Content = rootFrame; } // End Function ' LoadAsync
/// <summary> /// 在应用程序由最终用户正常启动时进行调用。 /// 将在启动应用程序以打开特定文件等情况下使用。 /// </summary> /// <param name="e">有关启动请求和过程的详细信息。</param> protected override async void OnLaunched(LaunchActivatedEventArgs e) { #if DEBUG //if (System.Diagnostics.Debugger.IsAttached) //{ // this.DebugSettings.EnableFrameRateCounter = true; //} #endif Frame rootFrame = Window.Current.Content as Frame; // 不要在窗口已包含内容时重复应用程序初始化, // 只需确保窗口处于活动状态 if (rootFrame == null) { // 创建要充当导航上下文的框架,并导航到第一页 rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: 从之前挂起的应用程序加载状态 } // 将框架放在当前窗口中 Window.Current.Content = rootFrame; } if (e.PrelaunchActivated == false) { if (rootFrame.Content == null) { // 当导航堆栈尚未还原时,导航到第一页, // 并通过将所需信息作为导航参数传入来配置 // 参数 ApiHelper.access_key = SettingHelper.Get_Access_key(); UserManage.access_key = SettingHelper.Get_Access_key(); var par = new StartModel() { StartType = StartTypes.None }; if (e.Arguments.Length != 0) { par.StartType = StartTypes.Video; par.Par1 = e.Arguments; } if (SettingHelper.Get_PlayerMode()) { rootFrame.Navigate(typeof(PlayerModePage)); } else { rootFrame.Navigate(typeof(SplashPage), par); } } // 确保当前窗口处于活动状态 Window.Current.Activate(); await JYAnalytics.StartTrackAsync(ApiHelper.JyAppkey); } }
protected override async void OnActivated(IActivatedEventArgs args) { //new MessageDialog("卧槽").ShowAsync(); if (args.Kind == ActivationKind.Protocol) { StartModel par = new StartModel() { StartType = StartTypes.None }; ProtocolActivatedEventArgs eventArgs = args as ProtocolActivatedEventArgs; string ban3 = Regex.Match(eventArgs.Uri.AbsoluteUri, @"^bilibili://video/(.*?)$").Groups[1].Value; string live = Regex.Match(eventArgs.Uri.AbsoluteUri, @"^bilibili://live/(.*?)$").Groups[1].Value; string minivideo = Regex.Match(eventArgs.Uri.AbsoluteUri, @"^bililive://clip/(.*?)$").Groups[1].Value; Frame rootFrame = Window.Current.Content as Frame; if (live.Length != 0) { par.StartType = StartTypes.Live; par.Par1 = live; //args.Handled = true; if (rootFrame == null) { rootFrame = new Frame(); Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { rootFrame.Navigate(typeof(SplashPage), par); } // 确保当前窗口处于活动状态 Window.Current.Activate(); rootFrame.Navigate(typeof(SplashPage), par); return; } if (ban3.Length != 0) { par.StartType = StartTypes.Video; par.Par1 = ban3; if (rootFrame == null) { rootFrame = new Frame(); Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { rootFrame.Navigate(typeof(SplashPage), par); } // 确保当前窗口处于活动状态 Window.Current.Activate(); rootFrame.Navigate(typeof(SplashPage), par); return; } if (minivideo.Length != 0) { //args.Handled = true; par.StartType = StartTypes.MiniVideo; par.Par1 = minivideo; if (rootFrame == null) { rootFrame = new Frame(); Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { rootFrame.Navigate(typeof(SplashPage), par); } // 确保当前窗口处于活动状态 Window.Current.Activate(); rootFrame.Navigate(typeof(SplashPage), par); return; } if (rootFrame == null) { rootFrame = new Frame(); Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { rootFrame.Navigate(typeof(SplashPage), par); } // 确保当前窗口处于活动状态 Window.Current.Activate(); rootFrame.Navigate(typeof(SplashPage), par); } await JYAnalytics.StartTrackAsync(ApiHelper.JyAppkey); }