public void Send(string frontTitle, int count, string frontImageLocation, string backTitle, string backImageLocation, string backContent, PhoneUriCollection phoneUriCollection) { var tileMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<wp:Notification xmlns:wp=\"WPNotification\">" + "<wp:Tile>" + "<wp:BackgroundImage>{2}</wp:BackgroundImage>" + "<wp:Count>{1}</wp:Count>" + "<wp:Title>{0}</wp:Title>" + "<wp:BackBackgroundImage>{4}</wp:BackBackgroundImage>" + "<wp:BackContent>{5}</wp:BackContent>" + "<wp:BackTitle>{3}</wp:BackTitle>" + "</wp:Tile> " + "</wp:Notification>"; tileMessage = string.Format(tileMessage, frontTitle, count, frontImageLocation, backTitle, backImageLocation, backContent); var messageBytes = System.Text.Encoding.UTF8.GetBytes(tileMessage); foreach (var uri in phoneUriCollection.Values) { try { messageSender.Send(uri, messageBytes, NotificationType.Tile); } catch (Exception error) { ErrorSignal.FromCurrentContext().Raise(error); } } }
public void Send(string title, string message, PhoneUriCollection phoneUriCollection) { var toastMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<wp:Notification xmlns:wp=\"WPNotification\">" + "<wp:Toast>" + "<wp:Text1>{0}</wp:Text1>" + "<wp:Text2>{1}</wp:Text2>" + "</wp:Toast>" + "</wp:Notification>"; toastMessage = string.Format(toastMessage, title, message); var messageBytes = System.Text.Encoding.UTF8.GetBytes(toastMessage); foreach (var uri in phoneUriCollection.Values) { try { messageSender.Send(uri, messageBytes, NotificationType.Toast); } catch (Exception error) { ErrorSignal.FromCurrentContext().Raise(error); } } }
public PhoneUriCollection GetAll() { using (IDbConnection connection = OpenConnection()) { var collection = new PhoneUriCollection(); IEnumerable<Subscription> subscriptions = connection.Query<Subscription>(@"select PhoneId, Uri from subscription"); foreach (var subscription in subscriptions) { collection[subscription.PhoneId] = new Uri(subscription.Uri); } return collection; } }