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


C# Pubnub.ChangeUUID方法代码示例

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


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

示例1: Main


//.........这里部分代码省略.........
                        break;
                    case "28":
                        bool globalHereNowShowUUID = true;
                        bool globalHereNowIncludeUserState = false;

                        Console.WriteLine("Show UUID List? Y or N? Default is Y. Press N for No Else press ENTER");
                        string userChoiceGlobalHereNowShowUUID = Console.ReadLine();
                        if (userChoiceGlobalHereNowShowUUID.ToLower() == "n")
                        {
                            globalHereNowShowUUID = false;
                        }
                        Console.ForegroundColor = ConsoleColor.Blue;
                        Console.WriteLine(string.Format("Show UUID = {0}", globalHereNowShowUUID));
                        Console.ResetColor();
                        Console.WriteLine();

                        Console.WriteLine("Include User State? Y or N? Default is N. Press Y for Yes Else press ENTER");
                        string userChoiceGlobalHereNowIncludeUserState = Console.ReadLine();
                        if (userChoiceGlobalHereNowIncludeUserState.ToLower() == "y")
                        {
                            globalHereNowIncludeUserState = true;
                        }
                        Console.ForegroundColor = ConsoleColor.Blue;
                        Console.WriteLine(string.Format("Include User State = {0}", globalHereNowIncludeUserState));
                        Console.ResetColor();
                        Console.WriteLine();

                        Console.WriteLine("Running Global HereNow()");
                        pubnub.GlobalHereNow<string>(globalHereNowShowUUID, globalHereNowIncludeUserState,DisplayReturnMessage, DisplayErrorMessage);
                        break;
                    case "29":
                        Console.WriteLine("ENTER UUID.");
                        string sessionUUID = Console.ReadLine();
                        pubnub.ChangeUUID(sessionUUID);
                        Console.ForegroundColor = ConsoleColor.Blue;
                        Console.WriteLine("UUID = {0}",pubnub.SessionUUID);
                        Console.ResetColor();
                        break;
                    case "38":
                        Console.WriteLine("Enter namespace");
                        string addChannelGroupNamespace = Console.ReadLine();
                        Console.ForegroundColor = ConsoleColor.Blue;
                        Console.WriteLine(string.Format("namespace = {0}", addChannelGroupNamespace));
                        Console.ResetColor();
                        
                        Console.WriteLine("Enter channel group name");
                        string addChannelGroupName = Console.ReadLine();
                        Console.ForegroundColor = ConsoleColor.Blue;
                        Console.WriteLine(string.Format("channel group name = {0}", addChannelGroupName));
                        Console.ResetColor();
                        

                        Console.WriteLine("Enter CHANNEL name. Use comma to enter multiple channels.");
                        channel = Console.ReadLine();
                        Console.ForegroundColor = ConsoleColor.Blue;
                        Console.WriteLine(string.Format("Channel = {0}",channel));
                        Console.ResetColor();
                        Console.WriteLine();
                        pubnub.AddChannelsToChannelGroup<string>(channel.Split(','), addChannelGroupNamespace, addChannelGroupName, DisplayReturnMessage, DisplayErrorMessage);
                        break;
                    case "39":
                        Console.WriteLine("Enter namespace");
                        string removeChannelGroupNamespace = Console.ReadLine();
                        Console.ForegroundColor = ConsoleColor.Blue;
                        Console.WriteLine(string.Format("namespace = {0}", removeChannelGroupNamespace));
                        Console.ResetColor();
开发者ID:RecursosOnline,项目名称:c-sharp,代码行数:67,代码来源:PubnubExample.cs

示例2: Main


