diff --git a/MainForm.cs b/MainForm.cs index 452d703..6c3bce1 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -40,7 +40,7 @@ namespace steam_token if (null == config || null == config.SteamGuard || !SteamTwoFactorToken.Verify(config.SteamGuard.shared_secret)) { - OpenGuardConfigForm(); + OpenGuardConfigForm(true); } else { @@ -57,12 +57,12 @@ namespace steam_token /// 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); } diff --git a/UI/Set/GuardConfig.Designer.cs b/UI/Set/GuardConfig.Designer.cs index 45ff2b3..62ef467 100644 --- a/UI/Set/GuardConfig.Designer.cs +++ b/UI/Set/GuardConfig.Designer.cs @@ -36,6 +36,7 @@ namespace steam_token.UI.Set this.button_openfile = new System.Windows.Forms.Button(); this.label2 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); + this.button_exit = new System.Windows.Forms.Button(); this.SuspendLayout(); // // button_confirm @@ -100,6 +101,16 @@ namespace steam_token.UI.Set this.label3.TabIndex = 5; 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 // 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.textBox_shared_secret); this.Controls.Add(this.button_openfile); + this.Controls.Add(this.button_exit); this.Controls.Add(this.button_confirm); this.Font = new System.Drawing.Font("微软雅黑", 12F); 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.Label label2; private System.Windows.Forms.Label label3; + private System.Windows.Forms.Button button_exit; } } \ No newline at end of file diff --git a/UI/Set/GuardConfig.cs b/UI/Set/GuardConfig.cs index 2e477a5..fc507bb 100644 --- a/UI/Set/GuardConfig.cs +++ b/UI/Set/GuardConfig.cs @@ -19,11 +19,14 @@ namespace steam_token.UI.Set { private Label labelGuard; 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.progressBarRefresh = progressBar_refresh; - InitializeComponent(); // 先初始化组件 再使用 Config config = CommonUtil.GetConfig(); if (null != config && null != config.SteamGuard && !string.IsNullOrEmpty(config.SteamGuard.shared_secret)) @@ -110,5 +113,10 @@ namespace steam_token.UI.Set this.Dispose(); } } + + private void button_exit_Click(object sender, EventArgs e) + { + Environment.Exit(0); + } } }