3
3
using System . Linq ;
4
4
using System . Net ;
5
5
using System . Text ;
6
- using PushSharp . Common ;
6
+ using PushSharp . Core ;
7
7
8
8
namespace PushSharp . WindowsPhone
9
9
{
10
10
public class WindowsPhonePushChannel : PushChannelBase
11
11
{
12
12
WindowsPhonePushChannelSettings windowsPhoneSettings ;
13
13
14
- public WindowsPhonePushChannel ( WindowsPhonePushChannelSettings channelSettings , PushServiceSettings serviceSettings = null ) : base ( channelSettings , serviceSettings )
14
+ public WindowsPhonePushChannel ( PushServiceBase pushService ) : base ( pushService )
15
15
{
16
- windowsPhoneSettings = channelSettings ;
16
+ windowsPhoneSettings = pushService . ChannelSettings as WindowsPhonePushChannelSettings ;
17
17
}
18
18
19
- public override PlatformType PlatformType
20
- {
21
- get { return Common . PlatformType . WindowsPhone ; }
22
- }
23
-
24
- protected override void SendNotification ( Notification notification )
19
+ public override void SendNotification ( Notification notification )
25
20
{
26
21
var wpNotification = notification as WindowsPhoneNotification ;
27
22
@@ -41,9 +36,9 @@ protected override void SendNotification(Notification notification)
41
36
slowValue = 22 ;
42
37
}
43
38
else if ( wpNotification is WindowsPhoneTileNotification ||
44
- wpNotification is WindowsPhoneCycleTile ||
45
- wpNotification is WindowsPhoneFlipTile ||
46
- wpNotification is WindowsPhoneIconicTile )
39
+ wpNotification is WindowsPhoneCycleTileNotification ||
40
+ wpNotification is WindowsPhoneFlipTileNotification ||
41
+ wpNotification is WindowsPhoneIconicTileNotification )
47
42
{
48
43
immediateValue = 1 ;
49
44
mediumValue = 11 ;
@@ -65,9 +60,9 @@ wpNotification is WindowsPhoneFlipTile ||
65
60
if ( wpNotification is WindowsPhoneToastNotification )
66
61
wr . Headers . Add ( "X-WindowsPhone-Target" , "toast" ) ;
67
62
else if ( wpNotification is WindowsPhoneTileNotification ||
68
- wpNotification is WindowsPhoneCycleTile ||
69
- wpNotification is WindowsPhoneFlipTile ||
70
- wpNotification is WindowsPhoneIconicTile )
63
+ wpNotification is WindowsPhoneCycleTileNotification ||
64
+ wpNotification is WindowsPhoneFlipTileNotification ||
65
+ wpNotification is WindowsPhoneIconicTileNotification )
71
66
wr . Headers . Add ( "X-WindowsPhone-Target" , "token" ) ;
72
67
73
68
if ( wpNotification . MessageID != null )
@@ -153,19 +148,19 @@ void HandleStatus(WindowsPhoneMessageStatus status, WindowsPhoneNotification not
153
148
{
154
149
if ( status . SubscriptionStatus == WPSubscriptionStatus . Expired )
155
150
{
156
- this . Events . RaiseDeviceSubscriptionExpired ( PlatformType . WindowsPhone , notification . EndPointUrl , notification ) ;
157
- this . Events . RaiseNotificationSendFailure ( notification , new WindowsPhoneNotificationSendFailureException ( status ) ) ;
151
+ this . Events . RaiseDeviceSubscriptionExpired ( this , notification . EndPointUrl , notification ) ;
152
+ this . Events . RaiseNotificationSendFailure ( this , notification , new WindowsPhoneNotificationSendFailureException ( status ) ) ;
158
153
return ;
159
154
}
160
155
161
156
if ( status . HttpStatus == HttpStatusCode . OK
162
157
&& status . NotificationStatus == WPNotificationStatus . Received )
163
158
{
164
- this . Events . RaiseNotificationSent ( status . Notification ) ;
159
+ this . Events . RaiseNotificationSent ( this , status . Notification ) ;
165
160
return ;
166
161
}
167
162
168
- this . Events . RaiseNotificationSendFailure ( status . Notification , new WindowsPhoneNotificationSendFailureException ( status ) ) ;
163
+ this . Events . RaiseNotificationSendFailure ( this , status . Notification , new WindowsPhoneNotificationSendFailureException ( status ) ) ;
169
164
}
170
165
}
171
166
}
0 commit comments