Exemple #1
0
        public void SerializerFlipTilePushNotificationTest()
        {
            var msg = PushNotification
                      .Broadcast("This is a test message.")
                      .WithBadge("+1")
                      .WithExpiry(100000)
                      .WithPlatformOptions(new IOsOptions {
                SoundFile = "soundfile"
            })
                      .WithPlatformOptions(new AndroidOptions {
                NotificationTitle = "title"
            })
                      .WithPlatformOptions(
                new WindowsPhoneOptions
            {
                Notification = TileNotification.CreateNewFlipTile(
                    new FlipTile
                {
                    BackBackgroundImage  = "bbimage",
                    BackContent          = "back content",
                    BackTitle            = "back title",
                    FrontBackgroundImage = "fbi",
                    FrontCount           = "front count",
                    FrontTitle           = "front title",
                    SmallBackgroundImage = "sbi",
                    TileId = "tileid",
                    WideBackBackgroundImage = "wbi",
                    WideBackContent         = "wbc",
                    WideBackgroundImage     = "wbi"
                })
            });
            var serializer = ObjectFactory.Build <IJsonSerializer>();

            Console.WriteLine(Encoding.UTF8.GetString(serializer.Serialize(msg)));
        }
Exemple #2
0
        public void SerializerToastMessageTest()
        {
            var msg = PushNotification
                      .Broadcast("This is a test message.")
                      .WithBadge("+1")
                      .WithExpiry(100000)
                      .WithPlatformOptions(new IOsOptions {
                SoundFile = "soundfile"
            })
                      .WithPlatformOptions(new AndroidOptions {
                NotificationTitle = "title"
            })
                      .WithPlatformOptions(
                new WindowsPhoneOptions
            {
                Notification = new ToastNotification
                {
                    Text1 = "text1",
                    Text2 = "text2",
                    Path  = "path"
                }
            });
            var serializer = ObjectFactory.Build <IJsonSerializer>();

            Console.WriteLine(Encoding.UTF8.GetString(serializer.Serialize(msg)));
        }
Exemple #3
0
        public async Task BroadcastPushAsyncTest()
        {
            string id = await PushNotification
                        .Broadcast("Push from .NET SDK")
                        .WithBadge("+1")
                        .WithData(new { field1 = "value1", field2 = "value2" })
                        .SendAsync();

            Console.WriteLine("Send push notification with id {0}.", id);
        }
Exemple #4
0
        public void SerializerRawPushNotificationTest()
        {
            var msg = PushNotification
                      .Broadcast("This is a test message.")
                      .WithBadge("+1")
                      .WithExpiry(100000)
                      .WithPlatformOptions(new IOsOptions {
                SoundFile = "soundfile"
            })
                      .WithPlatformOptions(new AndroidOptions {
                NotificationTitle = "title"
            })
                      .WithPlatformOptions(
                new WindowsPhoneOptions
            {
                Notification = new RawNotification
                {
                    RawData = "raw string data.."
                }
            });
            var serializer = ObjectFactory.Build <IJsonSerializer>();

            Console.WriteLine(Encoding.UTF8.GetString(serializer.Serialize(msg)));
        }