private async Task PlayVideoFromExternal(string videoId, string videoTitle = null, NicoVideoQuality?quality = null) { var hohoemaApp = Container.Resolve <HohoemaApp>(); var pageManager = Container.Resolve <PageManager>(); if (hohoemaApp.IsLoggedIn) { hohoemaApp.Playlist.PlayVideo(videoId, videoTitle, quality); } else if (AccountManager.HasPrimaryAccount()) { await hohoemaApp.SignInWithPrimaryAccount(); hohoemaApp.Playlist.PlayVideo(videoId, videoTitle, quality); pageManager.OpenStartupPage(); } else { var payload = new LoginRedirectPayload() { RedirectPageType = HohoemaPageType.VideoPlayer, RedirectParamter = new VideoPlayPayload() { VideoId = videoId, Quality = quality } .ToParameterString() }; pageManager.OpenPage(HohoemaPageType.Login, payload.ToParameterString()); } }
protected override async Task NavigatedToAsync(CancellationToken cancelToken, NavigatedToEventArgs e, Dictionary <string, object> viewModelState) { if (e.Parameter is string) { _RedirectInfo = LoginRedirectPayload.FromParameterString <LoginRedirectPayload>(e.Parameter as string); } var accountInfo = await AccountManager.GetPrimaryAccount(); if (accountInfo != null) { Mail.Value = accountInfo.Item1; Password.Value = accountInfo.Item2; } else if (AccountManager.HasPrimaryAccount()) { Mail.Value = AccountManager.GetPrimaryAccountId(); } IsRememberPassword.Value = !string.IsNullOrWhiteSpace(Password.Value); }