/// <summary> /// 1、登录 /// </summary> public void Login(string name, string password) { OperationContext context = OperationContext.Current; IGuessCallback callback = context.GetCallbackChannel <IGuessCallback>(); User user = new User(name, callback); //有重名,登录失败 if (CC.users.ContainsKey(name)) { user.callback.ShowLogin(-1, null); return; } //初始化CC.users(当前用户添加到xxx) CC.users.Add(name, user); //回调登录 user.callback.ShowLogin(0, user); }
public User(string name, IGuessCallback callback) { this.name = name; this.callback = callback; }