Browse Source

fix: 第一次启动提供退出按钮

master
niushuai233 3 years ago
parent
commit
36c38a4c4c
  1. 8
      MainForm.cs
  2. 13
      UI/Set/GuardConfig.Designer.cs
  3. 12
      UI/Set/GuardConfig.cs

8
MainForm.cs

@ -40,7 +40,7 @@ namespace steam_token
if (null == config || null == config.SteamGuard || !SteamTwoFactorToken.Verify(config.SteamGuard.shared_secret)) if (null == config || null == config.SteamGuard || !SteamTwoFactorToken.Verify(config.SteamGuard.shared_secret))
{ {
OpenGuardConfigForm(); OpenGuardConfigForm(true);
} }
else else
{ {
@ -57,12 +57,12 @@ namespace steam_token
/// <param name="e"></param> /// <param name="e"></param>
private void GuardToolStripMenuItem_Click(object sender, EventArgs e) private void GuardToolStripMenuItem_Click(object sender, EventArgs e)
{ {
OpenGuardConfigForm(); OpenGuardConfigForm(false);
} }
private void OpenGuardConfigForm() private void OpenGuardConfigForm(bool flag)
{ {
GuardConfig guard = new GuardConfig(this.label_guard, this.progressBar_refresh); GuardConfig guard = new GuardConfig(this.label_guard, this.progressBar_refresh, flag);
guard.ShowDialog(this); guard.ShowDialog(this);
} }

13
UI/Set/GuardConfig.Designer.cs generated

@ -36,6 +36,7 @@ namespace steam_token.UI.Set
this.button_openfile = new System.Windows.Forms.Button(); this.button_openfile = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.button_exit = new System.Windows.Forms.Button();
this.SuspendLayout(); this.SuspendLayout();
// //
// button_confirm // button_confirm
@ -100,6 +101,16 @@ namespace steam_token.UI.Set
this.label3.TabIndex = 5; this.label3.TabIndex = 5;
this.label3.Text = "Tips: 手机需root或者能通过备份手段拿到该文件"; this.label3.Text = "Tips: 手机需root或者能通过备份手段拿到该文件";
// //
// button_exit
//
this.button_exit.Location = new System.Drawing.Point(359, 97);
this.button_exit.Name = "button_exit";
this.button_exit.Size = new System.Drawing.Size(85, 30);
this.button_exit.TabIndex = 1;
this.button_exit.Text = "退出";
this.button_exit.UseVisualStyleBackColor = true;
this.button_exit.Click += new System.EventHandler(this.button_exit_Click);
//
// GuardConfig // GuardConfig
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F); this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
@ -111,6 +122,7 @@ namespace steam_token.UI.Set
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
this.Controls.Add(this.textBox_shared_secret); this.Controls.Add(this.textBox_shared_secret);
this.Controls.Add(this.button_openfile); this.Controls.Add(this.button_openfile);
this.Controls.Add(this.button_exit);
this.Controls.Add(this.button_confirm); this.Controls.Add(this.button_confirm);
this.Font = new System.Drawing.Font("微软雅黑", 12F); this.Font = new System.Drawing.Font("微软雅黑", 12F);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
@ -133,5 +145,6 @@ namespace steam_token.UI.Set
private System.Windows.Forms.Button button_openfile; private System.Windows.Forms.Button button_openfile;
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button button_exit;
} }
} }

12
UI/Set/GuardConfig.cs

@ -19,11 +19,14 @@ namespace steam_token.UI.Set
{ {
private Label labelGuard; private Label labelGuard;
private ProgressBar progressBarRefresh; private ProgressBar progressBarRefresh;
public GuardConfig(Label label_guard, ProgressBar progressBar_refresh) public GuardConfig(Label label_guard, ProgressBar progressBar_refresh, bool flag)
{ {
InitializeComponent();
this.button_exit.Visible = flag;
this.labelGuard = label_guard; this.labelGuard = label_guard;
this.progressBarRefresh = progressBar_refresh; this.progressBarRefresh = progressBar_refresh;
InitializeComponent();
// 先初始化组件 再使用 // 先初始化组件 再使用
Config config = CommonUtil.GetConfig(); Config config = CommonUtil.GetConfig();
if (null != config && null != config.SteamGuard && !string.IsNullOrEmpty(config.SteamGuard.shared_secret)) if (null != config && null != config.SteamGuard && !string.IsNullOrEmpty(config.SteamGuard.shared_secret))
@ -110,5 +113,10 @@ namespace steam_token.UI.Set
this.Dispose(); this.Dispose();
} }
} }
private void button_exit_Click(object sender, EventArgs e)
{
Environment.Exit(0);
}
} }
} }

Loading…
Cancel
Save