Exemplo n.º 1
0
        private void Publish_Click(object sender, RoutedEventArgs e)
        {
            CheckUserInputs();
            channel = txtChannel.Text;

            PublishMessageDialog publishView = new PublishMessageDialog();

            publishView.Show();

            publishView.Closed += (obj, args) =>
            {
                if (publishView.DialogResult == true && publishView.Message.Text.Length > 0)
                {
                    Console.WriteLine("Running publish()");

                    string publishedMessage = publishView.Message.Text;
                    bool   storeInHistory   = publishView.chkStoreInHistory.IsChecked.Value;
                    if (authKey.Trim() != "")
                    {
                        pubnub.AuthenticationKey = authKey;
                    }
                    pubnub.Publish <string>(channel, publishedMessage, storeInHistory, DisplayUserCallbackMessage, DisplayErrorMessage);
                }
            };
        }
Exemplo n.º 2
0
        private void Publish_Click(object sender, RoutedEventArgs e)
        {
            CheckUserInputs();
            channel = txtChannel.Text;
            Console.WriteLine("Running publish()");

            PublishMessageDialog publishView = new PublishMessageDialog();

            publishView.Show();

            publishView.Closed += (obj, args) =>
            {
                if (publishView.DialogResult == true && publishView.Message.Text.Length > 0)
                {
                    string publishedMessage = publishView.Message.Text;
                    pubnub.Publish <string>(channel, publishedMessage, DisplayUserCallbackMessage);
                }
            };
        }
Exemplo n.º 3
0
        private void Publish_Click(object sender, RoutedEventArgs e)
        {
            CheckUserInputs();
            channel = txtChannel.Text;
            Console.WriteLine("Running publish()");

            PublishMessageDialog publishView = new PublishMessageDialog();

            publishView.Show();

            publishView.Closed += (obj, args) => 
            {
                if (publishView.DialogResult == true && publishView.Message.Text.Length > 0)
                {
                    string publishedMessage = publishView.Message.Text;
                    pubnub.Publish<string>(channel, publishedMessage, DisplayUserCallbackMessage, DisplayErrorMessage);
                }
            };
        }
