コード例 #1
0
        public bool Send(WindowsPhoneApiNotificationPayLoad payLoad)
        {
            HookEvents(PushBroker);

            try
            {
                PushBroker.RegisterService <WindowsPhoneNotification>(new WindowsPhonePushService());

                var notification = new WindowsPhoneToastNotification()
                                   .ForEndpointUri(new Uri(payLoad.Token))
                                   .ForOSVersion(WindowsPhoneDeviceOSVersion.MangoSevenPointFive)
                                   .WithBatchingInterval(BatchingInterval.Immediate)
                                   .WithNavigatePath(payLoad.NavigationPath)
                                   .WithText1(payLoad.Message)
                                   .WithText2(payLoad.TextMessage2);

                PushBroker.QueueNotification(notification);
            }
            finally
            {
                StopBroker();
            }

            return(true);
        }
コード例 #2
0
        private ApiCallResult ProcessWindowsPhoneNotification(WindowsPhoneApiNotificationPayLoad payLoad)
        {
            var result         = new PushNotificationApiCallResult(false, "Notificaiton failed.", payLoad.DeviceUuid, payLoad.Message);
            var isRequestValid = _SecurityService.ValidateRequestKey(payLoad.AuthenticationKey);

            if (!isRequestValid)
            {
                result.Message = "Invalid Authentication Key";
            }
            else if (_WindowsPhoneService.Send(payLoad))
            {
                result.IsSuccessful = _WindowsPhoneService.Result.IsSuccessful;
                result.Message      = _WindowsPhoneService.Result.Message;
            }

            return(result);
        }
コード例 #3
0
 public ApiCallResult WindowsPhone(WindowsPhoneApiNotificationPayLoad payLoad)
 {
     return(ProcessWindowsPhoneNotification(payLoad));
 }