public void AddPassword(bool needChoosePasswordType)
        {
            var password = Document.Passwords.Add();

            if (!needChoosePasswordType && SelectedTab != null)
                password.PasswordType = SelectedTab.PasswordType;

            var args = new PasswordAddEventArgs(password, needChoosePasswordType);

            if (OnAddPassword != null)
                OnAddPassword(this, args);

            if (!args.Success)
            {
                Document.Passwords.Remove(password);
                return;
            }

            UpdateTabs();

            var tab = FindTypeTab(password.PasswordType);
            if (tab == null)
                return;

            tab.SelectedPassword = password;
            SelectedTab = tab;
        }
Example #2
0
        private void TcPasswordsOnAddPassword(object sender, PasswordAddEventArgs e)
        {
            if (e.NeedChoosePasswordType)
            {
                var passwordType = ViewTypesForm.ExecuteSelect(this, _document.Types);
                if (passwordType == null)
                    return;

                e.Password.PasswordType = passwordType;
            }

            if (!EditPasswordForm.Execute(this, _config.RootElement, e.Password))
                return;

            e.Success = true;
        }