forked from Redth/PushSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWindowsPhonePushService.cs
46 lines (40 loc) · 1.61 KB
/
WindowsPhonePushService.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PushSharp.Core;
namespace PushSharp.WindowsPhone
{
public class WindowsPhonePushService : PushServiceBase
{
public WindowsPhonePushService()
: this(default(IPushChannelFactory), null, default(IPushServiceSettings))
{
}
public WindowsPhonePushService(WindowsPhonePushChannelSettings channelSettings)
: this(default(IPushChannelFactory), channelSettings, default(IPushServiceSettings))
{
}
public WindowsPhonePushService(WindowsPhonePushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
: this(default(IPushChannelFactory), channelSettings, serviceSettings)
{
}
public WindowsPhonePushService(IPushChannelFactory pushChannelFactory, WindowsPhonePushChannelSettings channelSettings)
: this(pushChannelFactory, channelSettings, default(IPushServiceSettings))
{
}
public WindowsPhonePushService(IPushChannelFactory pushChannelFactory, WindowsPhonePushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
: base(pushChannelFactory ?? new WindowsPhonePushChannelFactory(), channelSettings ?? new WindowsPhonePushChannelSettings(), serviceSettings)
{
}
}
public class WindowsPhonePushChannelFactory : IPushChannelFactory
{
public IPushChannel CreateChannel(IPushChannelSettings channelSettings)
{
if (!(channelSettings is WindowsPhonePushChannelSettings))
throw new ArgumentException("channelSettings must be of type WindowsPhonePushChannelSettings");
return new WindowsPhonePushChannel(channelSettings as WindowsPhonePushChannelSettings);
}
}
}