本文整理汇总了C#中Pubnub.GetLocalUserState方法的典型用法代码示例。如果您正苦于以下问题:C# Pubnub.GetLocalUserState方法的具体用法?C# Pubnub.GetLocalUserState怎么用?C# Pubnub.GetLocalUserState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pubnub
的用法示例。
在下文中一共展示了Pubnub.GetLocalUserState方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
//.........这里部分代码省略.........
} else {
Console.Write ("No User State Exists");
}
Console.ResetColor ();
}
break;
case "24":
Console.WriteLine ("Enter channel name");
string deleteUserStateChannel = Console.ReadLine ();
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine (string.Format ("Channel = {0}", deleteUserStateChannel));
Console.ResetColor ();
Console.WriteLine ("Enter key of the local user state to be deleted");
string deleteKeyUserState = Console.ReadLine ();
string currentUserStateAfterDelete = pubnub.SetLocalUserState (deleteUserStateChannel, deleteKeyUserState, null);
Console.ForegroundColor = ConsoleColor.Blue;
if (!string.IsNullOrEmpty (currentUserStateAfterDelete)) {
Console.WriteLine ("Current User State = {0}", currentUserStateAfterDelete);
} else {
Console.Write ("No User State Exists");
}
Console.ResetColor ();
break;
case "25":
Console.WriteLine ("Enter channel name");
string getUserStateChannel = Console.ReadLine ();
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine (string.Format ("Channel = {0}", getUserStateChannel));
Console.ResetColor ();
string currentUserStateView = pubnub.GetLocalUserState (getUserStateChannel);
Console.ForegroundColor = ConsoleColor.Blue;
if (!string.IsNullOrEmpty (currentUserStateView)) {
Console.WriteLine ("Current User State = {0}", currentUserStateView);
} else {
Console.Write ("No User State Exists");
}
Console.ResetColor ();
break;
case "26":
Console.WriteLine ("Enter channel name");
string setUserStateChannel = Console.ReadLine ();
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine (string.Format ("Channel = {0}", setUserStateChannel));
Console.ResetColor ();
//Console.WriteLine ("NOTE: Hopefully you added local user state.");
Console.WriteLine ("If you want to consider already created local user state, press ENTER");
Console.WriteLine ("Else enter user state in json format (Eg. {\"key1\":\"value1\",\"key2\":\"value2\"}");
string manualJsonUserState = Console.ReadLine ();
string jsonUserState = "";
if (string.IsNullOrEmpty (manualJsonUserState)) {
jsonUserState = pubnub.GetLocalUserState (setUserStateChannel);
} else {
jsonUserState = manualJsonUserState;
}
if (jsonUserState == "" || jsonUserState == "{}") {
Console.WriteLine ("Invalid User State");
break;
}
Console.WriteLine ("Enter UUID. (Optional. Press ENTER to skip it)");