From 3ec6cae582316f0284a1c8e67472e2047c85498a Mon Sep 17 00:00:00 2001 From: hsl Date: Fri, 31 Mar 2017 20:23:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E7=AB=AF=E7=9A=84=E8=B4=A6?= =?UTF-8?q?=E6=88=B7=E6=94=AF=E6=8C=81=E4=BA=86=E6=B3=A8=E9=94=80=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E3=80=82[Client=20support=20account=20logout]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 软件系统客户端模版/FormMainWindow.Designer.cs | 26 ++++++++++++++----- 软件系统客户端模版/FormMainWindow.cs | 9 ++++++- 软件系统客户端模版/Program.cs | 14 +++++++++- 3 files changed, 41 insertions(+), 8 deletions(-) diff --git a/软件系统客户端模版/FormMainWindow.Designer.cs b/软件系统客户端模版/FormMainWindow.Designer.cs index 6dbe363..0ea2c1b 100644 --- a/软件系统客户端模版/FormMainWindow.Designer.cs +++ b/软件系统客户端模版/FormMainWindow.Designer.cs @@ -35,6 +35,7 @@ this.toolStripStatusLabel3 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel_status = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel4 = new System.Windows.Forms.ToolStripStatusLabel(); + this.toolStripStatusLabel_time = new System.Windows.Forms.ToolStripStatusLabel(); this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.管理员ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.更改公告ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -66,7 +67,7 @@ this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.label_Announcement = new System.Windows.Forms.Label(); - this.toolStripStatusLabel_time = new System.Windows.Forms.ToolStripStatusLabel(); + this.linkLabel_logout = new System.Windows.Forms.LinkLabel(); this.statusStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout(); this.panel1.SuspendLayout(); @@ -126,6 +127,13 @@ this.toolStripStatusLabel4.Size = new System.Drawing.Size(84, 17); this.toolStripStatusLabel4.Text = " 温馨提示:"; // + // toolStripStatusLabel_time + // + this.toolStripStatusLabel_time.ForeColor = System.Drawing.Color.Green; + this.toolStripStatusLabel_time.Name = "toolStripStatusLabel_time"; + this.toolStripStatusLabel_time.Size = new System.Drawing.Size(44, 17); + this.toolStripStatusLabel_time.Text = "时间:"; + // // menuStrip1 // this.menuStrip1.BackColor = System.Drawing.SystemColors.Control; @@ -236,6 +244,7 @@ // panel1 // this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.panel1.Controls.Add(this.linkLabel_logout); this.panel1.Controls.Add(this.label_factory); this.panel1.Controls.Add(this.label9); this.panel1.Controls.Add(this.label7); @@ -421,12 +430,16 @@ this.label_Announcement.Text = "[公告]"; this.label_Announcement.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // - // toolStripStatusLabel_time + // linkLabel_logout // - this.toolStripStatusLabel_time.ForeColor = System.Drawing.Color.Green; - this.toolStripStatusLabel_time.Name = "toolStripStatusLabel_time"; - this.toolStripStatusLabel_time.Size = new System.Drawing.Size(44, 17); - this.toolStripStatusLabel_time.Text = "时间:"; + this.linkLabel_logout.AutoSize = true; + this.linkLabel_logout.Location = new System.Drawing.Point(188, 1); + this.linkLabel_logout.Name = "linkLabel_logout"; + this.linkLabel_logout.Size = new System.Drawing.Size(32, 17); + this.linkLabel_logout.TabIndex = 16; + this.linkLabel_logout.TabStop = true; + this.linkLabel_logout.Text = "注销"; + this.linkLabel_logout.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel_logout_LinkClicked); // // FormMainWindow // @@ -497,6 +510,7 @@ private System.Windows.Forms.Label label9; private System.Windows.Forms.ToolStripMenuItem 注册账号ToolStripMenuItem; private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel_time; + private System.Windows.Forms.LinkLabel linkLabel_logout; } } diff --git a/软件系统客户端模版/FormMainWindow.cs b/软件系统客户端模版/FormMainWindow.cs index 24e0bc2..1fa1081 100644 --- a/软件系统客户端模版/FormMainWindow.cs +++ b/软件系统客户端模版/FormMainWindow.cs @@ -208,6 +208,12 @@ namespace 软件系统客户端模版 } } + private void linkLabel_logout_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + Program.QuitCode = 1; + Close(); + } + #endregion #region 异步网络块 @@ -318,8 +324,9 @@ namespace 软件系统客户端模版 })); } + #endregion - + } } diff --git a/软件系统客户端模版/Program.cs b/软件系统客户端模版/Program.cs index fe3002e..30aa84f 100644 --- a/软件系统客户端模版/Program.cs +++ b/软件系统客户端模版/Program.cs @@ -9,6 +9,10 @@ namespace 软件系统客户端模版 { static class Program { + /// + /// 指示了应用程序退出时的代码 + /// + public static int QuitCode { get; set; } = 0; /// /// 应用程序的主入口点。 /// @@ -39,11 +43,19 @@ namespace 软件系统客户端模版 //=================================================================== //运行主窗口之前先进行账户的验证 + P1: + FormLogin login = new FormLogin(); if (login.ShowDialog() == DialogResult.OK) { login.Dispose(); - Application.Run(new FormMainWindow()); + FormMainWindow fmw = new FormMainWindow(); + Application.Run(fmw); + if (QuitCode == 1) + { + //继续显示登录窗口 + goto P1; + } } else {