Пример #1
0
 public PasswordFolder(Folder folder, Password password, PasswordFolder parent)
     : base()
 {
     this.Folder = folder;
     this.Password = password;
     this.Parent = parent;
 }
Пример #2
0
 public Field(Password password, int id, string name, FieldType type, object value, short order)
     : base(id, name)
 {
     this.Password = password;
     this.Type = type;
     if (IsString) ChangeSecureString(value, false); else this.value = value;
     this.Order = order;
 }
Пример #3
0
        /// <summary>
        /// Creates a new password for this <see cref="Category"/>.
        /// </summary>
        /// <returns>The new  <see cref="T:PasswordSafe.Data.Biz.Category"/></returns>
        public Password CreatePassword()
        {
            Password newPassword = new Password(this, 0, "New Password");

            short order = 0;
            foreach (TemplateField tempField in this.Fields)
            {
                Field field = new Field(newPassword, 0, tempField.Name, tempField.Type, null, order++);
                newPassword.Fields.Add(field);
            }

            this.Passwords.Add(newPassword);
            return newPassword;
        }
Пример #4
0
 public PasswordFolder(Folder folder, Password password)
     : base()
 {
     this.Folder = folder;
     this.Password = password;
 }
Пример #5
0
        private void SetPasswords(IEnumerable<Password> passwords)
        {
            if (filterThread != null)
            {
                filterThread.Abort();
                filterThread.Join();
            }

            if (!string.IsNullOrEmpty(SearchText))
            {
                filterThread = new Thread(delegate(object text)
                    {
                        passwords = FilteredPasswords(passwords, text as string);
                        this.Dispatcher.Invoke((ThreadStart)delegate()
                        {
                            Passwords = passwords != null ? new ObservableCollection<Password>(passwords) : null;
                            if (Passwords != null) SelectedPassword = Passwords.FirstOrDefault();
                        });
                    });
                filterThread.Start(SearchText);
            }
            else
            {
                Passwords = passwords != null ? new ObservableCollection<Password>(passwords) : null;
                if (Passwords != null) SelectedPassword = Passwords.FirstOrDefault();
            }
        }
Пример #6
0
 private bool MatchFilter(Password password, string text)
 {
     if (password.Name.IndexOf(text, StringComparison.InvariantCultureIgnoreCase) >= 0) return true;
     foreach (Field field in password.Fields)
     {
         string value = field.StringValue;
         if (value!=null && value.IndexOf(text, StringComparison.InvariantCultureIgnoreCase) >= 0) return true;
     }
     return false;
 }
Пример #7
0
 protected virtual void OnSelectedPasswordChanged(object sender, Password oldPassword, Password newPassword)
 {
 }