Esempio n. 1
0
 public async void UpdateArticle(string time)
 {
     string strJson = await APIBaseService.GetJsons(string.Format(ServiceURL.strArticleURL, time));
     JObject obj = JObject.Parse(strJson);
     Article = Equals(obj["result"].ToString(), "SUCCESS") ?
              JsonConvert.DeserializeObject<OneArticle>(obj["contentEntity"].ToString()) : Article;
 }
Esempio n. 2
0
        /// <summary>
        /// 更新动态磁贴
        ///https://msdn.microsoft.com/zh-cn/library/windows/apps/mt186446.aspx
        ///https://msdn.microsoft.com/zh-cn/library/windows/apps/mt590880.aspx
        ///10586: TileMedium:hint-crop="circle"
        ///</summary>
        private static void UpdateBadge(OnePicture picture, OneArticle article, OneQuestion question)
        {
            try
            {
                string TileTemplateXml = $@"<tile>
                                    <visual branding='nameAndLogo'>
                                      <binding template = 'TileMedium' hint-textStacking='center'>
                                        <image src='{picture.OriginalImgUrl}' placement='peek'/>
                                        <text hint-style='base' hint-align='center'>{picture.Author.Split(new char[] { '&' }).FirstOrDefault()}</text>
                                        <text hint-style='captionSubtle' hint-align='center'>{picture.Author.Split(new char[] { '&' }).LastOrDefault()}</text>
                                      </binding>
                                      <binding template='TileWide'>
                                         <image src='Assets/Wide310x150Logo.scale-200.png' placement='peek'/>
                                        <group>
                                          <subgroup>
                                            <text hint-style='subtitle'>One 问题</text>
                                            <text hint-style='captionsubtle'>{question.QuestionTitle}</text>
                                            <text hint-style='captionsubtle' hint-wrap='true' hint-maxLines='3'>{question.QuestionContent}</text>
                                          </subgroup>
                                        </group>
                                      </binding>
                                      <binding template='TileLarge' hint-textStacking='center'>
                                        <group>
                                          <subgroup hint-weight='1'/>
                                          <subgroup hint-weight='2'>
                                            <image src='Assets/Square150x150Logo.scale-200.png' hint-crop='circle'/>
                                          </subgroup>
                                          <subgroup hint-weight='1'/>
                                        </group>
                                        <text hint-style='title' hint-align='center'>{article.ContTitle}</text>
                                        <text hint-style='subtitleSubtle' hint-align='center'>{article.GW}</text>
                                      </binding>
                                    </visual>
                                   </tile>";

                var updater = TileUpdateManager.CreateTileUpdaterForApplication();
                updater.EnableNotificationQueueForSquare150x150(true);
                updater.EnableNotificationQueueForSquare310x310(true);
                updater.EnableNotificationQueueForWide310x150(true);
                updater.EnableNotificationQueue(true);
                updater.Clear();

                var doc = new XmlDocument();
                doc.LoadXml(System.Net.WebUtility.HtmlDecode(TileTemplateXml), new XmlLoadSettings()
                {
                    ProhibitDtd = false,
                    ValidateOnParse = false,
                    ElementContentWhiteSpace = false,
                    ResolveExternals = false
                });
                updater.Update(new TileNotification(doc));
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                return;
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 更新Toast通知
 /// </summary>
 private static void ShowToast(OnePicture picture, OneArticle article, OneQuestion question)
 {
     
 }