コード例 #1
0
ファイル: WeekNumberModule.cs プロジェクト: andlju/entile
        public void SendWeekNumberTile(string uniqueId)
        {
            TileNotification tile = new TileNotification(uniqueId)
                                        {
                                            BackgroundUri = string.Format(RemoteTileUriFormat, uniqueId),
                                            Title = "Week number",
                                            Counter = 0
                                        };

            _notificationQueue.EnqueueItem(tile);
        }
コード例 #2
0
        private void SendTile(string uniqueId)
        {
            var extraInfo = _registrator.GetExtraInfo(uniqueId);
            string tileTitle;
            if (extraInfo.TryGetValue("TileTitle", out tileTitle))
            {
                var tile = new TileNotification(uniqueId)
                                {
                                    Title = tileTitle
                                };

                _notificationQueue.EnqueueItem(tile);
            }
        }
コード例 #3
0
ファイル: SampleService.cs プロジェクト: andlju/entile
        public void SendSampleTileToAllClients()
        {
            foreach (var subscriber in _registrator.ListAllSubscribers())
            {
                // TODO Change the sample port
                var tile = new TileNotification(subscriber.UniqueId)
                                {
                                    Title = "Sample title",
                                    BackgroundUri = string.Format("http://localhost:1234/Sample/GetTileImage?clientId={0}", subscriber.UniqueId),
                                    Counter = 17
                                };

                _notificationQueue.EnqueueItem(tile);
            }
        }
コード例 #4
0
ファイル: NotificationAgent.cs プロジェクト: andlju/entile
 private NotificationResponse SendTileNotification(string subscriptionUri, TileNotification notification)
 {
     XNamespace wp = "WPNotification";
     XDocument doc = new XDocument(new XDeclaration("1.0", "utf-8", null),
         new XElement(wp + "Notification", new XAttribute(XNamespace.Xmlns + "wp", "WPNotification"),
             new XElement(wp + "Tile",
                 new XElement(wp + "BackgroundImage",
                     notification.BackgroundUri),
                 new XElement(wp + "Count",
                     notification.Counter),
                 new XElement(wp + "Title",
                     notification.Title)
                 ))
         );
     var payload = doc.Declaration + doc.ToString(SaveOptions.DisableFormatting);
     var notificationMessage = System.Text.Encoding.UTF8.GetBytes(payload);
     return SendRequest(subscriptionUri, notificationMessage, NotificationKind.Tile);
 }