private void OnNewUser_Click(object sender, EventArgs e) { int num = GetNumNouveau(); string Profil = "Nouveau"; if (num > 0) { Profil += " " + num; } ListUsers.SelectedNode = ListUsers.Nodes[0]; PirepUser User = new PirepUser(); User.Profil = Profil; User.Login = "******"; User.Password = Outils.Encrypt(""); User.URL = "ffs2play.fr"; Users.Add(User); ListUsers.SelectedNode = ListUsers.SelectedNode.Nodes.Add(Profil); tbProfil.Text = User.Profil; tbLogin.Text = User.Login; tbPassword.Text = ""; tbURL.Text = User.URL; ListUsers.ExpandAll(); btnSupprimer.Enabled = true; btnSupprimer.BackColor = Color.LightGray; btnSupprimer.ForeColor = Color.Black; SaveUsers(); }
private void UpdateUser() { if (position < 0) { return; } PirepUser User = Users[position]; User.Profil = tbProfil.Text; User.Login = tbLogin.Text; User.Password = Outils.Encrypt(tbPassword.Text); tbURL.Text = tbURL.Text.ToLower(); if (tbURL.Text.StartsWith("http://")) { tbURL.Text = tbURL.Text.Substring(7); } User.URL = tbURL.Text; ListUsers.SelectedNode.Text = User.Profil; Users[position] = User; }