New dialog for adding profiles

This commit is contained in:
Miskolczi Richárd
2023-03-24 13:01:49 +01:00
parent bc08238545
commit b06568fb27
9 changed files with 201 additions and 4 deletions

Binary file not shown.

View File

@@ -31,9 +31,8 @@ namespace Password_Manager
private void AddProfile(object sender, EventArgs e)
{
Fields.ListOfProfiles.Add(new Profile("tmp", @"C:\Users\RichardMiskolczi\pass"));
Fields.CurrentProfile = Fields.ListOfProfiles[0]; //temporary
ProfileChange(sender, e);
NewProfileForm npf = new NewProfileForm();
npf.Show();
}
}
}

View File

@@ -0,0 +1,106 @@
namespace Password_Manager
{
partial class NewProfileForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
button1 = new Button();
button2 = new Button();
button3 = new Button();
nameTextBox = new TextBox();
pathTextBox = new TextBox();
SuspendLayout();
//
// button1
//
button1.Location = new Point(212, 45);
button1.Name = "button1";
button1.Size = new Size(94, 29);
button1.TabIndex = 0;
button1.Text = "Browse";
button1.UseVisualStyleBackColor = true;
button1.Click += ChooseFolder;
//
// button2
//
button2.Location = new Point(161, 78);
button2.Name = "button2";
button2.Size = new Size(145, 29);
button2.TabIndex = 1;
button2.Text = "Save";
button2.UseVisualStyleBackColor = true;
//
// button3
//
button3.Location = new Point(12, 78);
button3.Name = "button3";
button3.Size = new Size(145, 29);
button3.TabIndex = 2;
button3.Text = "Cancel";
button3.UseVisualStyleBackColor = true;
//
// textBox1
//
nameTextBox.Location = new Point(12, 12);
nameTextBox.Name = "textBox1";
nameTextBox.PlaceholderText = "Work";
nameTextBox.Size = new Size(194, 27);
nameTextBox.TabIndex = 3;
//
// textBox2
//
pathTextBox.Location = new Point(12, 45);
pathTextBox.Name = "textBox2";
pathTextBox.PlaceholderText = "C:\\Passwords";
pathTextBox.Size = new Size(194, 27);
pathTextBox.TabIndex = 4;
//
// NewProfileForm
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(317, 127);
Controls.Add(pathTextBox);
Controls.Add(nameTextBox);
Controls.Add(button3);
Controls.Add(button2);
Controls.Add(button1);
Name = "NewProfileForm";
Text = "NewProfileForm";
ResumeLayout(false);
PerformLayout();
}
#endregion
private Button button1;
private Button button2;
private Button button3;
private TextBox nameTextBox;
private TextBox pathTextBox;
}
}

View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Password_Manager
{
public partial class NewProfileForm : Form
{
public NewProfileForm()
{
InitializeComponent();
}
private void ChooseFolder(object sender, EventArgs e)
{
FolderBrowserDialog dialog = new FolderBrowserDialog();
if (dialog.ShowDialog() == DialogResult.OK)
{
pathTextBox.Text = dialog.SelectedPath;
}
}
}
}

View File

@@ -0,0 +1,60 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -1,7 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Compile Update="Form1.cs">
<Compile Update="MainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="NewProfileForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="ResultListBox.cs">