//.........这里部分代码省略.........
					//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)");
					string uuid = Console.ReadLine ();
					if (string.IsNullOrEmpty (uuid)) {
						pubnub.SetUserState<string> (setUserStateChannel, jsonUserState, DisplayReturnMessage, DisplayErrorMessage);
					} else {
						pubnub.SetUserState<string> (setUserStateChannel, uuid, jsonUserState, DisplayReturnMessage, DisplayErrorMessage);
					}
					break;
				case "27":
					Console.WriteLine ("Enter channel name");
					string getUserStateChannel2 = Console.ReadLine ();
					Console.ForegroundColor = ConsoleColor.Blue;
					Console.WriteLine (string.Format ("Channel = {0}", getUserStateChannel2));
					Console.ResetColor ();

					Console.WriteLine ("Enter UUID. (Optional. Press ENTER to skip it)");
					string uuid2 = Console.ReadLine ();
					if (string.IsNullOrEmpty (uuid2)) {
						pubnub.GetUserState<string> (getUserStateChannel2, DisplayReturnMessage, DisplayErrorMessage);
					} else {
						pubnub.GetUserState<string> (getUserStateChannel2, uuid2, DisplayReturnMessage, DisplayErrorMessage);
					}
					break;
				case "28":
					Console.WriteLine ("Enter uuid for WhereNow. To consider SessionUUID, just press ENTER");
					string whereNowUuid = Console.ReadLine ();

					Console.ForegroundColor = ConsoleColor.Blue;
					Console.WriteLine (string.Format ("uuid = {0}", whereNowUuid));
					Console.ResetColor ();
					Console.WriteLine ();

					Console.WriteLine ("Running Where_Now()");
					pubnub.WhereNow<string> (whereNowUuid, DisplayReturnMessage, DisplayErrorMessage);
					break;
				case "29":
					bool globalHereNowShowUUID = true;
					bool globalHereNowIncludeUserState = false;

					Console.WriteLine ("Show UUID List? Y or N? Default is Y. Press N for No Else press ENTER");
					string userChoiceGlobalHereNowShowUUID = Console.ReadLine ();
					if (userChoiceGlobalHereNowShowUUID.ToLower () == "n") {
						globalHereNowShowUUID = false;
					}
					Console.ForegroundColor = ConsoleColor.Blue;
					Console.WriteLine (string.Format ("Show UUID = {0}", globalHereNowShowUUID));
					Console.ResetColor ();
					Console.WriteLine ();

					Console.WriteLine ("Include User State? Y or N? Default is N. Press Y for Yes Else press ENTER");
					string userChoiceGlobalHereNowIncludeUserState = Console.ReadLine ();
					if (userChoiceGlobalHereNowIncludeUserState.ToLower () == "y") {
						globalHereNowIncludeUserState = true;
					}
					Console.ForegroundColor = ConsoleColor.Blue;
					Console.WriteLine (string.Format ("Include User State = {0}", globalHereNowIncludeUserState));
					Console.ResetColor ();
					Console.WriteLine ();

					Console.WriteLine ("Running Global HereNow()");
					pubnub.GlobalHereNow<string> (globalHereNowShowUUID, globalHereNowIncludeUserState, DisplayReturnMessage, DisplayErrorMessage);
					break;
				case "30":
					Console.WriteLine ("ENTER UUID.");
					string sessionUUID = Console.ReadLine ();
					pubnub.ChangeUUID (sessionUUID);
					Console.ForegroundColor = ConsoleColor.Blue;
					Console.WriteLine ("UUID = {0}", pubnub.SessionUUID);
					Console.ResetColor ();
					break;
				default:
					Console.ForegroundColor = ConsoleColor.Red;
					Console.WriteLine ("INVALID CHOICE. ENTER 99 FOR EXIT OR QUIT");
					Console.ResetColor ();
					break;
				}
				if (!exitFlag) {
					userinput = Console.ReadLine ();
					Int32.TryParse (userinput, out currentUserChoice);
				}
			}

			Console.WriteLine ("\nPress any key to exit.\n\n");
			Console.ReadLine ();
		}
开发者ID:jugalkishor-sujal,项目名称:c-sharp,代码行数:101,代码来源:PubnubExample.cs


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