當前位置: 首頁>>代碼示例>>C#>>正文


C# Pubnub.history方法代碼示例

本文整理匯總了C#中PubNub_Messaging.Pubnub.history方法的典型用法代碼示例。如果您正苦於以下問題:C# Pubnub.history方法的具體用法?C# Pubnub.history怎麽用?C# Pubnub.history使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PubNub_Messaging.Pubnub的用法示例。


在下文中一共展示了Pubnub.history方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Main

        public static void Main()
        {
            Pubnub pubnub = new Pubnub(
            "demo",
            "demo",
            "",
            false
            );
            string channel = "my/channel";
            string message = "Pubnub API Usage Example";

            pubnub.PropertyChanged += new PropertyChangedEventHandler(Pubnub_PropertyChanged);

            Console.WriteLine("UUID -> " + pubnub.generateGUID());

            pubnub.publish(channel, message);

            pubnub.history(channel, 10);

            pubnub.time();

            pubnub.subscribe(channel);

            Console.ReadKey();
        }
開發者ID:inncapsule,項目名稱:CSharpUrlEncodingFix,代碼行數:25,代碼來源:Pubnub_Example.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.objResponse = null;
            pubnub.publish (channel, "Test message", cm.DisplayReturnMessage);

            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:stjom,項目名稱:pubnub-api,代碼行數:46,代碼來源:WhenGetRequestHistoryMessages.cs

示例3: History_Example

 static void History_Example()
 {
     Pubnub pubnub = new Pubnub(
             "demo",
             "demo",
             "",
             false);
     string channel = "hello_world";
     
     pubnub.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e)
     {
         if (e.PropertyName == "History")
         {
             Console.WriteLine("\n*********** History Messages *********** ");
             MessageFeeder(((Pubnub)sender).History);
         }
     };
     pubnub.history(channel, 10);
 }
開發者ID:Vlanta,項目名稱:c-sharp,代碼行數:19,代碼來源:Pubnub_Example.cs

示例4: History_Example

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

            pubnub.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e)
            {
                if (e.PropertyName == "History")
                {
                    foreach (object history_message in ((Pubnub)sender).History)
                    {
                        Console.WriteLine("History Message: ");
                        Dictionary<string, object> _messageHistory = (Dictionary<string, object>)(history_message);
                        Console.WriteLine(_messageHistory["text"]);
                    }
                }
            };
            pubnub.history(channel, 10);
        }
開發者ID:inncapsule,項目名稱:pubnub-api,代碼行數:23,代碼來源:Pubnub_Example.cs

示例5: TestUnencryptedHistory

        public static void TestUnencryptedHistory()
        {
             Pubnub pubnub = new Pubnub(
                    "demo",
                    "demo",
                    "",
                    "",
                    false);
            string channel = "my_channel";
            Common cm = new Common();
            cm.deliveryStatus = false;
            cm.objResponse = 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);
            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.True(message.Equals(pubnub.History[0].ToString()));
            }
        }
開發者ID:stjom,項目名稱:pubnub-api,代碼行數:39,代碼來源:WhenGetRequestHistoryMessages.cs

示例6: TestUnencryptedHistory

        public static void TestUnencryptedHistory()
        {
            Pubnub pubnub = new Pubnub(
                    "demo",
                    "demo",
                    "",
                    "",
                    false);
            string channel = "testchannel";
            //pubnub.CIPHER_KEY = "";

            deliveryStatus = false;
            string message = "Pubnub API Usage Example - Publish";

            pubnub.publish(channel, message, DisplayReturnMessage);
            while (!deliveryStatus) ;
            pubnub.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) {
                if (e.PropertyName == "History")
                {
                    Console.WriteLine("\n*********** History Messages *********** ");
                    deliveryStatus = true;
                }
            };
            pubnub.history(channel, 1);

            deliveryStatus = false;

            while (!deliveryStatus) ;
            Console.WriteLine("\n*********** Publish *********** ");
            if (pubnub.History[0].Equals (null)) {
                Console.WriteLine("Null response");
            }
            else
            {
                Console.WriteLine(pubnub.History[0].ToString());
            }
        }
開發者ID:netcon-source,項目名稱:pubnub-api,代碼行數:37,代碼來源:PubNub-Example2.cs


注:本文中的PubNub_Messaging.Pubnub.history方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。