diff --git a/.gitignore b/.gitignore index 8b27cdc..defecbd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ Password\ Manager/bin Password\ Manager/obj -.vs +.vs/ diff --git a/.vs/Password Manager/v17/.suo b/.vs/Password Manager/v17/.suo index 5752c47..65fd6d0 100644 Binary files a/.vs/Password Manager/v17/.suo and b/.vs/Password Manager/v17/.suo differ diff --git a/Password Manager/Form1.Designer.cs b/Password Manager/Form1.Designer.cs index 6531c6b..4cd56c2 100644 --- a/Password Manager/Form1.Designer.cs +++ b/Password Manager/Form1.Designer.cs @@ -1,6 +1,6 @@ namespace Password_Manager { - partial class Form1 + partial class MainForm { /// /// Required designer variable. @@ -28,34 +28,46 @@ /// private void InitializeComponent() { - textBox1 = new TextBox(); - listBox1 = new ListBox(); + searchBox = new TextBox(); + resultList = new ListBox(); + profileSelection = new ComboBox(); SuspendLayout(); // // textBox1 // - textBox1.Location = new Point(23, 27); - textBox1.Name = "textBox1"; - textBox1.PlaceholderText = "Search for a password"; - textBox1.Size = new Size(257, 27); - textBox1.TabIndex = 0; + searchBox.Location = new Point(12, 27); + searchBox.Name = "textBox1"; + searchBox.PlaceholderText = "Search for a password"; + searchBox.Size = new Size(257, 27); + searchBox.TabIndex = 0; + searchBox.TextChanged += UpdateResultList; // // listBox1 // - listBox1.FormattingEnabled = true; - listBox1.ItemHeight = 20; - listBox1.Location = new Point(23, 99); - listBox1.Name = "listBox1"; - listBox1.Size = new Size(150, 104); - listBox1.TabIndex = 1; + resultList.FormattingEnabled = true; + resultList.ItemHeight = 20; + resultList.Location = new Point(12, 99); + resultList.Name = "listBox1"; + resultList.Size = new Size(150, 104); + resultList.TabIndex = 1; + // + // comboBox1 + // + profileSelection.FormattingEnabled = true; + profileSelection.Location = new Point(637, 26); + profileSelection.Name = "comboBox1"; + profileSelection.Size = new Size(151, 28); + profileSelection.TabIndex = 2; + profileSelection.SelectedIndexChanged += ChangeProfile; // // Form1 // AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(800, 450); - Controls.Add(listBox1); - Controls.Add(textBox1); + Controls.Add(profileSelection); + Controls.Add(resultList); + Controls.Add(searchBox); Name = "Form1"; Text = "Form1"; ResumeLayout(false); @@ -64,7 +76,8 @@ #endregion - private TextBox textBox1; - private ListBox listBox1; + private TextBox searchBox; + private ListBox resultList; + private ComboBox profileSelection; } } \ No newline at end of file diff --git a/Password Manager/Form1.cs b/Password Manager/Form1.cs index 87f1a45..8a55f13 100644 --- a/Password Manager/Form1.cs +++ b/Password Manager/Form1.cs @@ -1,10 +1,20 @@ namespace Password_Manager { - public partial class Form1 : Form + public partial class MainForm : Form { - public Form1() + public MainForm() { InitializeComponent(); } + + private void ChangeProfile(object sender, EventArgs e) + { + + } + + private void UpdateResultList(object sender, EventArgs args) + { + + } } } \ No newline at end of file diff --git a/Password Manager/Password_Store.cs b/Password Manager/Profile.cs similarity index 92% rename from Password Manager/Password_Store.cs rename to Password Manager/Profile.cs index 3b915bd..43a591e 100644 --- a/Password Manager/Password_Store.cs +++ b/Password Manager/Profile.cs @@ -4,7 +4,7 @@ namespace Password_Manager { public delegate void PasswordStoreChange(); - sealed class Password_Store + sealed class Profile { public string Name { get; } //the name of the password store profile ("personal", "work", or similar) public string Path { get; } //path of the folder containing the password store diff --git a/Password Manager/ProfileList.cs b/Password Manager/ProfileList.cs new file mode 100644 index 0000000..597c120 --- /dev/null +++ b/Password Manager/ProfileList.cs @@ -0,0 +1,62 @@ +using System; + +namespace Password_Manager +{ + sealed class ProfileList + { + private Profile[] list; + + public int Length + { + get + { + return this.list.Length; + } + } + + public Profile this[int index] + { + get + { + return this.list[index]; + } + } + + public ProfileList() + { + this.list = new Profile[0]; + } + + public void Add(Profile p) + { + //grow the list by 1 and copy all existing items + Profile[] tmp = new Profile[this.Length + 1]; + + for (int i = 0; i < this.Length; i++) + { + tmp[i] = this[i]; + } + + this.list = tmp; + + //-------------------------------------------------------- + + list[this.Length - 1] = p; + } + + public void Remove(Profile p) + { + Profile[] tmp = new Profile[this.Length - 1]; + + for (int i = 0; i < tmp.Length; i++) + { + if (this[i] != p) + { + tmp[i] = this[i]; + } + } + + this.list = tmp; + } + } +} diff --git a/Password Manager/Program.cs b/Password Manager/Program.cs index 2d53eb4..2c557ae 100644 --- a/Password Manager/Program.cs +++ b/Password Manager/Program.cs @@ -2,7 +2,6 @@ namespace Password_Manager { internal static class Program { - /// /// The main entry point for the application. /// @@ -12,12 +11,7 @@ namespace Password_Manager // To customize application configuration such as set high DPI settings or default font, // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); - Application.Run(new Form1()); - } - - static void UpdateList(TextBox textbox, ListBox listbox) - { - - } + Application.Run(new MainForm()); + } } } \ No newline at end of file