public void HandleUri(string url, string title = "") { var result = BiliTool.GetResultFromUri(url); if (result.Type.ToString().Contains("Video")) { if (result.Type == UriType.VideoA) { PlayVideo(Convert.ToInt32(result.Param)); } else { var args = new VideoActiveArgs() { bvid = result.Param }; PlayVideo(args); } } else if (result.Type == UriType.Bangumi) { PlayBangumi(Convert.ToInt32(result.Param), null, true); } else if (result.Type == UriType.Document) { ShowDoucmentPopup(title, Convert.ToInt32(result.Param)); } else if (result.Type == UriType.Web) { ShowWebPopup(title, result.Param); } }
public async void AppInitByActivated(string argument) { QueryString args = QueryString.Parse(argument); args.TryGetValue("action", out string action); bool isPlay = CurrentVideoPlayer != null && (CurrentVideoPlayer.MTC.IsFullWindow || CurrentVideoPlayer.MTC.IsCinema || CurrentVideoPlayer.MTC.IsCompactOverlay); switch (action) { case "video": if (isPlay) { return; } args.TryGetValue("aid", out string videoAid); args.TryGetValue("bvid", out string videoBvId); args.TryGetValue("cid", out string videoCid); var videoArgs = new VideoActiveArgs(); if (!string.IsNullOrEmpty(videoAid)) { videoArgs.aid = Convert.ToInt32(videoAid); } if (!string.IsNullOrEmpty(videoBvId)) { videoArgs.bvid = videoBvId; } if (!string.IsNullOrEmpty(videoCid)) { videoArgs.cid = Convert.ToInt32(videoCid); } PlayVideo(videoArgs); break; case "bangumi": if (isPlay) { return; } args.TryGetValue("epid", out string AnimeEpid); PlayBangumi(Convert.ToInt32(AnimeEpid), isEp: true); break; case "screenshot": args.TryGetValue("image", out string screenShotName); var picLib = await KnownFolders.PicturesLibrary.CreateFolderAsync("Bili ScreenShot", CreationCollisionOption.OpenIfExists); var screenFile = await picLib.CreateFileAsync(screenShotName, CreationCollisionOption.OpenIfExists); await Launcher.LaunchFileAsync(screenFile); break; default: break; } }
public void PlayVideo(VideoActiveArgs args) { SelectedSideMenuItem = null; CurrentSubPageControl.CheckSubReplyPage(); if (App._isTabletMode) { CurrentTopPanel.SetSelectedItem(AppMenuItemType.Line); TabletMainPage.Current.NavigateToPage(AppMenuItemType.VideoPlayer, args); } else { CurrentSidePanel.SetSelectedItem(AppMenuItemType.Line); CurrentPagePanel.NavigateToPage(AppMenuItemType.VideoPlayer, args); } }