private bool CheckPassword(PassItem pass) { if (Contains(pass)) { MessageBox.Show("Contains this id"); return(false); } if (string.IsNullOrWhiteSpace(pass.Title)) { MessageBox.Show("Title is empty"); return(false); } if (string.IsNullOrWhiteSpace(pass.Login) && pass.EnterWithLogin) { MessageBox.Show("No login set to \"Enter with login\""); return(false); } /* if (string.IsNullOrWhiteSpace(pass.Pass)) * { * MessageBox.Show("Password is empty"); * return false; * } */ /* if (string.IsNullOrWhiteSpace(pass.Description)) * { * MessageBox.Show("Description is empty"); * return false; * }*/ return(true); }
private static void SwapItems(PassItem pass1, PassItem pass2) { var tempId = pass1.Id; pass1.Id = pass2.Id; pass2.Id = tempId; }
private bool CheckPassword(PassItem pass) { if (Contains(pass)) { MessageBox.Show("Contains this id"); return(false); } if (string.IsNullOrWhiteSpace(pass.Title)) { MessageBox.Show("Title is empty"); return(false); } if (string.IsNullOrWhiteSpace(pass.Login)) { MessageBox.Show("Login is empty"); return(false); } if (string.IsNullOrWhiteSpace(pass.Pass)) { MessageBox.Show("Password is empty"); return(false); } if (string.IsNullOrWhiteSpace(pass.Description)) { MessageBox.Show("Description is empty"); return(false); } return(true); }
public EditPasswordForm(PassItem pass) { InitializeComponent(); if (pass == null) { pass = new PassItem(); } _passItem = pass; }
public void InitFromPass(PassItem backup) { this.Id = backup.Id; this.Title = backup.Title; this.Login = backup.Login; this.EnterWithLogin = backup.EnterWithLogin; this.Pass = backup.Pass; this.Description = backup.Description; }
private bool EditPassword(PassItem password) { do { var editPassForm = new EditPasswordForm(password); editPassForm.ShowDialog(); if (!editPassForm.Confirmed) { return(false); //was cancelled } } while (!CheckPassword(password)); return(true); }
private void btnAddPass_Click(object sender, EventArgs e) { var selectedIndex = lstPasses.SelectedIndex; var newPassword = new PassItem(); if (!EditPassword(newPassword)) { return; } _rootPassGroup.AddPass(newPassword); if (selectedIndex != -1 && selectedIndex != lstPasses.Items.Count - 1) { while (newPassword.Id > ((PassItem)lstPasses.SelectedItem).Id) { _rootPassGroup.Passwords.MoveUp(newPassword); } _rootPassGroup.Passwords.MoveDown(newPassword); } RegisterChange(); RefillPasswordsList(); }
private bool Contains(PassItem pass) { return(_connections.PcBase.Base.PassGroup.Any(a => a.Id == pass.Id && a != pass)); }
private bool EditPassword(PassItem password) { do { var editPassForm = new EditPasswordForm(password); editPassForm.ShowDialog(); if (!editPassForm.Confirmed) return false; //was cancelled } while (!CheckPassword(password)); return true; }
private bool Contains(PassItem pass) { return _connections.PcBase.Base.Passwords.Any(a => a.Id == pass.Id && a != pass); }
private bool CheckPassword(PassItem pass) { if (Contains(pass)) { MessageBox.Show("Contains this id"); return false; } if (string.IsNullOrWhiteSpace(pass.Title)) { MessageBox.Show("Title is empty"); return false; } if (string.IsNullOrWhiteSpace(pass.Login)) { MessageBox.Show("Login is empty"); return false; } if (string.IsNullOrWhiteSpace(pass.Pass)) { MessageBox.Show("Password is empty"); return false; } if (string.IsNullOrWhiteSpace(pass.Description)) { MessageBox.Show("Description is empty"); return false; } return true; }