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); } }
private IEnumerator SendToDatabase(string uri, WWWForm form, Action <bool, string> onDataSentStateCallback = null, bool isEnableWaiting = false) { WaitingPopup waitingPopup = null; if (isEnableWaiting) { waitingPopup = Mediator.Instance.PopupsManager.CreatePopup <WaitingPopup>(); } using (var webRequest = UnityWebRequest.Post(uri, form)) { yield return(webRequest.SendWebRequest()); if (webRequest.isNetworkError || webRequest.isHttpError) { Debug.Log($"Error: {webRequest.error}"); } else { //print($"<color=green>{webRequest.downloadHandler.text}</color>"); //print($"<color=green>Данные отправлены успешно!</color>"); } if (!ReferenceEquals(onDataSentStateCallback, null)) { onDataSentStateCallback?.Invoke(webRequest.isNetworkError == false && webRequest.isHttpError == false, webRequest.downloadHandler.text); } } if (!ReferenceEquals(waitingPopup, null)) { Destroy(waitingPopup.gameObject); } }
private async Task LoadMoreRecommendVideo() { var tip = new WaitingPopup("正在加载数据"); tip.ShowPopup(); var data = await App.BiliViewModel._client.GetRecommendVideoAsync(); if (data != null) { data.ForEach(p => VideoCollection.Add(p)); } CheckRecommendStatus(); tip.HidePopup(); VideoCollection.HasMoreItems = true; }
public async Task Refresh() { Reset(); var tip = new WaitingPopup("加载视频中..."); tip.ShowPopup(); var detail = await _animeService.GetBangumiDetailAsync(bangumiId, isEp); if (detail != null && detail.season_id > 0) { _detail = detail; CheckCoin(); if (await InitDetail()) { await VideoPlayer.Init(_detail, _currentPart); } } tip.HidePopup(); App.AppViewModel.CurrentPagePanel.PageScrollViewer.ChangeView(0, 0, 1); }
public async Task Refresh() { if (PageContainer.Visibility == Visibility.Collapsed) { PageContainer.Visibility = Visibility.Visible; } Reset(); var tip = new WaitingPopup("加载视频中..."); tip.ShowPopup(); var detail = await _videoService.GetVideoDetailAsync(videoId, _fromSign, bvId); if (detail != null && detail.aid > 0) { _detail = detail; if (InitDetail()) { await VideoPlayer.Init(_detail, _currentPartId); } } App.AppViewModel.CurrentPagePanel.PageScrollViewer.ChangeView(0, 0, 1); tip.HidePopup(); }
private async Task Login() { var waiting = new WaitingPopup("正在验证数据..."); waiting.ShowPopup(); string userName = UserNameInputBox.Text; string password = PasswordInputBox.Text; if (string.IsNullOrEmpty(userName) || string.IsNullOrEmpty(password)) { ShowMessageBanner("用户名或密码不能为空"); } else if (CaptchaBlock.Visibility == Visibility.Visible && string.IsNullOrEmpty(CaptchaBlock.Code)) { ShowMessageBanner("验证码不能为空"); } else { var result = await App.BiliViewModel._client.Account.LoginAsync(userName, password, CaptchaBlock.Code); switch (result.Status) { case LoginResultType.Success: await App.BiliViewModel.GetMeAsync(); HidePopup(); break; case LoginResultType.Fail: ShowMessageBanner("登录失败,请检查账号密码"); break; case LoginResultType.Error: ShowMessageBanner("2233娘无情地驳回了请求,请稍后重试"); break; case LoginResultType.NeedCaptcha: ShowMessageBanner("需要输入验证码"); CaptchaBlock.Visibility = Visibility.Visible; await CaptchaBlock.RefreshCode(); await Task.Delay(1000); HideMessageBanner(); break; case LoginResultType.Busy: ShowMessageBanner("服务器忙,请稍后重试"); break; case LoginResultType.NeedValidate: ShowMessageBanner("需要安全验证"); BackupWebView.Visibility = Visibility.Visible; BackupWebView.Source = new Uri(result.Url.Replace("&ticket=1", "")); await Task.Delay(1000); HideMessageBanner(); break; default: break; } } waiting.HidePopup(); }