界面改进

This commit is contained in:
Chenx221 2023-08-21 18:45:49 +08:00
parent 586eb30e49
commit cec1889cea
4 changed files with 78 additions and 20 deletions

84
OTP/Form1.Designer.cs generated
View File

@ -32,8 +32,10 @@
this.label1 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.label2 = new System.Windows.Forms.Label();
this.circularProgressBar1 = new CircularProgressBar.CircularProgressBar();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// listBox1
@ -47,10 +49,11 @@
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(582, 53);
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(549, 59);
this.label1.MinimumSize = new System.Drawing.Size(197, 37);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(125, 25);
this.label1.Size = new System.Drawing.Size(197, 37);
this.label1.TabIndex = 1;
this.label1.Text = "TOTP Code";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@ -71,38 +74,85 @@
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(85, 51);
this.button2.TabIndex = 3;
this.button2.Text = "button1";
this.button2.Text = "Copy";
this.button2.UseVisualStyleBackColor = true;
//
// progressBar1
//
this.progressBar1.Location = new System.Drawing.Point(556, 161);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(176, 44);
this.progressBar1.TabIndex = 4;
//
// label2
//
this.label2.AutoSize = true;
this.label2.BackColor = System.Drawing.Color.Transparent;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(584, 174);
this.label2.Location = new System.Drawing.Point(584, 247);
this.label2.MinimumSize = new System.Drawing.Size(123, 20);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(123, 20);
this.label2.TabIndex = 5;
this.label2.Text = "Remaining Time";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// circularProgressBar1
//
this.circularProgressBar1.AnimationFunction = WinFormAnimation.KnownAnimationFunctions.Liner;
this.circularProgressBar1.AnimationSpeed = 500;
this.circularProgressBar1.BackColor = System.Drawing.Color.Transparent;
this.circularProgressBar1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.circularProgressBar1.ForeColor = System.Drawing.Color.White;
this.circularProgressBar1.InnerColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(73)))), ((int)(((byte)(94)))));
this.circularProgressBar1.InnerMargin = 2;
this.circularProgressBar1.InnerWidth = -1;
this.circularProgressBar1.Location = new System.Drawing.Point(587, 124);
this.circularProgressBar1.MarqueeAnimationSpeed = 2000;
this.circularProgressBar1.Maximum = 30;
this.circularProgressBar1.Name = "circularProgressBar1";
this.circularProgressBar1.OuterColor = System.Drawing.Color.White;
this.circularProgressBar1.OuterMargin = -25;
this.circularProgressBar1.OuterWidth = 26;
this.circularProgressBar1.ProgressColor = System.Drawing.Color.FromArgb(((int)(((byte)(52)))), ((int)(((byte)(150)))), ((int)(((byte)(218)))));
this.circularProgressBar1.ProgressWidth = 20;
this.circularProgressBar1.SecondaryFont = new System.Drawing.Font("Microsoft Sans Serif", 36F);
this.circularProgressBar1.Size = new System.Drawing.Size(120, 120);
this.circularProgressBar1.StartAngle = 270;
this.circularProgressBar1.SubscriptColor = System.Drawing.Color.Transparent;
this.circularProgressBar1.SubscriptMargin = new System.Windows.Forms.Padding(10, -35, 0, 0);
this.circularProgressBar1.SubscriptText = ".23";
this.circularProgressBar1.SuperscriptColor = System.Drawing.Color.Transparent;
this.circularProgressBar1.SuperscriptMargin = new System.Windows.Forms.Padding(10, 35, 0, 0);
this.circularProgressBar1.SuperscriptText = "°C";
this.circularProgressBar1.TabIndex = 6;
this.circularProgressBar1.Text = "time";
this.circularProgressBar1.TextMargin = new System.Windows.Forms.Padding(21, 2, 0, 0);
//
// button3
//
this.button3.Location = new System.Drawing.Point(556, 359);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(85, 23);
this.button3.TabIndex = 7;
this.button3.Text = "Settings";
this.button3.UseVisualStyleBackColor = true;
//
// button4
//
this.button4.Location = new System.Drawing.Point(647, 359);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(85, 23);
this.button4.TabIndex = 8;
this.button4.Text = "About";
this.button4.UseVisualStyleBackColor = true;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.ClientSize = new System.Drawing.Size(775, 400);
this.Controls.Add(this.button4);
this.Controls.Add(this.button3);
this.Controls.Add(this.label2);
this.Controls.Add(this.progressBar1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.label1);
this.Controls.Add(this.listBox1);
this.Controls.Add(this.circularProgressBar1);
this.Name = "Form1";
this.Text = "Main Window";
this.ResumeLayout(false);
@ -116,8 +166,10 @@
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.ProgressBar progressBar1;
private System.Windows.Forms.Label label2;
private CircularProgressBar.CircularProgressBar circularProgressBar1;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
}
}

View File

@ -32,10 +32,8 @@ namespace OTP
private void Timer_Tick(object sender, EventArgs e)
{
int remainingSeconds = totp.RemainingSeconds();
int totalSeconds = 30;
progressBar1.Value = (totalSeconds - remainingSeconds) * progressBar1.Maximum / totalSeconds;
label2.Text = remainingSeconds.ToString();
circularProgressBar1.Text = remainingSeconds.ToString();
circularProgressBar1.Value = remainingSeconds;
if (remainingSeconds == 30)
{
GenerateAndDisplayTotp();

View File

@ -33,6 +33,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="CircularProgressBar, Version=2.8.0.16, Culture=neutral, PublicKeyToken=310fd07b25df79b3, processorArchitecture=MSIL">
<HintPath>..\packages\CircularProgressBar.2.8.0.16\lib\net40\CircularProgressBar.dll</HintPath>
</Reference>
<Reference Include="Otp.NET, Version=1.3.0.0, Culture=neutral, PublicKeyToken=38a48df817e173a6, processorArchitecture=MSIL">
<HintPath>..\packages\Otp.NET.1.3.0\lib\net45\Otp.NET.dll</HintPath>
</Reference>
@ -52,6 +55,9 @@
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="WinFormAnimation, Version=1.6.0.4, Culture=neutral, PublicKeyToken=310fd07b25df79b3, processorArchitecture=MSIL">
<HintPath>..\packages\WinFormAnimation.1.6.0.4\lib\net40\WinFormAnimation.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">

View File

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CircularProgressBar" version="2.8.0.16" targetFramework="net481" />
<package id="Otp.NET" version="1.3.0" targetFramework="net481" />
<package id="System.IO" version="4.3.0" targetFramework="net481" />
<package id="WinFormAnimation" version="1.6.0.4" targetFramework="net481" />
</packages>