Ejemplo n.º 1
0
 private static void InitLiveTitleState(TileUpdater updater)
 {
     updater.EnableNotificationQueueForWide310x150(true);
     updater.EnableNotificationQueueForSquare150x150(true);
     updater.EnableNotificationQueueForSquare310x310(true);
     updater.EnableNotificationQueue(true);
     updater.Clear();
 }
Ejemplo n.º 2
0
 private void InitTileUpdater()
 {
     if (_tileUpdater == null)
     {
         _tileUpdater = TileUpdateManager.CreateTileUpdaterForApplication();
         _tileUpdater.EnableNotificationQueueForWide310x150(true);
         _tileUpdater.EnableNotificationQueueForSquare150x150(true);
         _tileUpdater.EnableNotificationQueueForSquare310x310(true);
         _tileUpdater.EnableNotificationQueue(true);
     }
 }
Ejemplo n.º 3
0
        private async Task LiveTileImageUpdateAsync(Tweet tweet)
        {
            if (tweet.entities != null && tweet.entities.media != null && tweet.entities.media.Count > 0)
            {
                await SharedDispatcher.RunAsync(() =>
                {
                    //テンプレートを取得してXMLを編集
                    XmlDocument doc = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWide310x150PeekImage05);
                    doc.GetElementsByTagName("text")[0].InnerText = "@" + tweet.user.screen_name;
                    doc.GetElementsByTagName("text")[1].InnerText = tweet.text;
                    doc.GetElementsByTagName("image")[0].Attributes.GetNamedItem("src").NodeValue = tweet.entities.media.First().media_url;
                    doc.GetElementsByTagName("image")[1].Attributes.GetNamedItem("src").NodeValue = tweet.user.profile_image_url;

                    TileNotification notification = new TileNotification(doc);


                    notification.ExpirationTime = DateTimeOffset.UtcNow.AddDays(2);
                    //一意のタグを指定
                    notification.Tag = "wide" + liveTileCounter.ToString();
                    //通知を送信
                    TileUpdater updater = TileUpdateManager.CreateTileUpdaterForApplication();
                    updater.EnableNotificationQueueForWide310x150(true);

                    updater.Update(notification);


                    XmlDocument docLarge = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquare310x310ImageAndTextOverlay03);
                    docLarge.GetElementsByTagName("text")[0].InnerText = "@" + tweet.user.screen_name;
                    docLarge.GetElementsByTagName("text")[1].InnerText = tweet.text;
                    docLarge.GetElementsByTagName("image")[0].Attributes.GetNamedItem("src").NodeValue = tweet.entities.media.First().media_url;

                    TileNotification notificationLarge = new TileNotification(docLarge);


                    notificationLarge.ExpirationTime = DateTimeOffset.UtcNow.AddDays(2);
                    //一意のタグを指定
                    notificationLarge.Tag = "large" + liveTileCounter.ToString();

                    //通知を送信
                    TileUpdater updaterLarge = TileUpdateManager.CreateTileUpdaterForApplication();

                    updaterLarge.EnableNotificationQueueForSquare310x310(true);

                    updaterLarge.Update(notificationLarge);
                    if (liveTileCounter > 6)
                    {
                        liveTileCounter = 0;
                    }
                    liveTileCounter++;
                });
            }
        }
Ejemplo n.º 4
0
        public async void UpdateTiles(List <Videolist> collection)
        {
            if (updater == null)
            {
                updater = TileUpdateManager.CreateTileUpdaterForApplication();
            }
            updater.EnableNotificationQueueForWide310x150(true);
            updater.EnableNotificationQueueForSquare150x150(true);
            updater.EnableNotificationQueueForSquare310x310(true);
            updater.EnableNotificationQueue(true);

            foreach (var model in collection)
            {
                try
                {
                    var pcFolder = await ApplicationData.Current.LocalFolder.CreateFolderAsync(CacheConfig.Instance.PCSplashScreenImageCacheRelativePath, CreationCollisionOption.OpenIfExists);

                    var fileName = EyeSight.Encrypt.MD5Core.Instance.ComputeMD5(model.coverForDetail);
                    var file     = await pcFolder.TryGetItemAsync(fileName);

                    string xmlStr = null;

                    if (file != null)
                    {
                        xmlStr =
                            "<tile version='3'>"
                            + "<visual>"
                            + "<binding template='TileMedium' branding='name'>"
                            + "<image placement='peek' src='" + file.Path + "'/>"
                            + "<text hint-wrap='true'>" + model.title + "</text>"
                            + "</binding>"

                            + "<binding template='TileWide' branding='name'>"
                            + "<image placement='peek' src='" + file.Path + "'/>"
                            + "<text hint-wrap='true'>" + model.title + "</text>"
                            + "<text hint-style='captionsubtle' hint-wrap='true'>" + model.description + "</text>"
                            + "</binding>"

                            + "<binding template='TileLarge' branding='name'>"
                            + "<image placement='peek' src='" + file.Path + "'/>"
                            + "<text hint-wrap='true'>" + model.title + "</text>"
                            + "<text hint-style='captionsubtle' hint-wrap='true'>" + model.description + "</text>"
                            + "</binding>"
                            + "</visual>"
                            + "</tile>";
                    }
                    else
                    {
                        xmlStr =
                            "<tile version='3'>"
                            + "<visual>"
                            + "<binding template='TileMedium' branding='name'>"
                            + "<text hint-wrap='true'>" + model.title + "</text>"
                            + "</binding>"

                            + "<binding template='TileWide' branding='name'>"
                            + "<text hint-wrap='true'>" + model.title + "</text>"
                            + "<text hint-style='captionsubtle' hint-wrap='true'>" + model.description + "</text>"
                            + "</binding>"

                            + "<binding template='TileLarge' branding='name'>"
                            + "<text hint-wrap='true'>" + model.title + "</text>"
                            + "<text hint-style='captionsubtle' hint-wrap='true'>" + model.description + "</text>"
                            + "</binding>"
                            + "</visual>"
                            + "</tile>";
                    }

                    if (doc == null)
                    {
                        doc = new XmlDocument();
                    }

                    doc.LoadXml(xmlStr.Replace("&", "-"));

                    updater.Update(new TileNotification(doc));
                }
                catch (Exception ex)
                {
                    string s = ex.ToString();
                }
            }
        }