public void AddUser(string login, string password) { UserModel createdUser = new UserModel(login, password); Users.Add(createdUser.Login, createdUser); UserAdded?.Invoke(createdUser); }
public void Init(SiteType siteType) { var userStore = _dict[siteType]; userStore.UserAdded += (s, e) => UserAdded?.Invoke(s, e); userStore.Init(); }
public void AddUser(AddUserRequest request) { BroadcastAsync($"User {request.Name} joined").GetAwaiter().GetResult(); UserAdded?.Invoke(this, new UserAddedEventArgs { UserName = request.Name }); }
private void AddUser(IUser userInfo) { if (_cacheDict.TryAdd(userInfo.UserId, userInfo)) { UserAdded?.Invoke(this, userInfo); } }
private void OnUserAdded(User user) { if (UserAdded == null) { return; } UserAdded.Invoke(user); }
public virtual void Insert(int index, string Username) { if (generic.IndexOf(Username) == -1) { generic.Insert(index, Username); UserAdded?.Invoke(null, Username); } }
public virtual void Add(string Username) { if (generic.IndexOf(Username) == -1) { generic.Add(Username); UserAdded?.Invoke(null, Username); } }
public void AddUser(ProcessUser user) { if (Contract.Users.Any(u => user.Id == u.Id)) { throw new DuplicateIdException($"Contract already contains user id {user.Id}"); } Contract.Users.Add(user); UserAdded?.Invoke(this, user); }
public ProcessUser AddNewUser() { var user = new ProcessUser { Id = Guid.NewGuid().ToString() }; Contract.Users.Add(user); UserAdded?.Invoke(this, user); return(user); }
public void Load(Stream stream) { _Users = Serializer.Deserialize <HashSet <User> >(stream); foreach (var user in _Users) { user.SetUserDataAndRaiseEvent(RaiseChangedEvent, this); UserAdded?.Invoke(this, new UserAddedEventArgs(user)); } }
public void AddUser(User user) { if (user == null) { throw new ArgumentNullException(nameof(user)); } users.Add(user); UserAdded?.Invoke(this, new UserEventArgs(user, UserChangeType.Added)); }
public virtual void AddRange(string[] Usernames) { for (int i = 0; i < Usernames.Length; i++) { if (!this.Exists(Usernames[i])) { generic.Add(Usernames[i]); UserAdded?.Invoke(null, Usernames[i]); } } }
public static TwitchUser AddUser(string username) { TwitchUser twitchUser = new TwitchUser(username); username = twitchUser.Username.ToUpper(); if (HasUser(username)) { return(users[username]); } users.Add(username, twitchUser); OnUserAdded?.Invoke(twitchUser); return(twitchUser); }
public void AddUser(ProjectMember user) { if (Project == null) { return; } if (Project.ProjectMembersNotInRepository == null) { Project.ProjectMembersNotInRepository = new List <ProjectMember>(); } Project.ProjectMembersNotInRepository.Add(user); UserAdded?.Invoke(user); }
public void AddUser(string LastName, string FirstName, DateTime Birthdate, DateTime TimeAdded, string City, string Address, string PhoneNumber, string Gender, string Email) { User user = User.Fabric(); user.LastName = LastName; user.FirstName = FirstName; user.Birthdate = Birthdate; user.TimeAdded = TimeAdded; user.City = City; user.Address = Address; user.PhoneNumber = PhoneNumber; user.Gender = Gender; user.Email = Email; this.Book.Add(user); UserAdded.Invoke(); }
public ChatMessage AddMessage(string username, string message) { if (string.IsNullOrWhiteSpace(username)) { throw new ArgumentException("No username specified"); } if (string.IsNullOrWhiteSpace(message)) { throw new ArgumentException("No message specified"); } username = username.Trim(); var now = DateTime.UtcNow; var m = new ChatMessage { Username = username, Message = message.Trim(), UtcTime = now, }; messages.Enqueue(m); while (messages.Count > 32) { messages.TryDequeue(out var _); } MessageAdded?.Invoke(this, new MessageEventArgs(m)); if (!users.ContainsKey(username)) { var u = new ChatUser { Username = username, }; if (users.TryAdd(username, u)) { UserAdded?.Invoke(this, new UserEventArgs(u)); } } return(m); }
public void AddUser(int id, string name, Dictionary <string, string> prms = null) { if (prms == null) { prms = new Dictionary <string, string>(); } foreach (var kvp in DefaultValues) { if (!prms.ContainsKey(kvp.Key)) { prms.Add(kvp.Key, kvp.Value.ToString()); } } var newuser = new User(id, name, RaiseChangedEvent, this, prms); _Users.Add(newuser); UserAdded?.Invoke(this, new UserAddedEventArgs(newuser)); }
public bool AddUser(User user) { try { var isUserAdded = false; if (_addressBook == null) { throw new NullReferenceException("Книга не створена! "); } if (user == null) { throw new NullReferenceException("Немає користувача! "); } UserAdded?.Invoke("debug", "Почався запис користувача в адресну книгу"); if (IsUserInAdressBook(user, _addressBook)) //провірка на наявність юзера в книзі { UserAdded?.Invoke("warning", "користувач з такими данними вже є!"); } if (!IsUserInAdressBook(user, _addressBook)) //добавиться тільки тоді , коли не співпадає { _addressBook.Add(user); UserAdded?.Invoke("info", string.Format("Був доданий користувач " + user.FirstName + " " + user.LastName)); UserAdded?.Invoke("debug", "Закінчився запис користувача в адресну книгу"); isUserAdded = true; } return(isUserAdded); } catch (NullReferenceException ex) { UserAdded?.Invoke("error", string.Format(ex.Message + "StackTrace :" + ex.StackTrace)); return(false); } catch (Exception ex) { UserAdded?.Invoke("error", string.Format(ex.Message + "StackTrace :" + ex.StackTrace)); return(false); } }
public IUser GetUser(string userId) { //UserInfoのインスタンスは一つのuserIdにつき一つだけ作る。 if (_cacheDict.ContainsKey(userId)) { return(_cacheDict[userId]); } //TODO:最初にデータベース上のユーザ情報を全てメモリに読み込むべきでは?その方が絶対に効率がいい。 if (TryGet(userId, out IUser userInfo)) { _cacheDict.TryAdd(userId, userInfo); return(userInfo); } //キャッシュにもデータベースにも無いので、新たに作成 userInfo = new UserTest(userId); _cacheDict.TryAdd(userId, userInfo); UserAdded?.Invoke(this, userInfo); return(userInfo); }
private void UserAddedEvent() { UserAdded?.Invoke(this, EventArgs.Empty); }
public void AddUser(ChannelUser user) { users.Add(user.IRCUser.Name, user); UserAdded?.Invoke(this, new ChannelUserEventArgs(user)); }
public void AddUser(ChannelUser user) { users.Add(user); users = users.OrderBy(u => u.IRCUser.Name).OrderBy(u => !u.IsAdmin).ToList(); UserAdded?.Invoke(this, new ChannelUserEventArgs(-1, user)); }
protected virtual void OnUserAdded(UserAddedEventArgs e) { UserAdded?.Invoke(this, e); }
public void AddUser(params object[] data) { this.Book.Add((User)data); UserAdded.Invoke(); }
protected virtual void OnUserAdded(object sender, BllUser user) { UserAdded?.Invoke(sender, user); }
private void AddUserToGlobalUserList(IRCUser user) { UserList.Add(user); UserList = UserList.OrderBy(u => u.Name).ToList(); UserAdded?.Invoke(this, new UserEventArgs(user)); }
public void AddUser(User user) { userList.Add(user); UserAdded?.Invoke(this, user); }