当前位置: 首页>>代码示例>>C#>>正文


C# Pubnub.history方法代码示例

本文整理汇总了C#中Pubnub.history方法的典型用法代码示例。如果您正苦于以下问题:C# Pubnub.history方法的具体用法?C# Pubnub.history怎么用?C# Pubnub.history使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pubnub的用法示例。


在下文中一共展示了Pubnub.history方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ThenItShouldReturnHistoryMessages

        public void ThenItShouldReturnHistoryMessages()
        {
            Pubnub pubnub = new Pubnub(
                "demo",
                "demo",
                "",
                false
            );
            string channel = "my/channel";

            pubnub.PropertyChanged += new PropertyChangedEventHandler(Pubnub_PropertyChanged);

            pubnub.history(channel, 1);
        }
开发者ID:netcon-source,项目名称:pubnub-api,代码行数:14,代码来源:WhenGetRequestHistoryMessage.cs

示例2: ThenItShouldReturnHistoryMessages

        public void ThenItShouldReturnHistoryMessages ()
        {
            Pubnub pubnub = new Pubnub (
                "demo",
                "demo",
                "",
                "",
                false
            );
            string channel = "hello_world";
            bool responseStatus = false;
            //publish a test message.
            Common cm = new Common();
            cm.DeliveryStatus = false;
            cm.Response = null;
            pubnub.Publish (channel, "Test message", cm.DisplayReturnMessage, cm.DisplayErrorMessage);

            List<object> lstHistory = null;

            pubnub.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) {
                if (e.PropertyName == "History")
                {
                    lstHistory = ((Pubnub)sender).History;
           
                    responseStatus = true;
                }
            };

            pubnub.history(channel, 1);

            /*while (!responseStatus) ;

            string strResponse = "";
            if (lstHistory.Equals (null)) {
                Assert.Fail("Null response");
            }
            else
            {
                foreach(object lst in lstHistory)
                {
                    strResponse = lst.ToString();
                    Console.WriteLine("resp:" + strResponse);
                    Assert.IsNotEmpty(strResponse);
                }
            }*/
        }
开发者ID:RecursosOnline,项目名称:c-sharp,代码行数:46,代码来源:WhenGetRequestHistoryMessages.cs

示例3: TestUnencryptedHistory

        public static void TestUnencryptedHistory()
        {
             Pubnub pubnub = new Pubnub(
                    "demo",
                    "demo",
                    "",
                    "",
                    false);
            string channel = "my_channel";
            Common cm = new Common();
            cm.DeliveryStatus = false;
            cm.Response = null;

            string message = "Pubnub API Usage Example - Publish";
            //pubnub.CIPHER_KEY = "enigma";

            pubnub.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e)
            {
                if (e.PropertyName == "History")
                {
                    Console.WriteLine("\n*********** History Messages *********** ");
                    cm.DeliveryStatus = true;
                }
            };
            cm.DeliveryStatus = false;
            pubnub.Publish(channel, message, cm.DisplayReturnMessage, cm.DisplayErrorMessage);
            while (!cm.DeliveryStatus) ;

            cm.DeliveryStatus = false;
            pubnub.history(channel, 1);
            while (!cm.DeliveryStatus) ;
            if (pubnub.History[0].Equals (null)) {
                Assert.Fail("Null response");
            }
            else
            {
                Assert.AreEqual(message, pubnub.History[0].ToString());
            }
        }
开发者ID:RecursosOnline,项目名称:c-sharp,代码行数:39,代码来源:WhenGetRequestHistoryMessages.cs


注:本文中的Pubnub.history方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。