本文整理汇总了C#中PubNub_Messaging.Pubnub.time方法的典型用法代码示例。如果您正苦于以下问题:C# Pubnub.time方法的具体用法?C# Pubnub.time怎么用?C# Pubnub.time使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PubNub_Messaging.Pubnub
的用法示例。
在下文中一共展示了Pubnub.time方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ThenItShouldReturnTimeStamp
public void ThenItShouldReturnTimeStamp()
{
Pubnub pubnub = new Pubnub(
"demo",
"demo",
"",
"",
false
);
PubnubUnitTest unitTest = new PubnubUnitTest();
unitTest.TestClassName = "WhenGetRequestServerTime";
unitTest.TestCaseName = "ThenItShouldReturnTimeStamp";
pubnub.PubnubUnitTest = unitTest;
string strResponse = "";
Common cm = new Common();
cm.deliveryStatus = false;
cm.objResponse = null;
pubnub.time(cm.DisplayReturnMessage);
//cm.objResponse = null;
while (!cm.deliveryStatus) ;
IList<object> fields = cm.objResponse as IList<object>;
strResponse = fields[0].ToString();
Console.WriteLine("Resp:" + strResponse);
Assert.AreNotEqual("0",strResponse);
}
示例2: 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();
}
示例3: ThenItShouldReturnTimeStamp
public void ThenItShouldReturnTimeStamp()
{
Pubnub pubnub = new Pubnub("demo", "demo", "", "", false);
EnqueueCallback(() => pubnub.time<string>(ReturnTimeStampCallback));
EnqueueConditional(() => isTimeStamp);
EnqueueCallback(() => Assert.IsTrue(timeReceived, "time() Failed"));
EnqueueTestComplete();
}
示例4: ThenItShouldReturnTimeStamp
public void ThenItShouldReturnTimeStamp()
{
Pubnub pubnub = new Pubnub(
"demo",
"demo",
"",
"",
false
);
string strResponse = "";
Common cm = new Common();
cm.deliveryStatus = false;
cm.objResponse = null;
pubnub.time(cm.DisplayReturnMessage);
cm.objResponse = null;
while (!cm.deliveryStatus) ;
IList<object> fields = cm.objResponse as IList<object>;
strResponse = fields[0].ToString();
Console.WriteLine(strResponse);
Assert.AreNotEqual("0",strResponse);
}
示例5: Timestamp_Example
static void Timestamp_Example()
{
Pubnub pubnub = new Pubnub(
"demo",
"demo",
"",
false);
pubnub.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == "Time")
{
Console.WriteLine("\n********** Timestamp Messages ********** ");
MessageFeeder(((Pubnub)sender).Time[0]);
}
};
pubnub.time();
}
示例6: Main
static public void Main()
{
Console.WriteLine("HINT: TO TEST RE-CONNECT AND CATCH-UP,");
Console.WriteLine(" DISCONNECT YOUR MACHINE FROM NETWORK/INTERNET AND ");
Console.WriteLine(" RE-CONNECT YOUR MACHINE AFTER SOMETIME.");
Console.WriteLine();
Console.WriteLine(" IF NO NETWORK BEFORE MAX RE-TRY CONNECT,");
Console.WriteLine(" NETWORK ERROR MESSAGE WILL BE SENT");
Console.WriteLine();
Console.WriteLine("ENTER Channel Name");
channel = Console.ReadLine();
Console.WriteLine(string.Format("Channel = {0}",channel));
Console.WriteLine();
Console.WriteLine("Enable SSL? ENTER Y for Yes, else N");
string enableSSL = Console.ReadLine();
if (enableSSL.Trim().ToLower() == "y")
{
Console.WriteLine("SSL Enabled");
}
else
{
Console.WriteLine("SSL NOT Enabled");
}
Console.WriteLine();
Console.WriteLine("ENTER cipher key for encryption feature.");
Console.WriteLine("If you don't want to avail at this time, press ENTER.");
string cipheryKey = Console.ReadLine();
if (cipheryKey.Trim().Length > 0)
{
Console.WriteLine("Cipher key provided.");
}
else
{
Console.WriteLine("No Cipher key provided");
}
Console.WriteLine();
pubnub = new Pubnub("demo", "demo", "", cipheryKey,
(enableSSL.Trim().ToLower() == "y") ? true : false);
Console.WriteLine("ENTER 1 FOR Subscribe (not implementing connectCallback)");
Console.WriteLine("ENTER 2 FOR Subscribe (implementing connectCallback)");
Console.WriteLine("ENTER 3 FOR Publish");
Console.WriteLine("ENTER 4 FOR Presence");
Console.WriteLine("ENTER 5 FOR Detailed History");
Console.WriteLine("ENTER 6 FOR Here_Now");
Console.WriteLine("ENTER 7 FOR Unsubscribe");
Console.WriteLine("ENTER 8 FOR Presence-Unsubscribe");
Console.WriteLine("ENTER 9 FOR Time");
Console.WriteLine("ENTER 0 FOR EXIT OR QUIT");
bool exitFlag = false;
Console.WriteLine("");
while (!exitFlag)
{
string userinput = Console.ReadLine();
switch (userinput)
{
case "0":
exitFlag = true;
break;
case "1":
Console.WriteLine("Running subscribe() (not implementing connectCallback)");
pubnub.subscribe<string>(channel, DisplayReturnMessage);
//System.Threading.Tasks.Task subtask = System.Threading.Tasks.Task.Factory.StartNew(() => pubnub.subscribe<string>(channel, DisplayReturnMessage));
//pubnub.subscribe<object>(channel, DisplayReturnMessage);
//pubnub.subscribe(channel, DisplayReturnMessage);
break;
case "2":
Console.WriteLine("Running subscribe() (implementing connectCallback)");
pubnub.subscribe<string>(channel, DisplayReturnMessage, DisplayConnectStatusMessage);
//System.Threading.Tasks.Task subtask = System.Threading.Tasks.Task.Factory.StartNew(() => pubnub.subscribe<string>(channel, DisplayReturnMessage));
//pubnub.subscribe<object>(channel, DisplayReturnMessage);
//pubnub.subscribe(channel, DisplayReturnMessage);
break;
case "3":
Console.WriteLine("Running publish()");
Console.WriteLine("Enter the message for publish. To exit loop, enter QUIT");
string publishMsg = Console.ReadLine();
double doubleData;
int intData;
if (int.TryParse(publishMsg, out intData))
{
pubnub.publish<string>(channel, intData, DisplayReturnMessage);
}
else if (double.TryParse(publishMsg, out doubleData))
{
pubnub.publish<string>(channel, doubleData, DisplayReturnMessage);
}
else
{
//check whether any numeric is sent in double quotes
if (publishMsg.IndexOf("\"") == 0 && publishMsg.LastIndexOf("\"") == publishMsg.Length - 1)
{
string strMsg = publishMsg.Substring(1, publishMsg.Length - 2);
//.........这里部分代码省略.........
示例7: Timestamp
public long Timestamp(Pubnub pubnub)
{
deliveryStatus = false;
pubnub.time(DisplayReturnMessage);
while (!deliveryStatus) ;
IList<object> fields = objResponse as IList<object>;
return Convert.ToInt64(fields[0].ToString());
}
示例8: Timestamp_Example
static void Timestamp_Example()
{
Pubnub pubnub = new Pubnub(
"demo",
"demo",
"",
"",
false
);
string strResponse = "";
deliveryStatus = false;
pubnub.time(DisplayReturnMessage);
while (!deliveryStatus) ;
IList<object> fields = objResponse as IList<object>;
strResponse = fields[0].ToString();
Console.WriteLine(strResponse);
//Assert.AreNotEqual("0",strResponse);
}
示例9: Timestamp_Example
static void Timestamp_Example()
{
Pubnub pubnub = new Pubnub(
"demo",
"demo",
"",
false);
pubnub.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == "Time")
{
Console.WriteLine("Time: " + ((Pubnub)sender).Time[0].ToString());
}
};
pubnub.time();
}