本文整理汇总了C#中Pubnub.Presence方法的典型用法代码示例。如果您正苦于以下问题:C# Pubnub.Presence方法的具体用法?C# Pubnub.Presence怎么用?C# Pubnub.Presence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pubnub
的用法示例。
在下文中一共展示了Pubnub.Presence方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ThenPresenceShouldReturnCustomUUID
public void ThenPresenceShouldReturnCustomUUID()
{
receivedCustomUUID = false;
Pubnub pubnub = new Pubnub("demo", "demo", "", "", false);
PubnubUnitTest unitTest = new PubnubUnitTest();
unitTest.TestClassName = "WhenAClientIsPresented";
unitTest.TestCaseName = "ThenPresenceShouldReturnCustomUUID";
pubnub.PubnubUnitTest = unitTest;
string channel = "my/channel";
pubnub.Presence<string>(channel, ThenPresenceWithCustomUUIDShouldReturnMessage);
//since presence expects from stimulus from sub/unsub...
pubnub.SessionUUID = customUUID;
pubnub.Subscribe<string>(channel, DummyMethodForSubscribeUUID);
subscribeUUIDManualEvent.WaitOne(2000);
pubnub.Unsubscribe<string>(channel, DummyMethodForUnSubscribeUUID);
unsubscribeUUIDManualEvent.WaitOne(2000);
presenceUUIDManualEvent.WaitOne(310 * 1000);
pubnub.PresenceUnsubscribe<string>(channel, DummyMethodForPreUnSubUUID);
presenceUnsubscribeUUIDEvent.WaitOne();
Assert.IsTrue(receivedCustomUUID, "Custom UUID not received");
}
示例2: ThenPresenceShouldReturnReceivedMessage
public void ThenPresenceShouldReturnReceivedMessage()
{
receivedPresenceMessage = false;
Pubnub pubnub = new Pubnub("demo", "demo", "", "", false);
PubnubUnitTest unitTest = new PubnubUnitTest();
unitTest.TestClassName = "WhenAClientIsPresented";
unitTest.TestCaseName = "ThenPresenceShouldReturnReceivedMessage";
pubnub.PubnubUnitTest = unitTest;
string channel = "my/channel";
pubnub.Presence<string>(channel, ThenPresenceShouldReturnMessage);
//since presence expects from stimulus from sub/unsub...
pubnub.Subscribe<string>(channel, DummyMethodForSubscribe);
subscribeManualEvent.WaitOne(2000);
pubnub.Unsubscribe<string>(channel, DummyMethodForUnSubscribe);
unsubscribeManualEvent.WaitOne(2000);
presenceManualEvent.WaitOne(310 * 1000);
pubnub.PresenceUnsubscribe<string>(channel, DummyMethodForPreUnSub);
presenceUnsubscribeEvent.WaitOne();
Assert.IsTrue(receivedPresenceMessage, "Presence message not received");
}
示例3: ThenPresenceShouldReturnReceivedMessage
public void ThenPresenceShouldReturnReceivedMessage()
{
receivedPresenceMessage = false;
ThreadPool.QueueUserWorkItem((s) =>
{
Pubnub pubnub = new Pubnub("demo", "demo", "", "", false);
string channel = "my/channel";
PubnubUnitTest unitTest = new PubnubUnitTest();
unitTest.TestClassName = "WhenAClientIsPresented";
unitTest.TestCaseName = "ThenPresenceShouldReturnReceivedMessage";
pubnub.PubnubUnitTest = unitTest;
pubnub.Presence<string>(channel, ThenPresenceShouldReturnMessage);
//since presence expects from stimulus from sub/unsub...
pubnub.Subscribe<string>(channel, DummyMethodForSubscribe);
subscribeManualEvent.WaitOne(2000);
pubnub.Unsubscribe<string>(channel, DummyMethodForUnSubscribe);
unsubscribeManualEvent.WaitOne(2000);
pubnub.PresenceUnsubscribe<string>(channel, DummyMethodForPreUnSub);
presenceUnsubscribeEvent.WaitOne(2000);
presenceManualEvent.WaitOne(310 * 1000);
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
Assert.IsTrue(receivedPresenceMessage, "Presence message not received");
TestComplete();
});
});
}
示例4: ThenPresenceShouldReturnReceivedMessage
public void ThenPresenceShouldReturnReceivedMessage()
{
Debug.Log("Running ThenPresenceShouldReturnReceivedMessage()");
receivedPresenceMessage = false;
Pubnub pubnub = new Pubnub("demo", "demo", "", "", false);
PubnubUnitTest unitTest = new PubnubUnitTest();
unitTest.TestClassName = "WhenAClientIsPresented";
unitTest.TestCaseName = "ThenPresenceShouldReturnReceivedMessage";
pubnub.PubnubUnitTest = unitTest;
string channel = "my/channel";
pubnub.Presence<string>(channel, ThenPresenceShouldReturnMessage, PresenceDummyMethodForConnectCallback);
Thread.Sleep(1000);
//since presence expects from stimulus from sub/unsub...
pubnub.Subscribe<string>(channel, DummyMethodForSubscribe, SubscribeDummyMethodForConnectCallback);
Thread.Sleep(1000);
subscribeManualEvent.WaitOne(2000);
pubnub.Unsubscribe<string>(channel, DummyMethodForUnSubscribe, UnsubscribeDummyMethodForConnectCallback, UnsubscribeDummyMethodForDisconnectCallback);
Thread.Sleep(1000);
unsubscribeManualEvent.WaitOne(2000);
presenceManualEvent.WaitOne(310 * 1000);
pubnub.EndPendingRequests();
UUnitAssert.True(receivedPresenceMessage, "Presence message not received");
}
示例5: ThenPresenceShouldReturnReceivedMessage
public void ThenPresenceShouldReturnReceivedMessage()
{
receivedPresenceMessage = false;
Pubnub pubnub = new Pubnub(PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, "", "", false);
string channel = "hello_my_channel";
PubnubUnitTest unitTest = new PubnubUnitTest();
unitTest.TestClassName = "WhenAClientIsPresented";
unitTest.TestCaseName = "ThenPresenceShouldReturnReceivedMessage";
pubnub.PubnubUnitTest = unitTest;
pubnub.Presence<string>(channel, ThenPresenceShouldReturnMessage, PresenceDummyMethodForConnectCallback, DummyErrorCallback);
Thread.Sleep(1000);
//since presence expects from stimulus from sub/unsub...
pubnub.Subscribe<string>(channel, DummyMethodForSubscribe, SubscribeDummyMethodForConnectCallback, DummyErrorCallback);
Thread.Sleep(1000);
subscribeManualEvent.WaitOne(2000);
//pubnub.Unsubscribe<string>(channel, DummyMethodForUnSubscribe, UnsubscribeDummyMethodForConnectCallback, UnsubscribeDummyMethodForDisconnectCallback, DummyErrorCallback);
//Thread.Sleep(1000);
//unsubscribeManualEvent.WaitOne(2000);
presenceManualEvent.WaitOne(310 * 1000);
pubnub.EndPendingRequests();
Assert.IsTrue(receivedPresenceMessage, "Presence message not received");
}
示例6: ThenPresenceShouldReturnCustomUUID
public void ThenPresenceShouldReturnCustomUUID()
{
receivedCustomUUID = false;
Pubnub pubnub = new Pubnub("demo", "demo", "", "", false);
PubnubUnitTest unitTest = new PubnubUnitTest();
unitTest.TestClassName = "WhenAClientIsPresented";
unitTest.TestCaseName = "ThenPresenceShouldReturnCustomUUID";
pubnub.PubnubUnitTest = unitTest;
string channel = "hello_my_channel";
pubnub.Presence<string>(channel, ThenPresenceWithCustomUUIDShouldReturnMessage, PresenceUUIDDummyMethodForConnectCallback, DummyErrorCallback);
Thread.Sleep(1000);
//since presence expects from stimulus from sub/unsub...
pubnub.SessionUUID = customUUID;
pubnub.Subscribe<string>(channel, DummyMethodForSubscribeUUID, SubscribeUUIDDummyMethodForConnectCallback, DummyErrorCallback);
Thread.Sleep(1000);
subscribeUUIDManualEvent.WaitOne(2000);
pubnub.Unsubscribe<string>(channel, DummyMethodForUnSubscribeUUID, UnsubscribeUUIDDummyMethodForConnectCallback, UnsubscribeUUIDDummyMethodForDisconnectCallback, DummyErrorCallback);
Thread.Sleep(1000);
unsubscribeUUIDManualEvent.WaitOne(2000);
presenceUUIDManualEvent.WaitOne(310 * 1000);
pubnub.EndPendingRequests();
Assert.IsTrue(receivedCustomUUID, "Custom UUID not received");
}
示例7: ThenItShouldReturnReceivedMessage
public void ThenItShouldReturnReceivedMessage()
{
Pubnub pubnub = new Pubnub(
"demo",
"demo",
"",
"",
false
);
string channel = "hello_world";
Common commonPresence = new Common();
commonPresence.DeliveryStatus = false;
commonPresence.Response = null;
pubnub.PubnubUnitTest = commonPresence.CreateUnitTestInstance("WhenAClientIsPresented", "ThenPresenceShouldReturnReceivedMessage");
pubnub.Presence(channel, commonPresence.DisplayReturnMessage, commonPresence.DisplayReturnMessageDummy, commonPresence.DisplayReturnMessageDummy);
Common commonSubscribe = new Common();
commonSubscribe.DeliveryStatus = false;
commonSubscribe.Response = null;
pubnub.Subscribe(channel, commonSubscribe.DisplayReturnMessage, commonSubscribe.DisplayReturnMessageDummy, commonPresence.DisplayReturnMessageDummy);
//while (!commonSubscribe.DeliveryStatus) ;
commonPresence.WaitForResponse(30);
string response = "";
if (commonPresence.Response == null) {
Assert.Fail("Null response");
}
else
{
IList<object> responseFields = commonPresence.Response as IList<object>;
foreach (object item in responseFields)
{
response = item.ToString();
Console.WriteLine("Response:" + response);
//Assert.IsNotEmpty(strResponse);
}
Assert.True (("hello_world").Equals(responseFields[2]));
}
}
示例8: ThenPresenceShouldReturnReceivedMessage
public void ThenPresenceShouldReturnReceivedMessage()
{
receivedPresenceMessage = false;
Pubnub pubnub = new Pubnub("demo", "demo", "", "", false);
string channel = "hello_my_channel";
PubnubUnitTest unitTest = new PubnubUnitTest();
unitTest.TestClassName = "WhenAClientIsPresented";
unitTest.TestCaseName = "ThenPresenceShouldReturnReceivedMessage";
pubnub.PubnubUnitTest = unitTest;
EnqueueCallback(() => pubnub.Presence<string>(channel, ThenPresenceShouldReturnMessage, PresenceDummyMethodForConnectCallback, DummyErrorCallback));
EnqueueCallback(() => pubnub.Subscribe<string>(channel, DummyMethodForSubscribe, SubscribeDummyMethodForConnectCallback, DummyErrorCallback));
EnqueueConditional(() => subscribeConnectStatusCallbackInvoked);
EnqueueConditional(() => subscribeCallbackInvoked);
EnqueueCallback(() => pubnub.EndPendingRequests());
EnqueueConditional(() => presenceReturnMessageCallbackInvoked);
EnqueueCallback(() => Assert.IsTrue(receivedPresenceMessage, "Presence message not received"));
EnqueueTestComplete();
}
示例9: ThenPresenceShouldReturnReceivedMessage
public void ThenPresenceShouldReturnReceivedMessage()
{
receivedPresenceMessage = false;
Pubnub pubnub = new Pubnub(PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, "", "", false);
PubnubUnitTest unitTest = new PubnubUnitTest();
unitTest.TestClassName = "WhenAClientIsPresented";
unitTest.TestCaseName = "ThenPresenceShouldReturnReceivedMessage";
pubnub.PubnubUnitTest = unitTest;
string channel = "hello_my_channel";
manualResetEventsWaitTimeout = (unitTest.EnableStubTest) ? 1000 : 310 * 1000;
pubnub.Presence<string>(channel, ThenPresenceShouldReturnMessage, PresenceDummyMethodForConnectCallback, DummyErrorCallback);
Task.Delay(1000);
//since presence expects from stimulus from sub/unsub...
pubnub.Subscribe<string>(channel, DummyMethodForSubscribe, SubscribeDummyMethodForConnectCallback, DummyErrorCallback);
Task.Delay(1000);
subscribeManualEvent.WaitOne(manualResetEventsWaitTimeout);
if (!unitTest.EnableStubTest)
{
pubnub.Unsubscribe<string>(channel, DummyMethodForUnSubscribe, UnsubscribeDummyMethodForConnectCallback, UnsubscribeDummyMethodForDisconnectCallback, DummyErrorCallback);
Task.Delay(1000);
unsubscribeManualEvent.WaitOne(manualResetEventsWaitTimeout);
}
presenceManualEvent.WaitOne(manualResetEventsWaitTimeout);
pubnub.EndPendingRequests();
pubnub.PubnubUnitTest = null;
pubnub = null;
Assert.IsTrue(receivedPresenceMessage, "Presence message not received");
}
示例10: Main
//.........这里部分代码省略.........
Console.ForegroundColor = ConsoleColor.Blue;
if (displayErrMessage.Trim().ToLower() == "y" )
{
showErrorMessageSegments = true;
Console.WriteLine("ErrorCallback messages will be displayed");
}
else
{
showErrorMessageSegments = false;
Console.WriteLine("ErrorCallback messages will NOT be displayed.");
}
Console.ResetColor();
Console.WriteLine();
Console.WriteLine("Display Debug Info in ErrorCallback messages? Enter Y for Yes, Else N for No.");
Console.WriteLine("Default = Y ");
string debugMessage = Console.ReadLine();
Console.ForegroundColor = ConsoleColor.Blue;
if (debugMessage.Trim().ToLower() == "n")
{
showDebugMessages = false;
Console.WriteLine("ErrorCallback messages will NOT be displayed");
}
else
{
showDebugMessages = true;
Console.WriteLine("Debug messages will be displayed.");
}
Console.ResetColor();
Console.WriteLine();
Console.WriteLine("ENTER 1 FOR Subscribe");
Console.WriteLine("ENTER 2 FOR Publish");
Console.WriteLine("ENTER 3 FOR Presence");
Console.WriteLine("ENTER 4 FOR Detailed History");
Console.WriteLine("ENTER 5 FOR Here_Now");
Console.WriteLine("ENTER 6 FOR Unsubscribe");
Console.WriteLine("ENTER 7 FOR Presence-Unsubscribe");
Console.WriteLine("ENTER 8 FOR Time");
Console.WriteLine("ENTER 9 FOR Disconnect/Reconnect existing Subscriber(s) (when internet is available)");
Console.WriteLine("ENTER 10 TO Disable Network Connection (no internet)");
Console.WriteLine("ENTER 11 TO Enable Network Connection (yes internet)");
Console.WriteLine("ENTER 12 FOR Grant Access");
Console.WriteLine("ENTER 13 FOR Audit Access");
Console.WriteLine("ENTER 14 FOR Revoke Access");
Console.WriteLine("ENTER 15 FOR Grant Access for Presence Channel");
Console.WriteLine("ENTER 16 FOR Audit Access for Presence Channel");
Console.WriteLine("ENTER 17 FOR Revoke Access for Presence Channel");
Console.WriteLine("ENTER 18 FOR Change/Update Auth Key");
Console.WriteLine("ENTER 19 TO Simulate Machine Sleep Mode");
Console.WriteLine("ENTER 20 TO Simulate Machine Awake Mode");
Console.WriteLine("ENTER 99 FOR EXIT OR QUIT");
bool exitFlag = false;
string channel="";
Console.WriteLine("");
while (!exitFlag)
{
string userinput = Console.ReadLine();
if (userinput.ToLower() == "show debug on")
{
showDebugMessages = true;
continue;
}
else if (userinput.ToLower() == "show debug off")
示例11: Main
//.........这里部分代码省略.........
Int32.TryParse(proxyPort, out port);
Console.WriteLine("ENTER user name for proxy server authentication.");
string proxyUsername = Console.ReadLine();
Console.WriteLine("ENTER password for proxy server authentication.");
string proxyPassword = Console.ReadLine();
proxy = new PubnubProxy();
proxy.ProxyServer = proxyServer;
proxy.ProxyPort = port;
proxy.ProxyUserName = proxyUsername;
proxy.ProxyPassword = proxyPassword;
try
{
pubnub.Proxy = proxy;
proxyAccepted = true;
Console.WriteLine("Proxy details accepted");
}
catch (MissingFieldException mse)
{
Console.WriteLine(mse.Message);
Console.WriteLine("Please RE-ENTER Proxy Server details.");
}
}
}
else
{
Console.WriteLine("No Proxy");
}
Console.WriteLine();
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;
pubnub.EndPendingRequests();
break;
case "1":
Console.WriteLine("Running subscribe() (not implementing connectCallback)");
pubnub.Subscribe<string>(channel, DisplayReturnMessage);
break;
case "2":
Console.WriteLine("Running subscribe() (implementing connectCallback)");
pubnub.Subscribe<string>(channel, DisplayReturnMessage, DisplayConnectStatusMessage);
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;
示例12: TestUnsubscribePresenceSSL
//[Test]
public void TestUnsubscribePresenceSSL()
{
Pubnub pubnub = new Pubnub(
Common.PublishKey,
Common.SubscribeKey,
"",
"",
true
);
string channel = "hello_world3";
Common common = new Common();
common.DeliveryStatus = false;
common.Response = null;
pubnub.PubnubUnitTest = common.CreateUnitTestInstance("WhenAClientIsPresented", "ThenPresenceShouldReturnReceivedMessage");
pubnub.Presence<string>(channel, common.DisplayReturnMessage, common.DisplayReturnMessage, common.DisplayErrorMessage);
common.WaitForResponse();
Common commonSubscribe = new Common();
common.DeliveryStatus = false;
common.Response = null;
pubnub.Subscribe<string>(channel, commonSubscribe.DisplayReturnMessage, commonSubscribe.DisplayReturnMessage, commonSubscribe.DisplayErrorMessage);
commonSubscribe.DeliveryStatus = false;
commonSubscribe.Response = null;
common.WaitForResponse();
string response = "";
if (common.Response == null)
{
Assert.Fail("Null response");
} else
{
//IList<object> responseFields = common.Response as IList<object>;
object[] responseFields = Common.Deserialize<object[]>(common.Response.ToString());
if (channel.Equals(responseFields [2]))
{
Unsub(common, pubnub, channel);
}
}
}
示例13: ThenPresenceShouldReturnCustomUUID
public void ThenPresenceShouldReturnCustomUUID()
{
receivedCustomUUID = false;
mrePresence = new ManualResetEvent(false);
ThreadPool.QueueUserWorkItem((s) =>
{
Pubnub pubnub = new Pubnub(PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, "", "", false);
PubnubUnitTest unitTest = new PubnubUnitTest();
unitTest.TestClassName = "WhenAClientIsPresented";
unitTest.TestCaseName = "ThenPresenceShouldReturnCustomUUID";
pubnub.PubnubUnitTest = unitTest;
pubnub.SessionUUID = customUUID;
string channel = "hello_my_channel";
EnqueueCallback(() => pubnub.Presence<string>(channel, ThenPresenceWithCustomUUIDShouldReturnMessage, PresenceUUIDDummyMethodForConnectCallback, DummyErrorCallback));
//since presence expects from stimulus from sub/unsub...
EnqueueCallback(() =>
{
pubnub.Subscribe<string>(channel, DummyMethodForSubscribeUUID, SubscribeUUIDDummyMethodForConnectCallback, DummyErrorCallback);
});
mrePresence.WaitOne(310 * 1000);
EnqueueCallback(() => pubnub.EndPendingRequests());
EnqueueCallback(() => Assert.IsTrue(receivedCustomUUID, "Custom UUID not received"));
EnqueueTestComplete();
});
}
示例14: Main
//.........这里部分代码省略.........
Console.ResetColor();
Console.WriteLine();
Console.WriteLine("Display Debug Info in ErrorCallback messages? Enter Y for Yes, Else N for No.");
Console.WriteLine("Default = Y ");
string debugMessage = Console.ReadLine();
Console.ForegroundColor = ConsoleColor.Blue;
if (debugMessage.Trim().ToLower() == "n")
{
showDebugMessages = false;
Console.WriteLine("ErrorCallback messages will NOT be displayed");
}
else
{
showDebugMessages = true;
Console.WriteLine("Debug messages will be displayed.");
}
Console.ResetColor();
Console.WriteLine();
bool exitFlag = false;
string channel="";
string channelGroup = "";
int currentUserChoice = 0;
string userinput = "";
Console.WriteLine("");
while (!exitFlag)
{
if (currentUserChoice < 1 || (currentUserChoice > 40 && currentUserChoice != 99))
{
Console.WriteLine("ENTER 1 FOR Subscribe channel/channelgroup");
Console.WriteLine("ENTER 2 FOR Publish");
Console.WriteLine("ENTER 3 FOR Presence channel/channelgroup");
Console.WriteLine("ENTER 4 FOR Detailed History");
Console.WriteLine("ENTER 5 FOR Here_Now");
Console.WriteLine("ENTER 6 FOR Unsubscribe");
Console.WriteLine("ENTER 7 FOR Presence-Unsubscribe");
Console.WriteLine("ENTER 8 FOR Time");
Console.WriteLine("ENTER 9 FOR Disconnect/Reconnect existing Subscriber(s) (when internet is available)");
Console.WriteLine("ENTER 10 TO Disable Network Connection (no internet)");
Console.WriteLine("ENTER 11 TO Enable Network Connection (yes internet)");
Console.WriteLine("ENTER 12 FOR Grant Access to channel/ChannelGroup");
Console.WriteLine("ENTER 13 FOR Audit Access to channel/ChannelGroup");
Console.WriteLine("ENTER 14 FOR Revoke Access to channel/ChannelGroup");
Console.WriteLine("ENTER 15 FOR Grant Access to Presence Channel/ChannelGroup");
Console.WriteLine("ENTER 16 FOR Audit Access to Presence Channel/ChannelGroup");
Console.WriteLine("ENTER 17 FOR Revoke Access to Presence Channel/ChannelGroup");
Console.WriteLine("ENTER 18 FOR Change/Update Auth Key (Current value = {0})", pubnub.AuthenticationKey);
Console.WriteLine("ENTER 19 TO Simulate Machine Sleep Mode");
Console.WriteLine("ENTER 20 TO Simulate Machine Awake Mode");
Console.WriteLine("ENTER 21 TO Set Presence Heartbeat (Current value = {0} sec)", pubnub.PresenceHeartbeat);
Console.WriteLine("ENTER 22 TO Set Presence Heartbeat Interval (Current value = {0} sec)", pubnub.PresenceHeartbeatInterval);
Console.WriteLine("Enter 23 TO Set User State by Add/Modify Key-Pair");
Console.WriteLine("Enter 24 TO Set User State by Deleting existing Key-Pair");
Console.WriteLine("Enter 25 TO Set User State with direct json string");
Console.WriteLine("Enter 26 TO Get User State");
Console.WriteLine("Enter 27 FOR WhereNow");
Console.WriteLine("Enter 28 FOR GlobalHere_Now");
Console.WriteLine("Enter 29 TO change UUID. (Current value = {0})", pubnub.SessionUUID);
Console.WriteLine("Enter 38 FOR Channel Group - Add channel(s)");
Console.WriteLine("Enter 39 FOR Channel Group - Remove channel/group/namespace");
Console.WriteLine("Enter 40 FOR Channel Group - Get channel(s)/namespace(s)");
Console.WriteLine("ENTER 99 FOR EXIT OR QUIT");
userinput = Console.ReadLine();
示例15: Main
//.........这里部分代码省略.........
showErrorMessageSegments = true;
Console.WriteLine ("ErrorCallback messages will be displayed");
} else {
showErrorMessageSegments = false;
Console.WriteLine ("ErrorCallback messages will NOT be displayed.");
}
Console.ResetColor ();
Console.WriteLine ();
Console.WriteLine ("Display Debug Info in ErrorCallback messages? Enter Y for Yes, Else N for No.");
Console.WriteLine ("Default = Y ");
string debugMessage = Console.ReadLine ();
Console.ForegroundColor = ConsoleColor.Blue;
if (debugMessage.Trim ().ToLower () == "n") {
showDebugMessages = false;
Console.WriteLine ("ErrorCallback messages will NOT be displayed");
} else {
showDebugMessages = true;
Console.WriteLine ("Debug messages will be displayed.");
}
Console.ResetColor ();
Console.WriteLine ();
bool exitFlag = false;
string channel = "";
int currentUserChoice = 0;
string userinput = "";
Console.WriteLine ("");
while (!exitFlag) {
if (currentUserChoice < 1 || (currentUserChoice > 30 && currentUserChoice != 99)) {
Console.WriteLine ("ENTER 1 FOR Subscribe");
Console.WriteLine ("ENTER 2 FOR Publish");
Console.WriteLine ("ENTER 3 FOR Presence");
Console.WriteLine ("ENTER 4 FOR Detailed History");
Console.WriteLine ("ENTER 5 FOR Here_Now");
Console.WriteLine ("ENTER 6 FOR Unsubscribe");
Console.WriteLine ("ENTER 7 FOR Presence-Unsubscribe");
Console.WriteLine ("ENTER 8 FOR Time");
Console.WriteLine ("ENTER 9 FOR Disconnect/Reconnect existing Subscriber(s) (when internet is available)");
Console.WriteLine ("ENTER 10 TO Disable Network Connection (no internet)");
Console.WriteLine ("ENTER 11 TO Enable Network Connection (yes internet)");
Console.WriteLine ("ENTER 12 FOR Grant Access");
Console.WriteLine ("ENTER 13 FOR Audit Access");
Console.WriteLine ("ENTER 14 FOR Revoke Access");
Console.WriteLine ("ENTER 15 FOR Grant Access for Presence Channel");
Console.WriteLine ("ENTER 16 FOR Audit Access for Presence Channel");
Console.WriteLine ("ENTER 17 FOR Revoke Access for Presence Channel");
Console.WriteLine ("ENTER 18 FOR Change/Update Auth Key (Current value = {0})", pubnub.AuthenticationKey);
Console.WriteLine ("ENTER 19 TO Simulate Machine Sleep Mode");
Console.WriteLine ("ENTER 20 TO Simulate Machine Awake Mode");
Console.WriteLine ("ENTER 21 TO Set Presence Heartbeat (Current value = {0} sec)", pubnub.PresenceHeartbeat);
Console.WriteLine ("ENTER 22 TO Set Presence Heartbeat Interval (Current value = {0} sec)", pubnub.PresenceHeartbeatInterval);
Console.WriteLine ("Enter 23 TO Add/Modify Local User State");
Console.WriteLine ("Enter 24 TO Delete Local User State");
Console.WriteLine ("Enter 25 TO View/Get Local User State");
Console.WriteLine ("Enter 26 TO Set User State");
Console.WriteLine ("Enter 27 TO Get User State");
Console.WriteLine ("Enter 28 FOR WhereNow");
Console.WriteLine ("Enter 29 FOR GlobalHere_Now");
Console.WriteLine ("Enter 30 TO change UUID. (Current value = {0})", pubnub.SessionUUID);
Console.WriteLine ("ENTER 99 FOR EXIT OR QUIT");
userinput = Console.ReadLine ();
}
switch (userinput) {