Пример #1
0
        private async Task GetLoad()
        {
            try
            {
                bool LoadPage = true;

                if (settings.SettingContains("LoadPage"))
                {
                    LoadPage = (bool)settings.GetSettingValue("LoadPage");
                }
                else
                {
                    settings.SetSettingValue("LoadPage", true);
                    LoadPage = true;
                }
                if (new UserClass().IsLogin())
                {
                    StorageFolder folder = ApplicationData.Current.LocalFolder;
                    StorageFile   file   = await folder.CreateFileAsync("us.bili", CreationCollisionOption.OpenIfExists);

                    ApiHelper.access_key = await FileIO.ReadTextAsync(file);
                }


                string device = Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily;
                //device == "Windows.Mobile"&&this.ActualWidth<500&&
                if (LoadPage && CheckNetworkHelper.CheckInternetConnectionType() != InternetConnectionType.WwanConnection)
                {
                    WebClientClass wc  = new WebClientClass();
                    string         url = "http://app.bilibili.com/x/splash?plat=0&build=414000&channel=master&width=1080&height=1920";
                    if (device != "Windows.Mobile")
                    {
                        img.Stretch = Stretch.Uniform;
                        url         = "http://app.bilibili.com/x/splash?plat=0&build=414000&channel=master&width=1920&height=1080";
                    }
                    string Result = await wc.GetResults(new Uri(url));

                    LoadModel        load = JsonConvert.DeserializeObject <LoadModel>(Result);
                    List <LoadModel> ls   = JsonConvert.DeserializeObject <List <LoadModel> >(load.data.ToString());
                    if (ls != null && ls.Count != 0)
                    {
                        grid_Load.DataContext = ls[ls.Count - 1];
                        if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent(typeof(StatusBar).ToString()))
                        {
                            var applicationView = ApplicationView.GetForCurrentView();
                            applicationView.SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow);
                            StatusBar statusBar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
                            statusBar.BackgroundOpacity = 0;
                            //StatusBar statusBar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
                            //await statusBar.HideAsync();
                        }
                        await Task.Delay(3000);
                    }
                }
            }
            catch (Exception)
            {
            }
        }
Пример #2
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            switch (new Random().Next(1, 16))
            {
            case 1:
                txt_Load.Text = "子曰:要善用鼠标滚轮";
                break;

            case 2:
                txt_Load.Text = "(。・`ω´・) 卖个萌";
                break;

            case 3:
                txt_Load.Text = "登录后能进入会员的世界哦";
                break;

            case 4:
                txt_Load.Text = "你造吗,每过60秒,1分钟就过去了";
                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;

            default:
                break;
            }
            try
            {
                await RegisterBackgroundTask();

                new DownloadManage().GetDownOk();
                if (!CheckNetworkHelper.CheckNetwork())
                {
                    new MessageDialog("请检查网络连接!").ShowAsync();
                }
            }
            catch (Exception)
            {
            }
        }