public static bool Execute(IWin32Window owner, Configuration configuration, Password.Classes.Password password) { using (var form = new EditPasswordForm()) { form.Init(configuration, password); return form.ShowDialog(owner) == DialogResult.OK; } }
public static void Execute(IWin32Window owner, Configuration config) { using (var form = new ConfigForm()) { form.Initialize(config); form.ShowDialog(owner); } }
private void Init(PasswordDocument document, Configuration config) { _document = document; _config = config; FillComboBox(); RefreshUI(); }
public static string CreatePassword(Configuration config) { string result = string.Empty; for (int i = 0; i < config.PasswordLength; i++) result += config.AllowChars[_random.Next(config.AllowChars.Length)]; return result; }
public PasswordTypeTab(PasswordType passwordType, Configuration configuration) { InitializeComponent(); Controls.Add(grid); Configuration = configuration; PasswordType = passwordType; Text = passwordType.Name; }
public void Initialize(Configuration config) { _config = config; nPasswordLength.Value = _config.PasswordLength; tbAllowChars.Text = _config.AllowChars; cbAutoStart.Checked = _passwordAutostart.IsRegistred; Modified = false; }
public static bool Execute(IWin32Window owner, PasswordDocument document, Configuration config, out PasswordType result) { using (var form = new SelectTypeForm()) { form.Init(document, config); if (form.ShowDialog(owner) == DialogResult.OK) { result = form.SelectedType; return true; } result = null; return false; } }
private void Init(Configuration configuration, Password.Classes.Password password) { tpMain.RowCount = password.Values.Count + 1; int i = 0; foreach (var passwordValue in password.Values) { tpMain.RowStyles[i].SizeType = SizeType.AutoSize; Control editor; if (passwordValue.Field.IsEncrypt) { editor = new PasswordTextBox { Configuration = configuration, Title = passwordValue.Field.Name }; } else { editor = new LabeledTextBox { Title = passwordValue.Field.Name }; } editor.Dock = DockStyle.Fill; editor.Margin = new Padding(8, i == 0 ? 8 : 3, 8, 0); editor.Text = passwordValue.Value; editor.Tag = passwordValue; tpMain.Controls.Add(editor, 0, i); tpMain.SetColumnSpan(editor, 2); i++; } CreateButtons(password.Values.Count); ClientSize = tpMain.Size; MinimumSize = new Size(200, Size.Height); MaximumSize = new Size(800, Size.Height); }