示例#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
        public static WindowsPhoneToastNotification WithParameter(this WindowsPhoneToastNotification n, string key, string value)
        {
            if (n.Parameters == null)
            {
                n.Parameters = new System.Collections.Specialized.NameValueCollection();
            }

            n.Parameters.Add(key, value);
            return(n);
        }
示例#3
0
 public static WindowsPhoneToastNotification WithText2(this WindowsPhoneToastNotification n, string text2)
 {
     n.Text2 = text2;
     return(n);
 }
示例#4
0
 public static WindowsPhoneToastNotification WithNavigatePath(this WindowsPhoneToastNotification n, string navigatePath)
 {
     n.NavigatePath = navigatePath;
     return(n);
 }
示例#5
0
 public static WindowsPhoneToastNotification ForOSVersion(this WindowsPhoneToastNotification n, WindowsPhoneDeviceOSVersion osVersion)
 {
     n.OSVersion = osVersion;
     return(n);
 }
示例#6
0
 public static WindowsPhoneToastNotification WithBatchingInterval(this WindowsPhoneToastNotification n, BatchingInterval batchingInterval)
 {
     n.NotificationClass = batchingInterval;
     return(n);
 }
示例#7
0
 public static WindowsPhoneToastNotification WithMessageID(this WindowsPhoneToastNotification n, Guid messageID)
 {
     n.MessageID = messageID;
     return(n);
 }
示例#8
0
 public static WindowsPhoneToastNotification WithCallbackUri(this WindowsPhoneToastNotification n, Uri callbackUri)
 {
     n.CallbackURI = callbackUri.ToString();
     return(n);
 }
示例#9
0
 public static WindowsPhoneToastNotification ForEndpointUri(this WindowsPhoneToastNotification n, Uri endpointUri)
 {
     n.EndPointUrl = endpointUri.ToString();
     return(n);
 }
示例#10
0
 public static WindowsPhoneToastNotification WithTag(this WindowsPhoneToastNotification n, object tag)
 {
     n.Tag = tag;
     return(n);
 }