/// <summary> /// Raises the TeamListReceived()-event or the UserChangedTeam()-event depending on the received parameters and the content. /// </summary> /// <param name="parameters"></param> /// <param name="content"></param> private void HandleTeamEvent(string[] parameters, string content) { if (parameters.Length == 1) { string[] teamNames; if (content.Contains(";")) { teamNames = content.Split(';'); } else { teamNames = new string[] { content }; } UserListEventArgs teamArgs = new UserListEventArgs(teamNames, Convert.ToInt32(parameters[0]), ListType.Team); TeamListReceived(this, teamArgs); //parametes[0] --> team number } else { string username = parameters[0]; int oldTeamId = Convert.ToInt32(parameters[1]); int newTeamId = Convert.ToInt32(parameters[2]); TeamChangeEventArgs teamChangeArgs = new TeamChangeEventArgs(username, oldTeamId, newTeamId); UserChangedTeam(this, teamChangeArgs); } }
void CurrentClient_UserChangedTeam(object sender, TeamChangeEventArgs e) { User user = Users.Find(x => x.Username == e.Username && x.TeamId == e.OldTeamId); if (user != null) { user.TeamId = e.NewTeamId; } if (teamChanger != null && teamChanger.Visible) { teamChanger.UpdateUserList(Users); } //write it into the chat ChatTabPage chatGroup = (ChatTabPage)CurrentChats.TabPages[0]; chatGroup.AddTeamChange(e.Username, e.OldTeamId, e.NewTeamId); }