Example #1
0
        internal async Task <NotificationContext> PushNotificationAsync(
            PushNotificationBuilder builder
            )
        {
            var buildDirector = new PushNotificationBuildDirector(builder);

            if (!buildDirector.BuildNotification())
            {
                return(null);
            }
            var notificationContext = builder.GetNotificationContext();

            if (notificationContext.NotificationRequest == null)
            {
                return(null);
            }
            notificationContext.NotificationResponse.WebResponse =
                await notificationContext.NotificationRequest.WebRequest.GetResponseAsync() as HttpWebResponse;

            return(notificationContext);
        }
Example #2
0
        public NotificationContext PushNotification(GcmPushNotificationBuilder builder)
        {
            var buildDirector = new PushNotificationBuildDirector(builder);

            if (!buildDirector.BuildNotification())
            {
                return(null);
            }
            var notificationContext = builder.GetNotificationContext();

            if (notificationContext.NotificationRequest == null)
            {
                return(null);
            }
            var response = notificationContext.NotificationRequest.WebRequest.GetResponse();

            if (null != notificationContext.NotificationResponse)
            {
                notificationContext.NotificationResponse.WebResponse = (HttpWebResponse)response;
            }
            return(notificationContext);
        }