static public void test_history()
        {
            pubnub.ResponseCallback histCallback = delegate(object response)
            {
                List <object> result = (List <object>)response;
                Debug.WriteLine("[History data]");
                foreach (object data in result)
                {
                    Debug.WriteLine(data);
                }
            };

            // Initialize pubnub state
            pubnub objPubnub = new pubnub(
                "demo",  // PUBLISH_KEY
                "demo",  // SUBSCRIBE_KEY
                "demo",  // SECRET_KEY
                "",      // CIPHER_KEY   (Cipher key is Optional)
                false    // SSL_ON?
                );

            //define channel
            string channel = "hello-world";

            // History
            Dictionary <string, object> argsHist = new Dictionary <string, object>();

            argsHist.Add("channel", channel);
            argsHist.Add("limit", 3.ToString());
            argsHist.Add("callback", histCallback);
            objPubnub.History(argsHist);
        }
示例#2
0
        private void History_Click(object sender, RoutedEventArgs e)
        {
            pubnub.ResponseCallback respCallback = delegate(object response)
            {
                List <object> result = (List <object>)response;
                UIThread.Invoke(() =>
                {
                    if (result != null && result.Count() > 0)
                    {
                        histMessages.Visibility = Visibility.Visible;
                        for (int i = 0; i < result.Count(); i++)
                        {
                            if (!(lHistory.Items.Contains(result[i].ToString())))
                            {
                                lHistory.Items.Add(result[i].ToString());
                            }
                        }
                    }
                });
            };

            Dictionary <string, object> args = new Dictionary <string, object>();

            args.Add("channel", channel);
            args.Add("limit", 3.ToString());
            args.Add("callback", respCallback);
            objPubnub.History(args);
        }
        public static void test_history()
        {
            pubnub.ResponseCallback histCallback = delegate(object response)
            {
                List<object> result = (List<object>)response;
                Debug.WriteLine("[History data]");
                foreach (object data in result)
                {
                    Debug.WriteLine(data);
                }
            };

            // Initialize pubnub state
            pubnub objPubnub = new pubnub(
                "demo",  // PUBLISH_KEY
                "demo",  // SUBSCRIBE_KEY
                "demo",  // SECRET_KEY
                "",      // CIPHER_KEY   (Cipher key is Optional)
                false    // SSL_ON?
            );

            //define channel
            string channel = "hello-world";

            // History
            Dictionary<string, object> argsHist = new Dictionary<string, object>();
            argsHist.Add("channel", channel);
            argsHist.Add("limit", 3.ToString());
            argsHist.Add("callback", histCallback);
            objPubnub.History(argsHist);
        }