using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Net; using WindowsPhone.Recipes.Push.Messasges; using WindowsPhone.Recipes.Push.Server.Models; namespace WindowsPhone.Recipes.Push.Server.Models { /// /// Represents a push notification message send response status. /// public class MessageStatus { private static readonly Dictionary MessageTypes = new Dictionary { {typeof(TilePushNotificationMessage), "Tile"}, {typeof(ToastPushNotificationMessage), "Toast"}, {typeof(RawPushNotificationMessage), "Raw"} }; /// /// Gets the push notification pattern type. /// public string Pattern { get; private set; } /// /// Gets the response time stamp. /// public DateTimeOffset Timestamp { get; private set; } /// /// Gets the message type. /// public string MessageType { get; private set; } /// /// Gets the message ID. /// public Guid MessageId { get; private set; } /// /// Gets the notification channel URI. /// public Uri ChannelUri { get; private set; } /// /// Gets the response status code. /// public HttpStatusCode StatusCode { get; private set; } /// /// Gets the notification status. /// public NotificationStatus NotificationStatus { get; private set; } /// /// Gets the device connection status. /// public DeviceConnectionStatus DeviceConnectionStatus { get; private set; } /// /// Gets the subscription status. /// public SubscriptionStatus SubscriptionStatus { get; private set; } /// /// Initialize a new instance of this type. /// public MessageStatus(string pattern, MessageSendResult result) { Pattern = pattern; Timestamp = result.Timestamp; MessageType = MessageTypes[result.AssociatedMessage.GetType()]; MessageId = result.AssociatedMessage.Id; ChannelUri = result.ChannelUri; StatusCode = result.StatusCode; NotificationStatus = result.NotificationStatus; DeviceConnectionStatus = result.DeviceConnectionStatus; SubscriptionStatus = result.SubscriptionStatus; } /// /// Initialize a new instance of this type. /// public MessageStatus(PushPatternType pattern, MessageSendException exception) { } } }