Exemplo n.º 4
0
        private void Publish_Click(object sender, RoutedEventArgs e)
        {
            CheckUserInputs();
            channel = txtChannel.Text;

            PublishMessageDialog publishView = new PublishMessageDialog();

            publishView.Show();

            publishView.Closed += (obj, args) =>
            {
                if (publishView.radNormalPublish.IsChecked.Value)
                {
                    if (publishView.DialogResult == true && publishView.Message.Text.Length > 0)
                    {
                        Console.WriteLine("Running publish()");

                        string publishedMessage = publishView.Message.Text;
                        bool   storeInHistory   = publishView.chkStoreInHistory.IsChecked.Value;
                        if (authKey.Trim() != "")
                        {
                            pubnub.AuthenticationKey = authKey;
                        }
                        pubnub.Publish <string>(channel, publishedMessage, storeInHistory, DisplayUserCallbackMessage, DisplayErrorMessage);
                    }
                }
                else if (publishView.radToastPublish.IsChecked.Value)
                {
                    MpnsToastNotification toast = new MpnsToastNotification();
                    //toast.type = "toast";
                    toast.text1 = "hardcode message";
                    Dictionary <string, object> dicToast = new Dictionary <string, object>();
                    dicToast.Add("pn_mpns", toast);

                    pubnub.EnableDebugForPushPublish = true;
                    pubnub.Publish <string>(channel, dicToast, DisplayUserCallbackMessage, DisplayErrorMessage);
                }
                else if (publishView.radFlipTilePublish.IsChecked.Value)
                {
                    pubnub.PushRemoteImageDomainUri.Add(new Uri("http://cdn.flaticon.com"));

                    MpnsFlipTileNotification tile = new MpnsFlipTileNotification();
                    tile.title                 = "front title";
                    tile.count                 = 6;
                    tile.back_title            = "back title";
                    tile.back_content          = "back message";
                    tile.back_background_image = "Assets/Tiles/pubnub3.png";
                    tile.background_image      = "http://cdn.flaticon.com/png/256/37985.png";
                    Dictionary <string, object> dicTile = new Dictionary <string, object>();
                    dicTile.Add("pn_mpns", tile);

                    pubnub.EnableDebugForPushPublish = true;
                    pubnub.Publish <string>(channel, dicTile, DisplayUserCallbackMessage, DisplayErrorMessage);
                }
                else if (publishView.radCycleTilePublish.IsChecked.Value)
                {
                    MpnsCycleTileNotification tile = new MpnsCycleTileNotification();
                    tile.title  = "front title";
                    tile.count  = 2;
                    tile.images = new string[] { "Assets/Tiles/pubnub1.png", "Assets/Tiles/pubnub2.png", "Assets/Tiles/pubnub3.png", "Assets/Tiles/pubnub4.png" };

                    Dictionary <string, object> dicTile = new Dictionary <string, object>();
                    dicTile.Add("pn_mpns", tile);

                    pubnub.EnableDebugForPushPublish = true;
                    pubnub.Publish <string>(channel, dicTile, DisplayUserCallbackMessage, DisplayErrorMessage);
                }
                else if (publishView.radIconicTilePublish.IsChecked.Value)
                {
                    MpnsIconicTileNotification tile = new MpnsIconicTileNotification();
                    tile.title          = "front title";
                    tile.count          = 2;
                    tile.wide_content_1 = "my wide content";

                    Dictionary <string, object> dicTile = new Dictionary <string, object>();
                    dicTile.Add("pn_mpns", tile);

                    pubnub.EnableDebugForPushPublish = true;
                    pubnub.Publish <string>(channel, dicTile, DisplayUserCallbackMessage, DisplayErrorMessage);
                }
            };
        }
        private void Publish_Click(object sender, RoutedEventArgs e)
        {
            CheckUserInputs();
            channel = txtChannel.Text;

            PublishMessageDialog publishView = new PublishMessageDialog();

            publishView.Show();

            publishView.Closed += (obj, args) =>
            {
                if (publishView.radNormalPublish.IsChecked.Value)
                {
                    if (publishView.DialogResult == true && publishView.Message.Text.Length > 0)
                    {
                        Console.WriteLine("Running publish()");

                        string publishedMessage = publishView.Message.Text;
                        bool storeInHistory = publishView.chkStoreInHistory.IsChecked.Value;
                        if (authKey.Trim() != "")
                        {
                            pubnub.AuthenticationKey = authKey;
                        }
                        pubnub.Publish<string>(channel, publishedMessage, storeInHistory, DisplayUserCallbackMessage, DisplayErrorMessage);
                    }
                }
                else if (publishView.radToastPublish.IsChecked.Value)
                {
                    MpnsToastNotification toast = new MpnsToastNotification();
                    //toast.type = "toast";
                    toast.text1 = "hardcode message";
                    Dictionary<string, object> dicToast = new Dictionary<string, object>();
                    dicToast.Add("pn_mpns", toast);

                    pubnub.EnableDebugForPushPublish = true;
                    pubnub.Publish<string>(channel, dicToast, DisplayUserCallbackMessage, DisplayErrorMessage);
                }
                else if (publishView.radFlipTilePublish.IsChecked.Value)
                {
                    pubnub.PushRemoteImageDomainUri.Add(new Uri("http://cdn.flaticon.com"));

                    MpnsFlipTileNotification tile = new MpnsFlipTileNotification();
                    tile.title = "front title";
                    tile.count = 6;
                    tile.back_title = "back title";
                    tile.back_content = "back message";
                    tile.back_background_image = "Assets/Tiles/pubnub3.png";
                    tile.background_image = "http://cdn.flaticon.com/png/256/37985.png";
                    Dictionary<string, object> dicTile = new Dictionary<string, object>();
                    dicTile.Add("pn_mpns", tile);

                    pubnub.EnableDebugForPushPublish = true;
                    pubnub.Publish<string>(channel, dicTile, DisplayUserCallbackMessage, DisplayErrorMessage);
                }
                else if (publishView.radCycleTilePublish.IsChecked.Value)
                {
                    MpnsCycleTileNotification tile = new MpnsCycleTileNotification();
                    tile.title = "front title";
                    tile.count = 2;
                    tile.images = new string[] { "Assets/Tiles/pubnub1.png", "Assets/Tiles/pubnub2.png", "Assets/Tiles/pubnub3.png", "Assets/Tiles/pubnub4.png" };

                    Dictionary<string, object> dicTile = new Dictionary<string, object>();
                    dicTile.Add("pn_mpns", tile);

                    pubnub.EnableDebugForPushPublish = true;
                    pubnub.Publish<string>(channel, dicTile, DisplayUserCallbackMessage, DisplayErrorMessage);
                }
                else if (publishView.radIconicTilePublish.IsChecked.Value)
                {
                    MpnsIconicTileNotification tile = new MpnsIconicTileNotification();
                    tile.title = "front title";
                    tile.count = 2;
                    tile.wide_content_1 = "my wide content";

                    Dictionary<string, object> dicTile = new Dictionary<string, object>();
                    dicTile.Add("pn_mpns", tile);

                    pubnub.EnableDebugForPushPublish = true;
                    pubnub.Publish<string>(channel, dicTile, DisplayUserCallbackMessage, DisplayErrorMessage);
                }

            };
        }