示例#1
0
        public void SendRawMessageToAllUsers(string message)
        {
            var store = new ObjectStore();
            var subscribers = store.GetSubscribers();

            SendMessageToUsers(message, subscribers);
        }
示例#2
0
        public void SendToastMessageToAllUsers(string message)
        {
            var store = new ObjectStore();
            var subscribers = store.GetSubscribers();

            var xml = string.Format("<?xml version=\"1.0\" encoding=\"utf-8\"?><wp:Notification xmlns:wp=\"WPNotification\"><wp:Toast><wp:Text1>From admin:</wp:Text1><wp:Text2>{0}</wp:Text2></wp:Toast></wp:Notification>", message);

            var messageBytes = Encoding.UTF8.GetBytes(xml);

            foreach (var subscriber in subscribers)
                SendMessage(new Uri(subscriber.ChannelURI, UriKind.Absolute), messageBytes,
                            Notification.NotificationType.Toast);
        }