コード例 #1
0
        public static CreatePropmt Edit(PasswordElement psw, Action <CreatePropmt> callback)
        {
            var pro = new CreatePropmt();

            pro.NameBox.Text     = psw.NameTag.Text;
            pro.PasswordBox.Text = psw.Password;
            pro.IconBox.Image    = psw.HasIcon ? psw.icon.Image : Properties.Resources.defaulticon;
            pro.Add.Text         = "Edit password";
            pro.Add.Click       += (s, m) => callback(pro);
            return(pro);
        }
コード例 #2
0
        public void ReplaceElement(PasswordElement oldpe, PasswordElement newpe)
        {
            if (!Elements.Contains(oldpe))
            {
                return;
            }
            var index = Elements.IndexOf(oldpe);

            Elements.RemoveAt(index);
            Elements.Insert(index, newpe);
        }
コード例 #3
0
 public void InsertElement(PasswordElement psw, bool save = true)
 {
     PasswordsGrid.Controls.Add(psw);
     Elements.Add(psw);
     psw.Delete.Click += (s, m) => {
         if (Windows.Ask("Are you sure you want to delete this password?", "Delete Password") == DialogResult.Yes)
         {
             PasswordsGrid.Controls.Remove(psw);
             Elements.Remove(psw);
             Save();
         }
     };
     if (save)
     {
         Save();
     }
 }