コード例 #1
0
        void UpdateTile(IEnumerable <FlickrPhotoResult> results)
        {
            TileUpdater tileUpdater = TileUpdateManager.CreateTileUpdaterForApplication();

            tileUpdater.EnableNotificationQueue(true);

            foreach (FlickrPhotoResult result in results)
            {
                XmlDocument xmlTileContent = TileUpdateManager.GetTemplateContent(
                    TileTemplateType.TileWide310x150ImageAndText01);

                TemplateUtility.CompleteTemplate(
                    xmlTileContent,
                    new string[] { result.Title },
                    new string[] { result.ImageUrl });

                TileNotification notification = new TileNotification(xmlTileContent);

                tileUpdater.Update(notification);
            }
        }
コード例 #2
0
        void SendToast(FlickrPhotoResult flickrPhotoResult)
        {
            ToastNotifier toastNotifier = ToastNotificationManager.CreateToastNotifier();

            XmlDocument xmlToastContent = ToastNotificationManager.GetTemplateContent(
                ToastTemplateType.ToastImageAndText01);

            TemplateUtility.CompleteTemplate(
                xmlToastContent,
                new string[] { flickrPhotoResult.Title },
                new string[] { flickrPhotoResult.ImageUrl },
                "ms-winsoundevent:Notification.Mail");

            // TODO: change delivery time
            ScheduledToastNotification toastNotification = new ScheduledToastNotification(xmlToastContent,
                                                                                          (new DateTimeOffset(DateTime.Now) + TimeSpan.FromSeconds(10)));

            // TODO: change identifier
            toastNotification.Id = "Fred";

            toastNotifier.AddToSchedule(toastNotification);
        }