diff --git a/OTP/Form1.Designer.cs b/OTP/Form1.Designer.cs
index 3e6907b..9a88935 100644
--- a/OTP/Form1.Designer.cs
+++ b/OTP/Form1.Designer.cs
@@ -37,7 +37,6 @@
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
- this.button6 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// listBox1
@@ -75,7 +74,7 @@
this.button2.Enabled = false;
this.button2.Location = new System.Drawing.Point(647, 294);
this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(85, 81);
+ this.button2.Size = new System.Drawing.Size(85, 111);
this.button2.TabIndex = 3;
this.button2.Text = "Copy";
this.button2.UseVisualStyleBackColor = true;
@@ -134,6 +133,7 @@
this.button3.TabIndex = 7;
this.button3.Text = "Manage";
this.button3.UseVisualStyleBackColor = true;
+ this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button4
//
@@ -153,21 +153,11 @@
this.button5.Text = "About";
this.button5.UseVisualStyleBackColor = true;
//
- // button6
- //
- this.button6.Location = new System.Drawing.Point(647, 381);
- this.button6.Name = "button6";
- this.button6.Size = new System.Drawing.Size(85, 23);
- this.button6.TabIndex = 10;
- this.button6.Text = "QR Code";
- this.button6.UseVisualStyleBackColor = true;
- //
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(775, 440);
- this.Controls.Add(this.button6);
this.Controls.Add(this.button5);
this.Controls.Add(this.button4);
this.Controls.Add(this.button3);
@@ -195,7 +185,6 @@
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
- private System.Windows.Forms.Button button6;
}
}
diff --git a/OTP/Form1.cs b/OTP/Form1.cs
index 5120a24..32f4c2f 100644
--- a/OTP/Form1.cs
+++ b/OTP/Form1.cs
@@ -70,5 +70,17 @@ namespace OTP
{
Clipboard.SetText(label1.Text);
}
+
+ private void button3_Click(object sender, EventArgs e)
+ {
+ // 创建 Form2 实例
+ Form2 form2 = new Form2();
+
+ // 显示新创建的 Form2 实例
+ form2.Show();
+
+ // 隐藏当前的 Form1 实例
+ this.Hide();
+ }
}
}
diff --git a/OTP/Form2.Designer.cs b/OTP/Form2.Designer.cs
index d2ffca9..95e921f 100644
--- a/OTP/Form2.Designer.cs
+++ b/OTP/Form2.Designer.cs
@@ -28,19 +28,103 @@
///
private void InitializeComponent()
{
+ this.panel1 = new System.Windows.Forms.Panel();
+ this.dataGridView1 = new System.Windows.Forms.DataGridView();
+ this.button1 = new System.Windows.Forms.Button();
+ this.button2 = new System.Windows.Forms.Button();
+ this.button3 = new System.Windows.Forms.Button();
+ this.button4 = new System.Windows.Forms.Button();
+ this.panel1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.SuspendLayout();
//
+ // panel1
+ //
+ this.panel1.Controls.Add(this.dataGridView1);
+ this.panel1.Location = new System.Drawing.Point(12, 12);
+ this.panel1.Name = "panel1";
+ this.panel1.Size = new System.Drawing.Size(595, 287);
+ this.panel1.TabIndex = 0;
+ //
+ // dataGridView1
+ //
+ this.dataGridView1.AllowUserToAddRows = false;
+ this.dataGridView1.AllowUserToDeleteRows = false;
+ this.dataGridView1.AllowUserToResizeColumns = false;
+ this.dataGridView1.AllowUserToResizeRows = false;
+ this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
+ this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.dataGridView1.Location = new System.Drawing.Point(0, 0);
+ this.dataGridView1.Name = "dataGridView1";
+ this.dataGridView1.ReadOnly = true;
+ this.dataGridView1.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False;
+ this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
+ this.dataGridView1.Size = new System.Drawing.Size(595, 287);
+ this.dataGridView1.TabIndex = 0;
+ //
+ // button1
+ //
+ this.button1.Location = new System.Drawing.Point(60, 314);
+ this.button1.Name = "button1";
+ this.button1.Size = new System.Drawing.Size(107, 41);
+ this.button1.TabIndex = 1;
+ this.button1.Text = "New Record";
+ this.button1.UseVisualStyleBackColor = true;
+ this.button1.Click += new System.EventHandler(this.button1_Click);
+ //
+ // button2
+ //
+ this.button2.Location = new System.Drawing.Point(187, 314);
+ this.button2.Name = "button2";
+ this.button2.Size = new System.Drawing.Size(107, 41);
+ this.button2.TabIndex = 2;
+ this.button2.Text = "Delete Record(s)";
+ this.button2.UseVisualStyleBackColor = true;
+ //
+ // button3
+ //
+ this.button3.Location = new System.Drawing.Point(314, 314);
+ this.button3.Name = "button3";
+ this.button3.Size = new System.Drawing.Size(107, 41);
+ this.button3.TabIndex = 3;
+ this.button3.Text = "Save Changes";
+ this.button3.UseVisualStyleBackColor = true;
+ //
+ // button4
+ //
+ this.button4.Location = new System.Drawing.Point(439, 314);
+ this.button4.Name = "button4";
+ this.button4.Size = new System.Drawing.Size(107, 41);
+ this.button4.TabIndex = 4;
+ this.button4.Text = "Discard Changes";
+ this.button4.UseVisualStyleBackColor = true;
+ //
// Form2
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(619, 367);
+ this.Controls.Add(this.button4);
+ this.Controls.Add(this.button3);
+ this.Controls.Add(this.button2);
+ this.Controls.Add(this.button1);
+ this.Controls.Add(this.panel1);
this.Name = "Form2";
this.Text = "Data Manage";
+ this.panel1.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.ResumeLayout(false);
}
#endregion
+
+ private System.Windows.Forms.Panel panel1;
+ private System.Windows.Forms.DataGridView dataGridView1;
+ private System.Windows.Forms.Button button1;
+ private System.Windows.Forms.Button button2;
+ private System.Windows.Forms.Button button3;
+ private System.Windows.Forms.Button button4;
}
}
\ No newline at end of file
diff --git a/OTP/Form2.cs b/OTP/Form2.cs
index 7c04a2f..d541d75 100644
--- a/OTP/Form2.cs
+++ b/OTP/Form2.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
+using System.Data.SQLite;
using System.Drawing;
using System.Linq;
using System.Text;
@@ -12,9 +13,52 @@ namespace OTP
{
public partial class Form2 : Form
{
+ private string connectionString = "Data Source=key.db;Version=3;";
+
public Form2()
{
InitializeComponent();
+ InitializeDataGridView();
+ LoadData();
+ }
+
+ private void InitializeDataGridView()
+ {
+ dataGridView1.Columns.Add("Title", "Title"); // 添加 Title 列
+ }
+ private void LoadData()
+ {
+ dataGridView1.Rows.Clear(); // 清空现有数据
+
+ using (SQLiteConnection connection = new SQLiteConnection(connectionString))
+ {
+ connection.Open();
+
+ using (SQLiteCommand command = new SQLiteCommand("SELECT Title FROM TotpData", connection))
+ {
+ using (SQLiteDataReader reader = command.ExecuteReader())
+ {
+ while (reader.Read())
+ {
+ dataGridView1.Rows.Add(reader.GetString(0));
+ }
+ }
+ }
+ }
+ }
+
+ private void button1_Click(object sender, EventArgs e)
+ {
+ using (Form3 form3 = new Form3())
+ {
+ DialogResult result = form3.ShowDialog();
+
+ if (result == DialogResult.OK)
+ {
+ // 在 Form3 中添加数据完成后,刷新数据
+ LoadData();
+ }
+ }
}
}
}
diff --git a/OTP/Form3.Designer.cs b/OTP/Form3.Designer.cs
new file mode 100644
index 0000000..8baa49d
--- /dev/null
+++ b/OTP/Form3.Designer.cs
@@ -0,0 +1,158 @@
+namespace OTP
+{
+ partial class Form3
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.label1 = new System.Windows.Forms.Label();
+ this.textBox1 = new System.Windows.Forms.TextBox();
+ this.label2 = new System.Windows.Forms.Label();
+ this.textBox2 = new System.Windows.Forms.TextBox();
+ this.button1 = new System.Windows.Forms.Button();
+ this.button2 = new System.Windows.Forms.Button();
+ this.button3 = new System.Windows.Forms.Button();
+ this.button4 = new System.Windows.Forms.Button();
+ this.button5 = new System.Windows.Forms.Button();
+ this.SuspendLayout();
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(26, 9);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(27, 13);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "Title";
+ //
+ // textBox1
+ //
+ this.textBox1.Location = new System.Drawing.Point(72, 6);
+ this.textBox1.Name = "textBox1";
+ this.textBox1.Size = new System.Drawing.Size(202, 20);
+ this.textBox1.TabIndex = 1;
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(12, 37);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(54, 13);
+ this.label2.TabIndex = 2;
+ this.label2.Text = "secretKey";
+ //
+ // textBox2
+ //
+ this.textBox2.Location = new System.Drawing.Point(72, 34);
+ this.textBox2.Name = "textBox2";
+ this.textBox2.Size = new System.Drawing.Size(202, 20);
+ this.textBox2.TabIndex = 3;
+ //
+ // button1
+ //
+ this.button1.Location = new System.Drawing.Point(92, 62);
+ this.button1.Name = "button1";
+ this.button1.Size = new System.Drawing.Size(75, 23);
+ this.button1.TabIndex = 4;
+ this.button1.Text = "Add";
+ this.button1.UseVisualStyleBackColor = true;
+ //
+ // button2
+ //
+ this.button2.Location = new System.Drawing.Point(183, 62);
+ this.button2.Name = "button2";
+ this.button2.Size = new System.Drawing.Size(75, 23);
+ this.button2.TabIndex = 5;
+ this.button2.Text = "Cancel";
+ this.button2.UseVisualStyleBackColor = true;
+ //
+ // button3
+ //
+ this.button3.Location = new System.Drawing.Point(292, 4);
+ this.button3.Name = "button3";
+ this.button3.Size = new System.Drawing.Size(117, 23);
+ this.button3.TabIndex = 6;
+ this.button3.Text = "Screenshot Scan";
+ this.button3.UseVisualStyleBackColor = true;
+ //
+ // button4
+ //
+ this.button4.Location = new System.Drawing.Point(292, 33);
+ this.button4.Name = "button4";
+ this.button4.Size = new System.Drawing.Size(117, 23);
+ this.button4.TabIndex = 7;
+ this.button4.Text = "Camera Scan";
+ this.button4.UseVisualStyleBackColor = true;
+ //
+ // button5
+ //
+ this.button5.Location = new System.Drawing.Point(292, 62);
+ this.button5.Name = "button5";
+ this.button5.Size = new System.Drawing.Size(117, 23);
+ this.button5.TabIndex = 8;
+ this.button5.Text = "Import from Clipboard";
+ this.button5.UseVisualStyleBackColor = true;
+ //
+ // Form3
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.CancelButton = this.button2;
+ this.ClientSize = new System.Drawing.Size(418, 96);
+ this.Controls.Add(this.button5);
+ this.Controls.Add(this.button4);
+ this.Controls.Add(this.button3);
+ this.Controls.Add(this.button2);
+ this.Controls.Add(this.button1);
+ this.Controls.Add(this.textBox2);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.textBox1);
+ this.Controls.Add(this.label1);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "Form3";
+ this.ShowIcon = false;
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ this.Text = "New Record";
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.TextBox textBox1;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.TextBox textBox2;
+ private System.Windows.Forms.Button button1;
+ private System.Windows.Forms.Button button2;
+ private System.Windows.Forms.Button button3;
+ private System.Windows.Forms.Button button4;
+ private System.Windows.Forms.Button button5;
+ }
+}
\ No newline at end of file
diff --git a/OTP/Form3.cs b/OTP/Form3.cs
new file mode 100644
index 0000000..8654182
--- /dev/null
+++ b/OTP/Form3.cs
@@ -0,0 +1,22 @@
+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 OTP
+{
+ public partial class Form3 : Form
+ {
+ public Form3()
+ {
+ InitializeComponent();
+ }
+
+
+ }
+}
diff --git a/OTP/Form3.resx b/OTP/Form3.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/OTP/Form3.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/OTP/OTP.csproj b/OTP/OTP.csproj
index 1f50d66..509888e 100644
--- a/OTP/OTP.csproj
+++ b/OTP/OTP.csproj
@@ -91,6 +91,12 @@
Form2.cs
+
+ Form
+
+
+ Form3.cs
+
@@ -99,6 +105,9 @@
Form2.cs
+
+ Form3.cs
+
ResXFileCodeGenerator
Resources.Designer.cs
@@ -108,6 +117,9 @@
True
Resources.resx
+
+ Always
+
SettingsSingleFileGenerator
diff --git a/OTP/key.db b/OTP/key.db
index c34521c..e4fbb03 100644
Binary files a/OTP/key.db and b/OTP/key.db differ