예제 #1
0
 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;
     }
 }
예제 #2
0
 public static void Execute(IWin32Window owner, Configuration config)
 {
     using (var form = new ConfigForm())
     {
         form.Initialize(config);
         form.ShowDialog(owner);
     }
 }
예제 #3
0
        private void Init(PasswordDocument document, Configuration config)
        {
            _document = document;
            _config = config;

            FillComboBox();
            RefreshUI();
        }
예제 #4
0
        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;
        }
예제 #5
0
        public PasswordTypeTab(PasswordType passwordType, Configuration configuration)
        {
            InitializeComponent();

            Controls.Add(grid);

            Configuration = configuration;
            PasswordType = passwordType;

            Text = passwordType.Name;
        }
예제 #6
0
        public void Initialize(Configuration config)
        {
            _config = config;

            nPasswordLength.Value = _config.PasswordLength;
            tbAllowChars.Text = _config.AllowChars;

            cbAutoStart.Checked = _passwordAutostart.IsRegistred;

            Modified = false;
        }
예제 #7
0
        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;
            }
        }
예제 #8
0
        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);
        }