@@ -39,8 +39,7 @@ apnsBroker.OnNotificationFailed += (notification, aggregateEx) => {
39
39
aggregateEx .Handle (ex => {
40
40
41
41
// See what kind of exception it was to further diagnose
42
- if (ex is ApnsNotificationException ) {
43
- var notificationException = (ApnsNotificationException )ex ;
42
+ if (ex is ApnsNotificationException notificationException ) {
44
43
45
44
// Deal with the failed notification
46
45
var apnsNotification = notificationException .Notification ;
@@ -120,16 +119,14 @@ gcmBroker.OnNotificationFailed += (notification, aggregateEx) => {
120
119
aggregateEx .Handle (ex => {
121
120
122
121
// See what kind of exception it was to further diagnose
123
- if (ex is GcmNotificationException ) {
124
- var notificationException = (GcmNotificationException )ex ;
122
+ if (ex is GcmNotificationException notificationException ) {
125
123
126
124
// Deal with the failed notification
127
125
var gcmNotification = notificationException .Notification ;
128
126
var description = notificationException .Description ;
129
127
130
128
Console .WriteLine ($" GCM Notification Failed: ID={gcmNotification .MessageId }, Desc={description }" );
131
- } else if (ex is GcmMulticastResultException ) {
132
- var multicastException = (GcmMulticastResultException )ex ;
129
+ } else if (ex is GcmMulticastResultException multicastException ) {
133
130
134
131
foreach (var succeededNotification in multicastException .Succeeded ) {
135
132
Console .WriteLine ($" GCM Notification Succeeded: ID={succeededNotification .MessageId }" );
@@ -142,8 +139,7 @@ gcmBroker.OnNotificationFailed += (notification, aggregateEx) => {
142
139
Console .WriteLine ($" GCM Notification Failed: ID={n .MessageId }, Desc={e .Description }" );
143
140
}
144
141
145
- } else if (ex is DeviceSubscriptionExpiredException ) {
146
- var expiredException = (DeviceSubscriptionExpiredException )ex ;
142
+ } else if (ex is DeviceSubscriptionExpiredException expiredException ) {
147
143
148
144
var oldId = expiredException .OldSubscriptionId ;
149
145
var newId = expiredException .NewSubscriptionId ;
@@ -154,8 +150,8 @@ gcmBroker.OnNotificationFailed += (notification, aggregateEx) => {
154
150
// If this value isn't null, our subscription changed and we should update our database
155
151
Console .WriteLine ($" Device RegistrationId Changed To: {newId }" );
156
152
}
157
- } else if (ex is RetryAfterException ) {
158
- var retryException = ( RetryAfterException ) ex ;
153
+ } else if (ex is RetryAfterException retryException ) {
154
+
159
155
// If you get rate limited, you should stop sending messages until after the RetryAfterUtc date
160
156
Console .WriteLine ($" GCM Rate Limited, don't send more until after {retryException .RetryAfterUtc }" );
161
157
} else {
@@ -212,8 +208,7 @@ wnsBroker.OnNotificationFailed += (notification, aggregateEx) => {
212
208
aggregateEx .Handle (ex => {
213
209
214
210
// See what kind of exception it was to further diagnose
215
- if (ex is WnsNotificationException ) {
216
- var notificationException = (WnsNotificationException )ex ;
211
+ if (ex is WnsNotificationException notificationException ) {
217
212
Console .WriteLine ($" WNS Notification Failed: {notificationException .Message }" );
218
213
} else {
219
214
Console .WriteLine (" WNS Notification Failed for some (Unknown Reason)" );
0 commit comments