mirror of
https://github.com/farcasclaudiu/myfriendsaround.git
synced 2026-06-29 03:01:46 +03:00
push notification helper library
http://windowsteamblog.com/windows_phone/b/wpdev/archive/2011/01/14/windows-push-notification-server-side-helper-library.aspx http://create.msdn.com/en-us/education/catalog/article/pnhelp-wp7
This commit is contained in:
+139
@@ -0,0 +1,139 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ClassDiagram MajorVersion="1" MinorVersion="1">
|
||||
<Class Name="WindowsPhone.Recipes.Push.Messasges.Guard" Collapsed="true">
|
||||
<Position X="10.75" Y="3" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAEAAIAAAAAAAAAAAAAAQAAAAAAAAAAAACAAAAAAAAA=</HashCode>
|
||||
<FileName>Guard.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="WindowsPhone.Recipes.Push.Messasges.HttpWebResponseExtensions">
|
||||
<Position X="10.75" Y="0.5" Width="2.25" />
|
||||
<Members>
|
||||
<Method Name="GetStatus" Hidden="true" />
|
||||
</Members>
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAEAAAAEAgAQAAAAAAAAAA=</HashCode>
|
||||
<FileName>HttpWebResponseExtensions.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="WindowsPhone.Recipes.Push.Messasges.MessageSendException">
|
||||
<Position X="0.5" Y="3.25" Width="2" />
|
||||
<Members>
|
||||
<Method Name="MessageSendException" Hidden="true" />
|
||||
</Members>
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>MessageSendException.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="WindowsPhone.Recipes.Push.Messasges.MessageSendResult">
|
||||
<Position X="0.5" Y="0.5" Width="2" />
|
||||
<Members>
|
||||
<Method Name="InitializeStatusCodes" Hidden="true" />
|
||||
<Method Name="MessageSendResult" Hidden="true" />
|
||||
</Members>
|
||||
<TypeIdentifier>
|
||||
<HashCode>FAAAAAAAAQCAAAAgAAACAAAAAAgAAAAAIABAAAAAAAA=</HashCode>
|
||||
<FileName>MessageSendResult.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="WindowsPhone.Recipes.Push.Messasges.PushNotificationMessage">
|
||||
<Position X="3.25" Y="0.5" Width="2.25" />
|
||||
<Members>
|
||||
<Field Name="_payload" Hidden="true" />
|
||||
<Field Name="_sendPriority" Hidden="true" />
|
||||
<Field Name="_sync" Hidden="true" />
|
||||
<Method Name="DebugOutput" Hidden="true" />
|
||||
<Method Name="GetOrCreatePayload" Hidden="true" />
|
||||
</Members>
|
||||
<Compartments>
|
||||
<Compartment Name="Fields" Collapsed="true" />
|
||||
</Compartments>
|
||||
<NestedTypes>
|
||||
<Class Name="WindowsPhone.Recipes.Push.Messasges.PushNotificationMessage.Headers" Collapsed="true">
|
||||
<TypeIdentifier>
|
||||
<NewMemberFileName>PushNotificationMessage.cs</NewMemberFileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
</NestedTypes>
|
||||
<TypeIdentifier>
|
||||
<HashCode>CBBCAAAAAAIAAIgAAEAQgAAggABAQAAAAAKRAAAAEIA=</HashCode>
|
||||
<FileName>PushNotificationMessage.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="WindowsPhone.Recipes.Push.Messasges.RawPushNotificationMessage">
|
||||
<Position X="0.5" Y="5.75" Width="2.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAIAAAAAAgAAABAAAAAAAAAQAAAAAACAAAAAAA=</HashCode>
|
||||
<FileName>RawPushNotificationMessage.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="WindowsPhone.Recipes.Push.Messasges.TilePushNotificationMessage">
|
||||
<Position X="3.25" Y="5.75" Width="2.25" />
|
||||
<Members>
|
||||
<Field Name="_backgroundImageUri" Hidden="true" />
|
||||
<Field Name="_count" Hidden="true" />
|
||||
<Field Name="_title" Hidden="true" />
|
||||
<Field Name="MaxCount" Hidden="true" />
|
||||
<Field Name="MinCount" Hidden="true" />
|
||||
<Field Name="PayloadString" Hidden="true" />
|
||||
<Field Name="WindowsPhoneTarget" Hidden="true" />
|
||||
</Members>
|
||||
<TypeIdentifier>
|
||||
<HashCode>ARAAAAABAIAAAEgAAARACAQCAAAAQAAgAACAAAAAAKA=</HashCode>
|
||||
<FileName>TilePushNotificationMessage.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="WindowsPhone.Recipes.Push.Messasges.ToastPushNotificationMessage">
|
||||
<Position X="5.75" Y="5.75" Width="2.5" />
|
||||
<Members>
|
||||
<Field Name="_subTitle" Hidden="true" />
|
||||
<Field Name="_title" Hidden="true" />
|
||||
<Field Name="PayloadString" Hidden="true" />
|
||||
<Field Name="WindowsPhoneTarget" Hidden="true" />
|
||||
</Members>
|
||||
<Compartments>
|
||||
<Compartment Name="Fields" Collapsed="true" />
|
||||
</Compartments>
|
||||
<TypeIdentifier>
|
||||
<HashCode>ABAAAAAAAIAAAEgAAARAAEAABgAAQAAAAAAAAAAAAKA=</HashCode>
|
||||
<FileName>ToastPushNotificationMessage.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="WindowsPhone.Recipes.Push.Messasges.Properties.Resources" Collapsed="true">
|
||||
<Position X="10.75" Y="2.25" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAACAAAAAAACgBEABAQQAAAAAAAAAAAJACAIA=</HashCode>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Enum Name="WindowsPhone.Recipes.Push.Messasges.DeviceConnectionStatus">
|
||||
<Position X="8.5" Y="4" Width="2" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>ABIACAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>DeviceConnectionStatus.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Enum>
|
||||
<Enum Name="WindowsPhone.Recipes.Push.Messasges.MessageSendPriority">
|
||||
<Position X="8.5" Y="5.75" Width="2" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAgAAAAAAAAgIAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>MessageSendPriority.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Enum>
|
||||
<Enum Name="WindowsPhone.Recipes.Push.Messasges.NotificationStatus">
|
||||
<Position X="8.5" Y="2" Width="2" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAIAAECBAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>NotificationStatus.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Enum>
|
||||
<Enum Name="WindowsPhone.Recipes.Push.Messasges.SubscriptionStatus">
|
||||
<Position X="8.5" Y="0.5" Width="2" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAhAAAAAAAAAAA=</HashCode>
|
||||
<FileName>SubscriptionStatus.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Enum>
|
||||
<Font Name="Calibri" Size="10" />
|
||||
</ClassDiagram>
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace WindowsPhone.Recipes.Push.Messasges
|
||||
{
|
||||
/// <summary>
|
||||
/// Windows Phone Device connection status.
|
||||
/// </summary>
|
||||
public enum DeviceConnectionStatus
|
||||
{
|
||||
/// <value>The request is not applicable.</value>
|
||||
NotApplicable,
|
||||
|
||||
/// <value>The device is connected.</value>
|
||||
Connected,
|
||||
|
||||
/// <value>The device is temporarily disconnected.</value>
|
||||
TempDisconnected,
|
||||
|
||||
/// <value>The device is in an inactive state.</value>
|
||||
Inactive
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
|
||||
using WindowsPhone.Recipes.Push.Messasges.Properties;
|
||||
|
||||
namespace WindowsPhone.Recipes.Push.Messasges
|
||||
{
|
||||
/// <summary>
|
||||
/// A static helper class that includes various parameter checking routines.
|
||||
/// </summary>
|
||||
public static partial class Guard
|
||||
{
|
||||
/// <summary>
|
||||
/// Throws <see cref="ArgumentNullException"/> if the given argument is null.
|
||||
/// </summary>
|
||||
/// <exception cref="ArgumentNullException"> if tested value if null.</exception>
|
||||
/// <param name="argumentValue">Argument value to test.</param>
|
||||
/// <param name="argumentName">Name of the argument being tested.</param>
|
||||
public static void ArgumentNotNull(object argumentValue,
|
||||
string argumentName)
|
||||
{
|
||||
if (argumentValue == null)
|
||||
{
|
||||
throw new ArgumentNullException(argumentName);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Throws an exception if the tested string argument is null or the empty string.
|
||||
/// </summary>
|
||||
/// <exception cref="ArgumentNullException">Thrown if string value is null.</exception>
|
||||
/// <exception cref="ArgumentException">Thrown if the string is empty</exception>
|
||||
/// <param name="argumentValue">Argument value to check.</param>
|
||||
/// <param name="argumentName">Name of argument being checked.</param>
|
||||
public static void ArgumentNotNullOrEmpty(string argumentValue,
|
||||
string argumentName)
|
||||
{
|
||||
if (argumentValue == null)
|
||||
{
|
||||
throw new ArgumentNullException(argumentName);
|
||||
}
|
||||
|
||||
if (argumentValue.Length == 0)
|
||||
{
|
||||
throw new ArgumentException(Resources.ArgumentMustNotBeEmpty, argumentName);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that an argument type is assignable from the provided type (meaning
|
||||
/// interfaces are implemented, or classes exist in the base class hierarchy).
|
||||
/// </summary>
|
||||
/// <param name="assignmentTargetType">The argument type that will be assigned to.</param>
|
||||
/// <param name="assignmentValueType">The type of the value being assigned.</param>
|
||||
/// <param name="argumentName">Argument name.</param>
|
||||
public static void TypeIsAssignable(Type assignmentTargetType, Type assignmentValueType, string argumentName)
|
||||
{
|
||||
if (assignmentTargetType == null)
|
||||
{
|
||||
throw new ArgumentNullException("assignmentTargetType");
|
||||
}
|
||||
|
||||
if (assignmentValueType == null)
|
||||
{
|
||||
throw new ArgumentNullException("assignmentValueType");
|
||||
}
|
||||
|
||||
if (!assignmentTargetType.IsAssignableFrom(assignmentValueType))
|
||||
{
|
||||
throw new ArgumentException(string.Format(
|
||||
CultureInfo.CurrentCulture,
|
||||
Resources.TypesAreNotAssignable,
|
||||
assignmentTargetType,
|
||||
assignmentValueType),
|
||||
argumentName);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that an argument instance is assignable from the provided type (meaning
|
||||
/// interfaces are implemented, or classes exist in the base class hierarchy, or instance can be
|
||||
/// assigned through a runtime wrapper, as is the case for COM Objects).
|
||||
/// </summary>
|
||||
/// <param name="assignmentTargetType">The argument type that will be assigned to.</param>
|
||||
/// <param name="assignmentInstance">The instance that will be assigned.</param>
|
||||
/// <param name="argumentName">Argument name.</param>
|
||||
[SuppressMessage(
|
||||
"Microsoft.Design",
|
||||
"CA1031:DoNotCatchGeneralExceptionTypes",
|
||||
Justification = "GetType() invoked for diagnostics purposes")]
|
||||
public static void InstanceIsAssignable(Type assignmentTargetType, object assignmentInstance, string argumentName)
|
||||
{
|
||||
if (assignmentTargetType == null)
|
||||
{
|
||||
throw new ArgumentNullException("assignmentTargetType");
|
||||
}
|
||||
|
||||
if (assignmentInstance == null)
|
||||
{
|
||||
throw new ArgumentNullException("assignmentInstance");
|
||||
}
|
||||
|
||||
if (!assignmentTargetType.IsInstanceOfType(assignmentInstance))
|
||||
{
|
||||
throw new ArgumentException(
|
||||
string.Format(
|
||||
CultureInfo.CurrentCulture,
|
||||
Resources.TypesAreNotAssignable,
|
||||
assignmentTargetType,
|
||||
GetTypeName(assignmentInstance)),
|
||||
argumentName);
|
||||
}
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes",
|
||||
Justification = "Need to use exception as flow control here, no other choice")]
|
||||
private static string GetTypeName(object assignmentInstance)
|
||||
{
|
||||
string assignmentInstanceType;
|
||||
try
|
||||
{
|
||||
assignmentInstanceType = assignmentInstance.GetType().FullName;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
assignmentInstanceType = Resources.UnknownType;
|
||||
}
|
||||
return assignmentInstanceType;
|
||||
}
|
||||
}
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Net;
|
||||
|
||||
namespace WindowsPhone.Recipes.Push.Messasges
|
||||
{
|
||||
/// <summary>
|
||||
/// Extends the <see cref="HttpWebResponse"/> type with methods for translating push notification specific status codes strings to strong typed enumeration.
|
||||
/// </summary>
|
||||
internal static class HttpWebResponseExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the Notification Status code as <see cref="NotificationStatus"/> enumeration.
|
||||
/// </summary>
|
||||
/// <param name="response">The http web response instance.</param>
|
||||
/// <returns>Correlate enumeration value.</returns>
|
||||
public static NotificationStatus GetNotificationStatus(this HttpWebResponse response)
|
||||
{
|
||||
return response.GetStatus(
|
||||
NotificationStatus.NotApplicable,
|
||||
PushNotificationMessage.Headers.NotificationStatus);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Device Connection Status code as <see cref="NotificationStatus"/> enumeration.
|
||||
/// </summary>
|
||||
/// <param name="response">The http web response instance.</param>
|
||||
/// <returns>Correlate enumeration value.</returns>
|
||||
public static DeviceConnectionStatus GetDeviceConnectionStatus(this HttpWebResponse response)
|
||||
{
|
||||
return response.GetStatus(
|
||||
DeviceConnectionStatus.NotApplicable,
|
||||
PushNotificationMessage.Headers.DeviceConnectionStatus);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Subscription Status code as <see cref="NotificationStatus"/> enumeration.
|
||||
/// </summary>
|
||||
/// <param name="response">The http web response instance.</param>
|
||||
/// <returns>Correlate enumeration value.</returns>
|
||||
public static SubscriptionStatus GetSubscriptionStatus(this HttpWebResponse response)
|
||||
{
|
||||
return response.GetStatus(
|
||||
SubscriptionStatus.NotApplicable,
|
||||
PushNotificationMessage.Headers.SubscriptionStatus);
|
||||
}
|
||||
|
||||
private static T GetStatus<T>(this HttpWebResponse response, T def, string header) where T : struct
|
||||
{
|
||||
string statusString = response.Headers[header];
|
||||
T status = def;
|
||||
Enum.TryParse<T>(statusString, out status);
|
||||
return status;
|
||||
}
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Net;
|
||||
|
||||
using WindowsPhone.Recipes.Push.Messasges.Properties;
|
||||
|
||||
namespace WindowsPhone.Recipes.Push.Messasges
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents errors that occur during push notification message send operation.
|
||||
/// </summary>
|
||||
public class MessageSendException : Exception
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the message send result.
|
||||
/// </summary>
|
||||
public MessageSendResult Result { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of this type.
|
||||
/// </summary>
|
||||
/// <param name="result">The send operation result.</param>
|
||||
/// <param name="innerException">An inner exception causes this error.</param>
|
||||
internal MessageSendException(MessageSendResult result, Exception innerException)
|
||||
: base(Resources.FailedToSendMessage, innerException)
|
||||
{
|
||||
Result = result;
|
||||
}
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace WindowsPhone.Recipes.Push.Messasges
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the priorities of which the Push Notification Service sends the message.
|
||||
/// </summary>
|
||||
public enum MessageSendPriority
|
||||
{
|
||||
/// <value>The message should be delivered by the Push Notification Service immediately.</value>
|
||||
High = 0,
|
||||
|
||||
/// <value>The message should be delivered by the Push Notification Service within 450 seconds.</value>
|
||||
Normal = 1,
|
||||
|
||||
/// <value>The message should be delivered by the Push Notification Service within 900 seconds.</value>
|
||||
Low = 2
|
||||
}
|
||||
}
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Net;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace WindowsPhone.Recipes.Push.Messasges
|
||||
{
|
||||
/// <summary>
|
||||
/// Push notification message send operation result.
|
||||
/// </summary>
|
||||
public class MessageSendResult
|
||||
{
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets the original exception or null.
|
||||
/// </summary>
|
||||
public Exception Exception { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the response time offset.
|
||||
/// </summary>
|
||||
public DateTimeOffset Timestamp { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the associated message.
|
||||
/// </summary>
|
||||
public PushNotificationMessage AssociatedMessage { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the channel URI.
|
||||
/// </summary>
|
||||
public Uri ChannelUri { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the web request status.
|
||||
/// </summary>
|
||||
public HttpStatusCode StatusCode { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the push notification status.
|
||||
/// </summary>
|
||||
public NotificationStatus NotificationStatus { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the device connection status.
|
||||
/// </summary>
|
||||
public DeviceConnectionStatus DeviceConnectionStatus { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the subscription status.
|
||||
/// </summary>
|
||||
public SubscriptionStatus SubscriptionStatus { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Ctor
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of this type.
|
||||
/// </summary>
|
||||
internal MessageSendResult(PushNotificationMessage associatedMessage, Uri channelUri, WebResponse response)
|
||||
{
|
||||
Timestamp = DateTimeOffset.Now;
|
||||
AssociatedMessage = associatedMessage;
|
||||
ChannelUri = channelUri;
|
||||
|
||||
InitializeStatusCodes(response as HttpWebResponse);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of this type.
|
||||
/// </summary>
|
||||
internal MessageSendResult(PushNotificationMessage associatedMessage, Uri channelUri, WebException exception)
|
||||
: this(associatedMessage, channelUri, response: exception.Response)
|
||||
{
|
||||
Exception = exception;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of this type.
|
||||
/// </summary>
|
||||
internal MessageSendResult(PushNotificationMessage associatedMessage, Uri channelUri, Exception exception)
|
||||
: this(associatedMessage, channelUri, response: null)
|
||||
{
|
||||
Exception = exception;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Privates
|
||||
|
||||
private void InitializeStatusCodes(HttpWebResponse response)
|
||||
{
|
||||
if (response == null)
|
||||
{
|
||||
StatusCode = HttpStatusCode.InternalServerError;
|
||||
NotificationStatus = NotificationStatus.NotApplicable;
|
||||
DeviceConnectionStatus = DeviceConnectionStatus.NotApplicable;
|
||||
SubscriptionStatus = SubscriptionStatus.NotApplicable;
|
||||
}
|
||||
else
|
||||
{
|
||||
StatusCode = response.StatusCode;
|
||||
NotificationStatus = response.GetNotificationStatus();
|
||||
DeviceConnectionStatus = response.GetDeviceConnectionStatus();
|
||||
SubscriptionStatus = response.GetSubscriptionStatus();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace WindowsPhone.Recipes.Push.Messasges
|
||||
{
|
||||
/// <summary>
|
||||
/// Microsoft Push Notification Service notification request status.
|
||||
/// </summary>
|
||||
public enum NotificationStatus
|
||||
{
|
||||
/// <value>The request is not applicable.</value>
|
||||
NotApplicable,
|
||||
|
||||
/// <value>The notification request was accepted.</value>
|
||||
Received,
|
||||
|
||||
/// <value>Queue overflow. The Push Notification Service should re-send the notification later.</value>
|
||||
QueueFull,
|
||||
|
||||
/// <value>The push notification was suppressed by the Push Notification Service.</value>
|
||||
Suppressed,
|
||||
|
||||
/// <value>The push notification was dropped by the Push Notification Service.</value>
|
||||
Dropped,
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("NotificationSenderUtility")]
|
||||
[assembly: AssemblyDescription("Class Library to communicate with the Push Notification Service")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft Corp.")]
|
||||
[assembly: AssemblyProduct("Using Push Notifications Hands-on Lab")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("4cb73b37-8cd0-456a-8c69-ea3e6622582b")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.1
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace WindowsPhone.Recipes.Push.Messasges.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WindowsPhone.Recipes.Push.Messasges.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to The provided string argument must not be empty..
|
||||
/// </summary>
|
||||
internal static string ArgumentMustNotBeEmpty {
|
||||
get {
|
||||
return ResourceManager.GetString("ArgumentMustNotBeEmpty", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Count value {0} is not valid. Count value must not be lower than {1} or greater than {2}..
|
||||
/// </summary>
|
||||
internal static string CountValueIsNotValid {
|
||||
get {
|
||||
return ResourceManager.GetString("CountValueIsNotValid", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Failed to send push notification message..
|
||||
/// </summary>
|
||||
internal static string FailedToSendMessage {
|
||||
get {
|
||||
return ResourceManager.GetString("FailedToSendMessage", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to The provided payload must not be null..
|
||||
/// </summary>
|
||||
internal static string PayloadMustNotBeNull {
|
||||
get {
|
||||
return ResourceManager.GetString("PayloadMustNotBeNull", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Payload size is too big. Maximum payload size shouldn't exceed {0} bytes..
|
||||
/// </summary>
|
||||
internal static string PayloadSizeIsTooBig {
|
||||
get {
|
||||
return ResourceManager.GetString("PayloadSizeIsTooBig", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Server returned error status code:{0}..
|
||||
/// </summary>
|
||||
internal static string ServerErrorStatusCode {
|
||||
get {
|
||||
return ResourceManager.GetString("ServerErrorStatusCode", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to The type {1} cannot be assigned to variables of type {0}..
|
||||
/// </summary>
|
||||
internal static string TypesAreNotAssignable {
|
||||
get {
|
||||
return ResourceManager.GetString("TypesAreNotAssignable", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to <unknown>.
|
||||
/// </summary>
|
||||
internal static string UnknownType {
|
||||
get {
|
||||
return ResourceManager.GetString("UnknownType", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+144
@@ -0,0 +1,144 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="ArgumentMustNotBeEmpty" xml:space="preserve">
|
||||
<value>The provided string argument must not be empty.</value>
|
||||
</data>
|
||||
<data name="CountValueIsNotValid" xml:space="preserve">
|
||||
<value>Count value {0} is not valid. Count value must not be lower than {1} or greater than {2}.</value>
|
||||
</data>
|
||||
<data name="FailedToSendMessage" xml:space="preserve">
|
||||
<value>Failed to send push notification message.</value>
|
||||
</data>
|
||||
<data name="PayloadMustNotBeNull" xml:space="preserve">
|
||||
<value>The provided payload must not be null.</value>
|
||||
</data>
|
||||
<data name="PayloadSizeIsTooBig" xml:space="preserve">
|
||||
<value>Payload size is too big. Maximum payload size shouldn't exceed {0} bytes.</value>
|
||||
</data>
|
||||
<data name="ServerErrorStatusCode" xml:space="preserve">
|
||||
<value>Server returned error status code:{0}.</value>
|
||||
</data>
|
||||
<data name="TypesAreNotAssignable" xml:space="preserve">
|
||||
<value>The type {1} cannot be assigned to variables of type {0}.</value>
|
||||
</data>
|
||||
<data name="UnknownType" xml:space="preserve">
|
||||
<value><unknown></value>
|
||||
</data>
|
||||
</root>
|
||||
+388
@@ -0,0 +1,388 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Net;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
|
||||
using WindowsPhone.Recipes.Push.Messasges.Properties;
|
||||
|
||||
namespace WindowsPhone.Recipes.Push.Messasges
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a base class for push notification messages.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This class members are thread safe.
|
||||
/// </remarks>
|
||||
public abstract class PushNotificationMessage
|
||||
{
|
||||
#region Constants
|
||||
|
||||
/// <value>Push notification maximum message size including headers and payload.</value>
|
||||
protected const int MaxMessageSize = 1024;
|
||||
|
||||
/// <summary>
|
||||
/// Well known push notification message web request headers.
|
||||
/// </summary>
|
||||
internal static class Headers
|
||||
{
|
||||
public const string MessageId = "X-MessageID";
|
||||
public const string BatchingInterval = "X-NotificationClass";
|
||||
public const string NotificationStatus = "X-NotificationStatus";
|
||||
public const string DeviceConnectionStatus = "X-DeviceConnectionStatus";
|
||||
public const string SubscriptionStatus = "X-SubscriptionStatus";
|
||||
public const string WindowsPhoneTarget = "X-WindowsPhone-Target";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Fields
|
||||
|
||||
/// <value>Synchronizes payload manipulations.</value>
|
||||
private readonly object _sync = new object();
|
||||
|
||||
/// <value>The payload raw bytes of this message.</value>
|
||||
private byte[] _payload;
|
||||
|
||||
private MessageSendPriority _sendPriority;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets this message unique ID.
|
||||
/// </summary>
|
||||
public Guid Id { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the send priority of this message in the MPNS.
|
||||
/// </summary>
|
||||
public MessageSendPriority SendPriority
|
||||
{
|
||||
get
|
||||
{
|
||||
return _sendPriority;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SafeSet(ref _sendPriority, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the message payload.
|
||||
/// </summary>
|
||||
protected byte[] Payload
|
||||
{
|
||||
get
|
||||
{
|
||||
return _payload;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SafeSet(ref _payload, value);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract int NotificationClassId
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the flag indicating that one of the message properties
|
||||
/// has changed, thus the payload should be rebuilt.
|
||||
/// </summary>
|
||||
private bool IsDirty { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Ctor
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of this type with <see cref="WindowsPhone.Recipes.Push.Messasges.MessageSendPriority.Normal"/> send priority.
|
||||
/// </summary>
|
||||
protected PushNotificationMessage(MessageSendPriority sendPriority = MessageSendPriority.Normal)
|
||||
{
|
||||
Id = Guid.NewGuid();
|
||||
SendPriority = sendPriority;
|
||||
IsDirty = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Operations
|
||||
|
||||
/// <summary>
|
||||
/// Synchronously send this messasge to the destination address.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Note that properties of this instance may be changed by different threads while
|
||||
/// sending, but once the payload created, it won't be changed until the next send.
|
||||
/// </remarks>
|
||||
/// <param name="uri">Destination address uri.</param>
|
||||
/// <exception cref="ArgumentNullException">One of the arguments is null.</exception>
|
||||
/// <exception cref="ArgumentOutOfRangeException">Payload size is out of range. For maximum allowed message size see <see cref="PushNotificationMessage.MaxPayloadSize"/></exception>
|
||||
/// <exception cref="MessageSendException">Failed to send message for any reason.</exception>
|
||||
/// <returns>The result instance with relevant information for this send operation.</returns>
|
||||
public MessageSendResult Send(Uri uri)
|
||||
{
|
||||
Guard.ArgumentNotNull(uri, "uri");
|
||||
|
||||
// Create payload or reuse cached one.
|
||||
var payload = GetOrCreatePayload();
|
||||
|
||||
// Create and initialize the request object.
|
||||
var request = CreateWebRequest(uri, payload);
|
||||
|
||||
var result = SendSynchronously(payload, uri, request);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously send this messasge to the destination address.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This method uses the .NET Thread Pool. Use this method to send one or few
|
||||
/// messages asynchronously. If you have many messages to send, please consider
|
||||
/// of using the synchronous method with custom (external) queue-thread solution.
|
||||
///
|
||||
/// Note that properties of this instance may be changed by different threads while
|
||||
/// sending, but once the payload created, it won't be changed until the next send.
|
||||
/// </remarks>
|
||||
/// <param name="uri">Destination address uri.</param>
|
||||
/// <param name="messageSent">Message sent callback.</param>
|
||||
/// <param name="messageError">Message send error callback.</param>
|
||||
/// <exception cref="ArgumentNullException">One of the arguments is null.</exception>
|
||||
/// <exception cref="ArgumentOutOfRangeException">Payload size is out of range. For maximum allowed message size see <see cref="PushNotificationMessage.MaxPayloadSize"/></exception>
|
||||
public void SendAsync(Uri uri, Action<MessageSendResult> messageSent = null, Action<MessageSendResult> messageError = null)
|
||||
{
|
||||
Guard.ArgumentNotNull(uri, "uri");
|
||||
|
||||
// Create payload or reuse cached one.
|
||||
var payload = GetOrCreatePayload();
|
||||
|
||||
// Create and initialize the request object.
|
||||
var request = CreateWebRequest(uri, payload);
|
||||
|
||||
SendAsynchronously(
|
||||
payload,
|
||||
uri,
|
||||
request,
|
||||
messageSent ?? (result => { }),
|
||||
messageError ?? (result => { }));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Protected & Virtuals
|
||||
|
||||
/// <summary>
|
||||
/// Override to create the message payload.
|
||||
/// </summary>
|
||||
/// <returns>The messasge payload bytes.</returns>
|
||||
protected virtual byte[] OnCreatePayload()
|
||||
{
|
||||
return _payload;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override to initialize the message web request with custom headers.
|
||||
/// </summary>
|
||||
/// <param name="request">The message web request.</param>
|
||||
protected virtual void OnInitializeRequest(HttpWebRequest request)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check the size of the payload and reject it if too big.
|
||||
/// </summary>
|
||||
/// <param name="payload">Payload raw bytes.</param>
|
||||
protected abstract void VerifyPayloadSize(byte[] payload);
|
||||
|
||||
/// <summary>
|
||||
/// Safely set oldValue with newValue in case that are different, and raise the dirty flag.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the value.</typeparam>
|
||||
/// <param name="oldValue">The old value.</param>
|
||||
/// <param name="newValue">The new value.</param>
|
||||
protected void SafeSet<T>(ref T oldValue, T newValue)
|
||||
{
|
||||
lock (_sync)
|
||||
{
|
||||
if (!object.Equals(oldValue, newValue))
|
||||
{
|
||||
oldValue = newValue;
|
||||
IsDirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Privates
|
||||
|
||||
/// <summary>
|
||||
/// Synchronously send this message to the destination uri.
|
||||
/// </summary>
|
||||
/// <param name="payload">The message payload bytes.</param>
|
||||
/// <param name="uri">The message destination uri.</param>
|
||||
/// <param name="payload">Initialized Web request instance.</param>
|
||||
/// <returns>The result instance with relevant information for this send operation.</returns>
|
||||
private MessageSendResult SendSynchronously(byte[] payload, Uri uri, HttpWebRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Get the request stream.
|
||||
using (var requestStream = request.GetRequestStream())
|
||||
{
|
||||
// Start to write the payload to the stream.
|
||||
requestStream.Write(payload, 0, payload.Length);
|
||||
|
||||
// Switch to receiving the response from MPNS.
|
||||
using (var response = (HttpWebResponse)request.GetResponse())
|
||||
{
|
||||
var result = new MessageSendResult(this, uri, response);
|
||||
if (response.StatusCode != HttpStatusCode.OK)
|
||||
{
|
||||
throw new InvalidOperationException(string.Format(Resources.ServerErrorStatusCode, response.StatusCode));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
var result = new MessageSendResult(this, uri, ex);
|
||||
throw new MessageSendException(result, ex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var result = new MessageSendResult(this, uri, ex);
|
||||
throw new MessageSendException(result, ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously send this message to the destination uri using the HttpWebRequest context.
|
||||
/// </summary>
|
||||
/// <param name="payload">The message payload bytes.</param>
|
||||
/// <param name="uri">The message destination uri.</param>
|
||||
/// <param name="payload">Initialized Web request instance.</param>
|
||||
/// <param name="sent">Message sent callback.</param>
|
||||
/// <param name="error">Message send error callback.</param>
|
||||
/// <returns>The result instance with relevant information for this send operation.</returns>
|
||||
private void SendAsynchronously(byte[] payload, Uri uri, HttpWebRequest request, Action<MessageSendResult> sent, Action<MessageSendResult> error)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Get the request stream asynchronously.
|
||||
request.BeginGetRequestStream(requestAsyncResult =>
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var requestStream = request.EndGetRequestStream(requestAsyncResult))
|
||||
{
|
||||
// Start writing the payload to the stream.
|
||||
requestStream.Write(payload, 0, payload.Length);
|
||||
}
|
||||
|
||||
// Switch to receiving the response from MPNS asynchronously.
|
||||
request.BeginGetResponse(responseAsyncResult =>
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var response = (HttpWebResponse)request.EndGetResponse(responseAsyncResult))
|
||||
{
|
||||
var result = new MessageSendResult(this, uri, response);
|
||||
if (response.StatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
sent(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
error(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex3)
|
||||
{
|
||||
error(new MessageSendResult(this, uri, ex3));
|
||||
}
|
||||
}, null);
|
||||
}
|
||||
catch (Exception ex2)
|
||||
{
|
||||
error(new MessageSendResult(this, uri, ex2));
|
||||
}
|
||||
}, null);
|
||||
}
|
||||
catch (Exception ex1)
|
||||
{
|
||||
error(new MessageSendResult(this, uri, ex1));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a payload and verify its size.
|
||||
/// </summary>
|
||||
/// <returns>Payload raw bytes.</returns>
|
||||
private byte[] GetOrCreatePayload()
|
||||
{
|
||||
if (IsDirty)
|
||||
{
|
||||
lock (_sync)
|
||||
{
|
||||
if (IsDirty)
|
||||
{
|
||||
var payload = OnCreatePayload() ?? new byte[0];
|
||||
DebugOutput(payload);
|
||||
VerifyPayloadSize(payload);
|
||||
|
||||
_payload = payload;
|
||||
|
||||
IsDirty = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _payload;
|
||||
}
|
||||
|
||||
private HttpWebRequest CreateWebRequest(Uri uri, byte[] payload)
|
||||
{
|
||||
var request = (HttpWebRequest)WebRequest.Create(uri);
|
||||
request.Method = WebRequestMethods.Http.Post;
|
||||
request.ContentType = "text/xml; charset=utf-8";
|
||||
request.ContentLength = payload.Length;
|
||||
request.Headers[Headers.MessageId] = Id.ToString();
|
||||
|
||||
// Batching interval is composed of the message priority and the message class id.
|
||||
int batchingInterval = ((int)SendPriority * 10) + NotificationClassId;
|
||||
request.Headers[Headers.BatchingInterval] = batchingInterval.ToString();
|
||||
|
||||
OnInitializeRequest(request);
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Diagnostics
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
private static void DebugOutput(byte[] payload)
|
||||
{
|
||||
string payloadString = Encoding.ASCII.GetString(payload);
|
||||
Debug.WriteLine(payloadString);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Net;
|
||||
|
||||
using WindowsPhone.Recipes.Push.Messasges.Properties;
|
||||
|
||||
namespace WindowsPhone.Recipes.Push.Messasges
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a raw push notification message.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If you do not wish to update the tile or send a toast notification, you can instead
|
||||
/// send raw information to your application using a raw notification. If your application
|
||||
/// is not currently running, the raw notification is discarded on the Microsoft Push
|
||||
/// Notification Service and is not delivered to the device.
|
||||
///
|
||||
/// This class members are thread safe.
|
||||
/// </remarks>
|
||||
public sealed class RawPushNotificationMessage : PushNotificationMessage
|
||||
{
|
||||
#region Constants
|
||||
|
||||
/// <value>Calculated raw message headers size.</value>
|
||||
/// <remarks>This should ne updated if changing the protocol.</remarks>
|
||||
private const int RawMessageHeadersSize = 116;
|
||||
|
||||
/// <value>Raw push notification message maximum payload size.</value>
|
||||
public const int MaxPayloadSize = MaxMessageSize - RawMessageHeadersSize;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the message raw data bytes.
|
||||
/// </summary>
|
||||
public byte[] RawData
|
||||
{
|
||||
get
|
||||
{
|
||||
return Payload;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Payload = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raw push notification message class id.
|
||||
/// </summary>
|
||||
protected override int NotificationClassId
|
||||
{
|
||||
get { return 3; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Ctor
|
||||
/// <summary>
|
||||
/// Initializes a new instance of this type.
|
||||
/// </summary>
|
||||
/// <param name="sendPriority">The send priority of this message in the MPNS.</param>
|
||||
public RawPushNotificationMessage(MessageSendPriority sendPriority = MessageSendPriority.Normal)
|
||||
: base(sendPriority)
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Overrides
|
||||
|
||||
protected override void VerifyPayloadSize(byte[] payload)
|
||||
{
|
||||
if (payload.Length > MaxPayloadSize)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(string.Format(Resources.PayloadSizeIsTooBig, MaxPayloadSize));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace WindowsPhone.Recipes.Push.Messasges
|
||||
{
|
||||
/// <summary>
|
||||
/// Push notification channel subscription status.
|
||||
/// </summary>
|
||||
public enum SubscriptionStatus
|
||||
{
|
||||
/// <value>The request is not applicable.</value>
|
||||
NotApplicable,
|
||||
|
||||
/// <value>The subscription is active.</value>
|
||||
Active,
|
||||
|
||||
/// <value>The subscription has expired.</value>
|
||||
Expired
|
||||
}
|
||||
}
|
||||
+182
@@ -0,0 +1,182 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using WindowsPhone.Recipes.Push.Messasges.Properties;
|
||||
|
||||
namespace WindowsPhone.Recipes.Push.Messasges
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a tile push notification message.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Every phone application has one assigned 'tile' – a visual, dynamic
|
||||
/// representation of the application or its content. A tile displays in
|
||||
/// the Start screen if the end user has pinned it.
|
||||
///
|
||||
/// This class members are thread safe.
|
||||
/// </remarks>
|
||||
public sealed class TilePushNotificationMessage : PushNotificationMessage
|
||||
{
|
||||
#region Constants
|
||||
|
||||
/// <value>Calculated tile message headers size.</value>
|
||||
/// <remarks>This should ne updated if changing the protocol.</remarks>
|
||||
private const int TileMessageHeadersSize = 146;
|
||||
|
||||
/// <value>Tile push notification message maximum payload size.</value>
|
||||
public const int MaxPayloadSize = MaxMessageSize - TileMessageHeadersSize;
|
||||
|
||||
/// <value>The minimum <see cref="TilePushNotificationMessage.Count"/> value.</value>
|
||||
public const int MinCount = 0;
|
||||
|
||||
/// <value>The maximum <see cref="TilePushNotificationMessage.Count"/> value.</value>
|
||||
public const int MaxCount = 99;
|
||||
|
||||
/// <value>Windows phone target.</value>
|
||||
private const string WindowsPhoneTarget = "token";
|
||||
|
||||
/// <value>A well formed structure of the tile notification message.</value>
|
||||
private const string PayloadString =
|
||||
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
||||
"<wp:Notification xmlns:wp=\"WPNotification\">" +
|
||||
"<wp:Tile>" +
|
||||
"<wp:BackgroundImage>{0}</wp:BackgroundImage>" +
|
||||
"<wp:Count>{1}</wp:Count>" +
|
||||
"<wp:Title>{2}</wp:Title>" +
|
||||
"</wp:Tile>" +
|
||||
"</wp:Notification>";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Fields
|
||||
|
||||
/// <value>The phone's local path, or a remote path for the background image.</value>
|
||||
private Uri _backgroundImageUri;
|
||||
|
||||
/// <value>An integer value to be displayed in the tile.</value>
|
||||
private int _count = MinCount;
|
||||
|
||||
/// <value>The title text should be displayed in the tile.</value>
|
||||
private string _title;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the phone's local path, or a remote path for the background image.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If the uri references a remote resource, the maximum allowed size of the tile
|
||||
/// image is 80 KB, with a maximum download time of 15 seconds.
|
||||
/// </remarks>
|
||||
public Uri BackgroundImageUri
|
||||
{
|
||||
get
|
||||
{
|
||||
return _backgroundImageUri;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SafeSet(ref _backgroundImageUri, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets an integer value from 1 to 99 to be displayed in the tile, or 0 to clear count.
|
||||
/// </summary>
|
||||
public int Count
|
||||
{
|
||||
get
|
||||
{
|
||||
return _count;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value < MinCount || value > MaxCount)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(string.Format(Resources.CountValueIsNotValid, value, MinCount, MaxCount));
|
||||
}
|
||||
|
||||
SafeSet(ref _count, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the title text should be displayed in the tile. Null keeps the existing title.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The Title must fit a single line of text and should not be wider than the actual tile.
|
||||
/// Imperatively a good number of letters would be 18-20 characters long.
|
||||
/// </remarks>
|
||||
public string Title
|
||||
{
|
||||
get
|
||||
{
|
||||
return _title;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SafeSet(ref _title, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tile push notification message class id.
|
||||
/// </summary>
|
||||
protected override int NotificationClassId
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Ctor
|
||||
/// <summary>
|
||||
/// Initializes a new instance of this type.
|
||||
/// </summary>
|
||||
/// <param name="sendPriority">The send priority of this message in the MPNS.</param>
|
||||
public TilePushNotificationMessage(MessageSendPriority sendPriority = MessageSendPriority.Normal)
|
||||
: base(sendPriority)
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Overrides
|
||||
|
||||
/// <summary>
|
||||
/// Create the tile message payload.
|
||||
/// </summary>
|
||||
/// <returns>The message payload bytes.</returns>
|
||||
protected override byte[] OnCreatePayload()
|
||||
{
|
||||
var payloadString = string.Format(PayloadString, BackgroundImageUri, Count, Title);
|
||||
return Encoding.ASCII.GetBytes(payloadString);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the request with tile specific headers.
|
||||
/// </summary>
|
||||
/// <param name="request">The message request.</param>
|
||||
protected override void OnInitializeRequest(System.Net.HttpWebRequest request)
|
||||
{
|
||||
request.Headers[Headers.WindowsPhoneTarget] = WindowsPhoneTarget;
|
||||
}
|
||||
|
||||
protected override void VerifyPayloadSize(byte[] payload)
|
||||
{
|
||||
if (payload.Length > MaxPayloadSize)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(string.Format(Resources.PayloadSizeIsTooBig, MaxPayloadSize));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
+146
@@ -0,0 +1,146 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Net;
|
||||
|
||||
using WindowsPhone.Recipes.Push.Messasges.Properties;
|
||||
|
||||
namespace WindowsPhone.Recipes.Push.Messasges
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a toast push notification message.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Toast notifications are system-wide notifications that do not disrupt
|
||||
/// the user workflow or require intervention to resolve. They are displayed
|
||||
/// at the top of the screen for ten seconds before disappearing. If the toast
|
||||
/// notification is tapped, the application that sent the toast notification
|
||||
/// will launch. A toast notification can be dismissed with a flick.
|
||||
///
|
||||
/// This class members are thread safe.
|
||||
/// </remarks>
|
||||
public sealed class ToastPushNotificationMessage : PushNotificationMessage
|
||||
{
|
||||
#region Constants
|
||||
|
||||
/// <value>Calculated toast message headers size.</value>
|
||||
/// <remarks>This should ne updated if changing the protocol.</remarks>
|
||||
private const int ToastMessageHeadersSize = 146;
|
||||
|
||||
/// <value>Toast push notification message maximum payload size.</value>
|
||||
public const int MaxPayloadSize = MaxMessageSize - ToastMessageHeadersSize;
|
||||
|
||||
/// <value>Windows phone target.</value>
|
||||
private const string WindowsPhoneTarget = "toast";
|
||||
|
||||
/// <value>A well formed structure of the toast notification message.</value>
|
||||
private const string PayloadString =
|
||||
"<?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>";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Fields
|
||||
|
||||
/// <value>The bolded string that should be displayed immediately after the application icon.</value>
|
||||
private string _title;
|
||||
|
||||
/// <value>The non-bolded string that should be displayed immediately after the Title.</value>
|
||||
private string _subTitle;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a bolded string that should be displayed immediately after the application icon.
|
||||
/// </summary>
|
||||
public string Title
|
||||
{
|
||||
get
|
||||
{
|
||||
return _title;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SafeSet(ref _title, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a non-bolded string that should be displayed immediately after the Title.
|
||||
/// </summary>
|
||||
public string SubTitle
|
||||
{
|
||||
get
|
||||
{
|
||||
return _subTitle;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SafeSet(ref _subTitle, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Toast push notification message class id.
|
||||
/// </summary>
|
||||
protected override int NotificationClassId
|
||||
{
|
||||
get { return 2; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Ctor
|
||||
/// <summary>
|
||||
/// Initializes a new instance of this type.
|
||||
/// </summary>
|
||||
/// <param name="sendPriority">The send priority of this message in the MPNS.</param>
|
||||
public ToastPushNotificationMessage(MessageSendPriority sendPriority = MessageSendPriority.Normal)
|
||||
: base(sendPriority)
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Overrides
|
||||
|
||||
/// <summary>
|
||||
/// Create the toast message payload.
|
||||
/// </summary>
|
||||
/// <returns>The message payload bytes.</returns>
|
||||
protected override byte[] OnCreatePayload()
|
||||
{
|
||||
var payloadString = string.Format(PayloadString, Title, SubTitle);
|
||||
return Encoding.ASCII.GetBytes(payloadString);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the request with toast specific headers.
|
||||
/// </summary>
|
||||
/// <param name="request">The message request.</param>
|
||||
protected override void OnInitializeRequest(HttpWebRequest request)
|
||||
{
|
||||
request.Headers[Headers.WindowsPhoneTarget] = WindowsPhoneTarget;
|
||||
}
|
||||
|
||||
protected override void VerifyPayloadSize(byte[] payload)
|
||||
{
|
||||
if (payload.Length > MaxPayloadSize)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(string.Format(Resources.PayloadSizeIsTooBig, MaxPayloadSize));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{E4691236-9F54-4250-BDBE-916BBB07A378}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>WindowsPhone.Recipes.Push.Messasges</RootNamespace>
|
||||
<AssemblyName>WindowsPhone.Recipes.Push.Messasges</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<SccProjectName>SAK</SccProjectName>
|
||||
<SccLocalPath>SAK</SccLocalPath>
|
||||
<SccAuxPath>SAK</SccAuxPath>
|
||||
<SccProvider>SAK</SccProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DeviceConnectionStatus.cs" />
|
||||
<Compile Include="Guard.cs" />
|
||||
<Compile Include="HttpWebResponseExtensions.cs" />
|
||||
<Compile Include="MessageSendPriority.cs" />
|
||||
<Compile Include="NotificationStatus.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MessageSendException.cs" />
|
||||
<Compile Include="MessageSendResult.cs" />
|
||||
<Compile Include="PushNotificationMessage.cs" />
|
||||
<Compile Include="RawPushNotificationMessage.cs" />
|
||||
<Compile Include="SubscriptionStatus.cs" />
|
||||
<Compile Include="TilePushNotificationMessage.cs" />
|
||||
<Compile Include="ToastPushNotificationMessage.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ClassDiagram.cd" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
Reference in New Issue
Block a user