示例#1
0
        private void OkButton_Click(object sender, RoutedEventArgs e)
        {
            if (ValidateForm())
            {
                if (Mode == VaultEntryFormMode.Edit)
                {
                    this.CurrentEntry.Title    = titleTextBox.Text;
                    this.CurrentEntry.Login    = usernameTextBox.Text;
                    this.CurrentEntry.Password = passwordBox.Password;
                    this.CurrentEntry.Note     = notesTextBox.Text;
                    this.CurrentEntry.Url      = urlTextBox.Text;
                }
                else
                {
                    this.CurrentEntry = VaultManager.GenerateNewEntry(
                        titleTextBox.Text,
                        usernameTextBox.Text,
                        passwordBox.Password,
                        notesTextBox.Text,
                        urlTextBox.Text);
                }

                if (NewEntryOk != null)
                {
                    NewEntryOk(this.CurrentEntry);
                }
                this.Close();
            }
        }