Esempio n. 1
0
        /// <summary>
        /// 刷新数据
        /// </summary>
        public async void Update()
        {
            IsLoading = true;

            var t1 = _api.GetThemes();
            var t2 = _api.GetQuotationInfo();

            List <Theme>        list = await t1;
            ZhihuDailyQuotation quo  = await t2;

            if (list != null)
            {
                Themes = new ObservableCollection <Theme>();
                Themes.Add(new Theme {
                    ID = "-1", Name = "首页", Description = "", Thumbnail = ""
                });                                                                                //首页
                list.ForEach((t) => { Themes.Add(t); });

                SelectedIndex = 0;
            }
            if (quo != null)
            {
                Title            = quo.Title;
                SubTitle         = quo.SubTitle;
                _logo_back_dark  = quo.LogoBackDark;
                _logo_back_light = quo.LogoBackLight;
            }
            else
            {
                Title            = null;
                SubTitle         = null;
                _logo_back_dark  = null;
                _logo_back_light = null;
            }
            APPTheme = DataShareManager.Current.APPTheme;

            IsLoading = false;
        }
Esempio n. 2
0
        /// <summary>
        /// 自动更新
        /// </summary>
        private async void AutoUpdateQuotation()
        {
            ZhihuDailyQuotation quo = await _api.GetQuotationInfo();

            if (quo != null)
            {
                Title            = quo.Title;
                SubTitle         = quo.SubTitle;
                _logo_back_dark  = quo.LogoBackDark;
                _logo_back_light = quo.LogoBackLight;
            }
            else
            {
                Title            = null;
                SubTitle         = null;
                _logo_back_dark  = null;
                _logo_back_light = null;
            }
            SetLogoBack();

            await Task.Delay(1000 *60);

            AutoUpdateQuotation();
        }