private void 添加用户ToolStripMenuItem_Click(object sender, EventArgs e) { AddUser adduser = new AddUser(); adduser.ShowDialog(); if (adduser.IsAdd) { if (UserList == null) { UserList = new List <User>(); } if (UserList.Find(p => p.UserName == adduser.UserName) != null) { MessageBox.Show("用户名重复"); return; } if (!Directory.Exists(adduser.Path)) { MessageBox.Show("路径不存在"); return; } User tmp = new User() { UserName = adduser.UserName, Password = adduser.PassWord, Path = adduser.Path }; if (UserList == null) { UserList = new List <User>(); } UserList.Add(tmp); SaveUser(); LoadingUser(); } }
private void 添加用户ToolStripMenuItem_Click(object sender, EventArgs e) { AddUser adduser = new AddUser(); adduser.ShowDialog(); if (adduser.IsAdd) { if (UserList == null) UserList = new List<User>(); if (UserList.Find(p => p.UserName == adduser.UserName) != null) { MessageBox.Show("用户名重复"); return; } if (!Directory.Exists(adduser.Path)) { MessageBox.Show("路径不存在"); return; } User tmp = new User() { UserName=adduser.UserName, Password=adduser.PassWord, Path=adduser.Path }; if (UserList == null) UserList = new List<User>(); UserList.Add(tmp); SaveUser(); LoadingUser(); } }