PushNotificationCallbackArgs.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //-----------------------------------------------------------------------------
  2. // PushNotificationCallbackArgs.cs
  3. //
  4. // Microsoft XNA Community Game Platform
  5. // Copyright (C) Microsoft Corporation. All rights reserved.
  6. //-----------------------------------------------------------------------------
  7. using System;
  8. using System.Net;
  9. namespace PushNotificationSender
  10. {
  11. /// <summary>
  12. /// A wrapper class for the status of a sent push notification.
  13. /// </summary>
  14. public class PushNotificationCallbackArgs
  15. {
  16. public PushNotificationCallbackArgs(PushNotificationSender.NotificationType notificationType, HttpWebResponse response)
  17. {
  18. this.Timestamp = DateTimeOffset.Now;
  19. this.NotificationType = notificationType;
  20. if (null != response)
  21. {
  22. this.MessageId = response.Headers[PushNotificationSender.MESSAGE_ID_HEADER];
  23. this.ChannelUri = response.ResponseUri.ToString();
  24. this.StatusCode = response.StatusCode;
  25. this.NotificationStatus = response.Headers[PushNotificationSender.NOTIFICATION_STATUS_HEADER];
  26. this.DeviceConnectionStatus = response.Headers[PushNotificationSender.DEVICE_CONNECTION_STATUS_HEADER];
  27. this.SubscriptionStatus = response.Headers[PushNotificationSender.SUBSCRIPTION_STATUS_HEADER];
  28. }
  29. }
  30. public DateTimeOffset Timestamp { get; private set; }
  31. public string MessageId { get; private set; }
  32. public string ChannelUri { get; private set; }
  33. public PushNotificationSender.NotificationType NotificationType { get; private set; }
  34. public HttpStatusCode StatusCode { get; private set; }
  35. public string NotificationStatus { get; private set; }
  36. public string DeviceConnectionStatus { get; private set; }
  37. public string SubscriptionStatus { get; private set; }
  38. }
  39. }