コード例 #1
0
        private async Task UpdateTilesAsync()
        {
            var todaysNames = await NamedayRepository.GetTodaysNamesAsStringAsync();

            if (todaysNames == null)
            {
                return;
            }

            var template =
                @"<tile>
    <visual version=""4"">
      <binding template=""TileMedium"">
        <text hint-wrap=""true"">{0}</text>
      </binding>
      <binding template=""TileWide"">
        <text hint-wrap=""true"">{0}</text>
      </binding>
    </visual>
  </tile>";

            var content = string.Format(template, todaysNames);
            var doc     = new XmlDocument();

            doc.LoadXml(content);

            TileUpdateManager.CreateTileUpdaterForApplication().Update(new TileNotification(doc));
        }
コード例 #2
0
        private async Task SendNotificationAsync()
        {
            var todaysNames = await NamedayRepository.GetTodaysNamesAsStringAsync();

            if (todaysNames == null)
            {
                return;
            }

            ToastNotifier notifier = ToastNotificationManager.CreateToastNotifier();
            XmlDocument   content  = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText02);

            var texts = content.GetElementsByTagName("text");

            texts[0].InnerText = todaysNames.Contains(",") ?
                                 "Les noms du jour sont" : "Le nom du jour est";
            texts[1].InnerText = todaysNames;
            notifier.Show(new ToastNotification(content));
        }