private void Signup_Click(object sender, RoutedEventArgs e) { if (textboxPassword.Password == textboxConfirm.Password) { if (_db.Add(textboxLogin.Text, textboxPassword.Password)) { _parent.LoggedUser = _db.Get(textboxLogin.Text, textboxPassword.Password); _parent.Close(); } else { MessageBox.Show("User with such login already exists"); } } else { MessageBox.Show("Passwords don't match"); } }
private void Restore() { List <long> UserIds = new List <long>(); UserIds.AddRange(Online); UserIds.AddRange(Offline); if (UserIds.Count == 0) { foreach (var Settings in Global.GuildSettings.Settings) { foreach (long Id in Settings.Value.TwitchTrack.UserIds) { if (!UserIds.Contains(Id)) { UserIds.Add(Id); } } } } Tracking.AddRange(UserIds); List <UserResponse> Users = new List <UserResponse>(); for (int i = 0; i < UserIds.Count; i += 100) { GetUsersResponse resp = api.Helix.Users.GetUsersAsync(UserIds.Skip(i).Take(100).Select(t => t.ToString()).ToList()).Result; Users.AddRange(resp.Users.Select(t => new UserResponse(t))); } for (int i = 0; i < Users.Count; i++) { UserResponse User = Users[i]; UserDatabase.Add(User.Id, User); } }
public RegisterStatus Register(string Username) { GetUsersResponse resp = api.Helix.Users.GetUsersAsync(logins: new List <string>() { Username }).Result; List <UserResponse> user = resp.Users.Select(t => new UserResponse(t)).ToList(); if (user.Count == 0) { return(RegisterStatus.UserNotFound); } if (Tracking.Contains(user[0].Id)) { return(RegisterStatus.AlreadyTracking); } Tracking.Add(user[0].Id); Offline.Add(user[0].Id); UserDatabase.Add(user[0].Id, user[0]); return(RegisterStatus.Success); }