From 3cccf070ab9cbfd031ddb5b59bff3e2ed4864f4c Mon Sep 17 00:00:00 2001 From: dathlin Date: Sat, 7 Oct 2017 21:32:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96=E9=87=8D?= =?UTF-8?q?=E6=9E=84=EF=BC=8C=E8=A7=92=E8=89=B2=E9=85=8D=E7=BD=AE=E5=B0=8F?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D=EF=BC=8C=E7=BB=A7=E7=BB=AD?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=AD=E8=8B=B1=E6=96=87=E6=94=AF=E6=8C=81?= =?UTF-8?q?=EF=BC=8Cv1.6.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FormInputNewRole.Designer.cs | 1 + .../AccountSupport/FormInputNewRole.cs | 37 ++++++- .../ClientConfiguration.Designer.cs | 22 ++--- .../GeneralConfiguration.Designer.cs | 28 +++--- .../ListConfiguration.Designer.cs | 16 ++-- .../Configuration/ListConfiguration.resx | 3 + .../RolesConfiguration.Designer.cs | 96 ++++++++++--------- .../Configuration/RolesConfiguration.cs | 75 +++++++++++++++ ClientsLibrary/UserClient.cs | 6 +- CommonLibrary/AccountSupport/RoleAssign.cs | 11 ++- .../ChineseLocalization.cs | 47 ++++++++- .../EnglishLocalization.cs | 50 +++++++++- .../LocalizationSupport/Localization.cs | 91 ++++++++++++++++-- .../ProtocolSupport/CommonProtocol.cs | 2 +- .../FormServerWindow.cs" | 4 +- 15 files changed, 382 insertions(+), 107 deletions(-) diff --git a/ClientsLibrary/AccountSupport/FormInputNewRole.Designer.cs b/ClientsLibrary/AccountSupport/FormInputNewRole.Designer.cs index 85e50c9..3441538 100644 --- a/ClientsLibrary/AccountSupport/FormInputNewRole.Designer.cs +++ b/ClientsLibrary/AccountSupport/FormInputNewRole.Designer.cs @@ -122,6 +122,7 @@ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "FormInputNewRole"; this.Load += new System.EventHandler(this.FormInputNewRole_Load); + this.Shown += new System.EventHandler(this.FormInputNewRole_Shown); this.ResumeLayout(false); this.PerformLayout(); diff --git a/ClientsLibrary/AccountSupport/FormInputNewRole.cs b/ClientsLibrary/AccountSupport/FormInputNewRole.cs index 865f503..2bd9ad6 100644 --- a/ClientsLibrary/AccountSupport/FormInputNewRole.cs +++ b/ClientsLibrary/AccountSupport/FormInputNewRole.cs @@ -28,7 +28,33 @@ namespace ClientsLibrary #endregion - #region Form Load + #region Localization Support + + /// + /// 本地化显示的操作,还未完成 + /// + private void UILocalization() + { + if(m_RoleItem == null) + { + Text = UserLocalization.Localization.AccountRoleAdd; + } + else + { + Text = UserLocalization.Localization.AccountRoleEdit; + } + + label1.Text = UserLocalization.Localization.GeneralUniqueID + ":"; + label2.Text = UserLocalization.Localization.GeneralName + ":"; + label3.Text = UserLocalization.Localization.GeneralDescription + ":"; + + userButton_login.UIText = UserLocalization.Localization.ButtonEnsure; + } + + + #endregion + + #region Form Load Show private void FormInputNewRole_Load(object sender, EventArgs e) @@ -39,6 +65,11 @@ namespace ClientsLibrary } } + private void FormInputNewRole_Shown(object sender, EventArgs e) + { + UILocalization(); + } + #endregion @@ -49,7 +80,7 @@ namespace ClientsLibrary { // 此处是编辑 m_RoleItem = roleItem; - + if (m_RoleItem != null) { textBox1.Text = m_RoleItem.RoleCode; @@ -107,5 +138,7 @@ namespace ClientsLibrary } #endregion + + } } diff --git a/ClientsLibrary/Configuration/ClientConfiguration.Designer.cs b/ClientsLibrary/Configuration/ClientConfiguration.Designer.cs index 71a81d5..cf12112 100644 --- a/ClientsLibrary/Configuration/ClientConfiguration.Designer.cs +++ b/ClientsLibrary/Configuration/ClientConfiguration.Designer.cs @@ -67,7 +67,7 @@ this.listBox1.ItemHeight = 17; this.listBox1.Location = new System.Drawing.Point(3, 51); this.listBox1.Name = "listBox1"; - this.listBox1.Size = new System.Drawing.Size(435, 327); + this.listBox1.Size = new System.Drawing.Size(552, 344); this.listBox1.TabIndex = 2; // // userButton_delete @@ -77,10 +77,10 @@ this.userButton_delete.CustomerInformation = ""; this.userButton_delete.EnableColor = System.Drawing.Color.FromArgb(((int)(((byte)(190)))), ((int)(((byte)(190)))), ((int)(((byte)(190))))); this.userButton_delete.Font = new System.Drawing.Font("微软雅黑", 9F); - this.userButton_delete.Location = new System.Drawing.Point(444, 51); + this.userButton_delete.Location = new System.Drawing.Point(477, 23); this.userButton_delete.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.userButton_delete.Name = "userButton_delete"; - this.userButton_delete.Size = new System.Drawing.Size(111, 27); + this.userButton_delete.Size = new System.Drawing.Size(78, 25); this.userButton_delete.TabIndex = 9; this.userButton_delete.UIText = "删除选中项"; this.userButton_delete.Click += new System.EventHandler(this.userButton_delete_Click); @@ -89,9 +89,9 @@ // this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.textBox1.Location = new System.Drawing.Point(3, 391); + this.textBox1.Location = new System.Drawing.Point(3, 406); this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(435, 23); + this.textBox1.Size = new System.Drawing.Size(552, 23); this.textBox1.TabIndex = 10; // // userButton1 @@ -101,10 +101,10 @@ this.userButton1.CustomerInformation = ""; this.userButton1.EnableColor = System.Drawing.Color.FromArgb(((int)(((byte)(190)))), ((int)(((byte)(190)))), ((int)(((byte)(190))))); this.userButton1.Font = new System.Drawing.Font("微软雅黑", 9F); - this.userButton1.Location = new System.Drawing.Point(444, 389); + this.userButton1.Location = new System.Drawing.Point(98, 436); this.userButton1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.userButton1.Name = "userButton1"; - this.userButton1.Size = new System.Drawing.Size(111, 27); + this.userButton1.Size = new System.Drawing.Size(98, 25); this.userButton1.TabIndex = 11; this.userButton1.UIText = "添加客户端标识"; this.userButton1.Click += new System.EventHandler(this.userButton1_Click); @@ -116,10 +116,10 @@ this.userButton2.CustomerInformation = ""; this.userButton2.EnableColor = System.Drawing.Color.FromArgb(((int)(((byte)(190)))), ((int)(((byte)(190)))), ((int)(((byte)(190))))); this.userButton2.Font = new System.Drawing.Font("微软雅黑", 9F); - this.userButton2.Location = new System.Drawing.Point(444, 354); + this.userButton2.Location = new System.Drawing.Point(3, 436); this.userButton2.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.userButton2.Name = "userButton2"; - this.userButton2.Size = new System.Drawing.Size(111, 27); + this.userButton2.Size = new System.Drawing.Size(89, 25); this.userButton2.TabIndex = 12; this.userButton2.UIText = "获取本机标识"; this.userButton2.Click += new System.EventHandler(this.userButton2_Click); @@ -131,10 +131,10 @@ this.userButton3.CustomerInformation = ""; this.userButton3.EnableColor = System.Drawing.Color.FromArgb(((int)(((byte)(190)))), ((int)(((byte)(190)))), ((int)(((byte)(190))))); this.userButton3.Font = new System.Drawing.Font("微软雅黑", 9F); - this.userButton3.Location = new System.Drawing.Point(444, 434); + this.userButton3.Location = new System.Drawing.Point(477, 436); this.userButton3.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.userButton3.Name = "userButton3"; - this.userButton3.Size = new System.Drawing.Size(111, 27); + this.userButton3.Size = new System.Drawing.Size(78, 25); this.userButton3.TabIndex = 13; this.userButton3.UIText = "保存"; this.userButton3.Click += new System.EventHandler(this.userButton3_Click); diff --git a/ClientsLibrary/Configuration/GeneralConfiguration.Designer.cs b/ClientsLibrary/Configuration/GeneralConfiguration.Designer.cs index ff4807e..01ec083 100644 --- a/ClientsLibrary/Configuration/GeneralConfiguration.Designer.cs +++ b/ClientsLibrary/Configuration/GeneralConfiguration.Designer.cs @@ -30,8 +30,8 @@ { this.checkBox1 = new System.Windows.Forms.CheckBox(); this.panel1 = new System.Windows.Forms.Panel(); - this.userButton2 = new HslCommunication.Controls.UserButton(); this.checkBox2 = new System.Windows.Forms.CheckBox(); + this.userButton2 = new HslCommunication.Controls.UserButton(); this.panel1.SuspendLayout(); this.SuspendLayout(); // @@ -55,9 +55,19 @@ this.panel1.Controls.Add(this.checkBox1); this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(561, 391); + this.panel1.Size = new System.Drawing.Size(561, 397); this.panel1.TabIndex = 1; // + // checkBox2 + // + this.checkBox2.AutoSize = true; + this.checkBox2.Location = new System.Drawing.Point(3, 30); + this.checkBox2.Name = "checkBox2"; + this.checkBox2.Size = new System.Drawing.Size(231, 21); + this.checkBox2.TabIndex = 1; + this.checkBox2.Text = "是否允许框架版本不匹配的客户端登录"; + this.checkBox2.UseVisualStyleBackColor = true; + // // userButton2 // this.userButton2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); @@ -65,24 +75,14 @@ this.userButton2.CustomerInformation = ""; this.userButton2.EnableColor = System.Drawing.Color.FromArgb(((int)(((byte)(190)))), ((int)(((byte)(190)))), ((int)(((byte)(190))))); this.userButton2.Font = new System.Drawing.Font("微软雅黑", 9F); - this.userButton2.Location = new System.Drawing.Point(503, 398); + this.userButton2.Location = new System.Drawing.Point(480, 404); this.userButton2.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.userButton2.Name = "userButton2"; - this.userButton2.Size = new System.Drawing.Size(55, 27); + this.userButton2.Size = new System.Drawing.Size(78, 25); this.userButton2.TabIndex = 10; this.userButton2.UIText = "保存"; this.userButton2.Click += new System.EventHandler(this.userButton2_Click); // - // checkBox2 - // - this.checkBox2.AutoSize = true; - this.checkBox2.Location = new System.Drawing.Point(3, 30); - this.checkBox2.Name = "checkBox2"; - this.checkBox2.Size = new System.Drawing.Size(231, 21); - this.checkBox2.TabIndex = 1; - this.checkBox2.Text = "是否允许框架版本不匹配的客户端登录"; - this.checkBox2.UseVisualStyleBackColor = true; - // // GeneralConfiguration // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); diff --git a/ClientsLibrary/Configuration/ListConfiguration.Designer.cs b/ClientsLibrary/Configuration/ListConfiguration.Designer.cs index a2f10b5..e2c39d0 100644 --- a/ClientsLibrary/Configuration/ListConfiguration.Designer.cs +++ b/ClientsLibrary/Configuration/ListConfiguration.Designer.cs @@ -67,10 +67,10 @@ this.userButton_login.CustomerInformation = ""; this.userButton_login.EnableColor = System.Drawing.Color.FromArgb(((int)(((byte)(190)))), ((int)(((byte)(190)))), ((int)(((byte)(190))))); this.userButton_login.Font = new System.Drawing.Font("微软雅黑", 9F); - this.userButton_login.Location = new System.Drawing.Point(3, 415); + this.userButton_login.Location = new System.Drawing.Point(3, 417); this.userButton_login.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.userButton_login.Name = "userButton_login"; - this.userButton_login.Size = new System.Drawing.Size(55, 27); + this.userButton_login.Size = new System.Drawing.Size(78, 25); this.userButton_login.TabIndex = 7; this.userButton_login.UIText = "新增"; this.userButton_login.Click += new System.EventHandler(this.userButton_login_Click); @@ -82,10 +82,10 @@ this.userButton1.CustomerInformation = ""; this.userButton1.EnableColor = System.Drawing.Color.FromArgb(((int)(((byte)(190)))), ((int)(((byte)(190)))), ((int)(((byte)(190))))); this.userButton1.Font = new System.Drawing.Font("微软雅黑", 9F); - this.userButton1.Location = new System.Drawing.Point(64, 415); + this.userButton1.Location = new System.Drawing.Point(87, 417); this.userButton1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.userButton1.Name = "userButton1"; - this.userButton1.Size = new System.Drawing.Size(55, 27); + this.userButton1.Size = new System.Drawing.Size(78, 25); this.userButton1.TabIndex = 8; this.userButton1.UIText = "删除"; this.userButton1.Click += new System.EventHandler(this.userButton1_Click); @@ -97,15 +97,15 @@ this.userButton2.CustomerInformation = ""; this.userButton2.EnableColor = System.Drawing.Color.FromArgb(((int)(((byte)(190)))), ((int)(((byte)(190)))), ((int)(((byte)(190))))); this.userButton2.Font = new System.Drawing.Font("微软雅黑", 9F); - this.userButton2.Location = new System.Drawing.Point(442, 415); + this.userButton2.Location = new System.Drawing.Point(419, 417); this.userButton2.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.userButton2.Name = "userButton2"; - this.userButton2.Size = new System.Drawing.Size(55, 27); + this.userButton2.Size = new System.Drawing.Size(78, 25); this.userButton2.TabIndex = 9; this.userButton2.UIText = "保存"; this.userButton2.Click += new System.EventHandler(this.userButton2_Click); // - // FactoryConfiguration + // ArrayConfiguration // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; @@ -115,7 +115,7 @@ this.Controls.Add(this.dataGridView1); this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); - this.Name = "FactoryConfiguration"; + this.Name = "ArrayConfiguration"; this.Size = new System.Drawing.Size(500, 446); this.Load += new System.EventHandler(this.FactoryConfiguration_Load); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); diff --git a/ClientsLibrary/Configuration/ListConfiguration.resx b/ClientsLibrary/Configuration/ListConfiguration.resx index e7a8f7a..d8eaf23 100644 --- a/ClientsLibrary/Configuration/ListConfiguration.resx +++ b/ClientsLibrary/Configuration/ListConfiguration.resx @@ -120,4 +120,7 @@ True + + True + \ No newline at end of file diff --git a/ClientsLibrary/Configuration/RolesConfiguration.Designer.cs b/ClientsLibrary/Configuration/RolesConfiguration.Designer.cs index 00101bc..0b55c12 100644 --- a/ClientsLibrary/Configuration/RolesConfiguration.Designer.cs +++ b/ClientsLibrary/Configuration/RolesConfiguration.Designer.cs @@ -35,13 +35,13 @@ this.userButton2 = new HslCommunication.Controls.UserButton(); this.userButton1 = new HslCommunication.Controls.UserButton(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.label4 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); this.listBox1 = new System.Windows.Forms.ListBox(); this.listBox2 = new System.Windows.Forms.ListBox(); this.userButton5 = new HslCommunication.Controls.UserButton(); - this.label3 = new System.Windows.Forms.Label(); - this.textBox1 = new System.Windows.Forms.TextBox(); - this.textBox2 = new System.Windows.Forms.TextBox(); - this.label4 = new System.Windows.Forms.Label(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); @@ -151,16 +151,57 @@ this.splitContainer1.SplitterDistance = 264; this.splitContainer1.TabIndex = 8; // + // textBox2 + // + this.textBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBox2.Location = new System.Drawing.Point(71, 396); + this.textBox2.Name = "textBox2"; + this.textBox2.ReadOnly = true; + this.textBox2.Size = new System.Drawing.Size(189, 23); + this.textBox2.TabIndex = 10; + // + // label4 + // + this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(2, 399); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(44, 17); + this.label4.TabIndex = 9; + this.label4.Text = "描述:"; + // + // textBox1 + // + this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBox1.Location = new System.Drawing.Point(71, 371); + this.textBox1.Name = "textBox1"; + this.textBox1.ReadOnly = true; + this.textBox1.Size = new System.Drawing.Size(189, 23); + this.textBox1.TabIndex = 8; + // + // label3 + // + this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(2, 374); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(44, 17); + this.label3.TabIndex = 7; + this.label3.Text = "代码:"; + // // listBox1 // this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.listBox1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.listBox1.FormattingEnabled = true; - this.listBox1.ItemHeight = 17; + this.listBox1.ItemHeight = 21; this.listBox1.Location = new System.Drawing.Point(3, 23); this.listBox1.Name = "listBox1"; - this.listBox1.Size = new System.Drawing.Size(257, 327); + this.listBox1.Size = new System.Drawing.Size(257, 340); this.listBox1.TabIndex = 6; this.listBox1.SelectedIndexChanged += new System.EventHandler(this.listBox1_SelectedIndexChanged); // @@ -169,8 +210,9 @@ this.listBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.listBox2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.listBox2.FormattingEnabled = true; - this.listBox2.ItemHeight = 17; + this.listBox2.ItemHeight = 21; this.listBox2.Location = new System.Drawing.Point(3, 23); this.listBox2.Name = "listBox2"; this.listBox2.Size = new System.Drawing.Size(258, 361); @@ -191,46 +233,6 @@ this.userButton5.UIText = "编辑"; this.userButton5.Click += new System.EventHandler(this.userButton5_Click); // - // label3 - // - this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(2, 367); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(44, 17); - this.label3.TabIndex = 7; - this.label3.Text = "代码:"; - // - // textBox1 - // - this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.textBox1.Location = new System.Drawing.Point(62, 364); - this.textBox1.Name = "textBox1"; - this.textBox1.ReadOnly = true; - this.textBox1.Size = new System.Drawing.Size(198, 23); - this.textBox1.TabIndex = 8; - // - // textBox2 - // - this.textBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.textBox2.Location = new System.Drawing.Point(62, 396); - this.textBox2.Name = "textBox2"; - this.textBox2.ReadOnly = true; - this.textBox2.Size = new System.Drawing.Size(198, 23); - this.textBox2.TabIndex = 10; - // - // label4 - // - this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(2, 399); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(44, 17); - this.label4.TabIndex = 9; - this.label4.Text = "描述:"; - // // RolesConfiguration // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); diff --git a/ClientsLibrary/Configuration/RolesConfiguration.cs b/ClientsLibrary/Configuration/RolesConfiguration.cs index 79ba282..1970f1c 100644 --- a/ClientsLibrary/Configuration/RolesConfiguration.cs +++ b/ClientsLibrary/Configuration/RolesConfiguration.cs @@ -14,13 +14,23 @@ namespace ClientsLibrary.Configuration { public partial class RolesConfiguration : UserControl { + #region Constructor + + public RolesConfiguration() { InitializeComponent(); } + + #endregion + + #region Control Load + + private void RolesConfiguration_Load(object sender, EventArgs e) { + UILocalization(); // 初始化 OperateResultString result = UserClient.Net_simplify_client.ReadFromServer(CommonLibrary.CommonHeadCode.SimplifyHeadCode.请求角色配置, ""); @@ -40,6 +50,11 @@ namespace ClientsLibrary.Configuration } } + + #endregion + + #region Role Select + private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { if(listBox1.SelectedItem is RoleItem role) @@ -50,6 +65,11 @@ namespace ClientsLibrary.Configuration } } + #endregion + + #region Role Delete + + private void userButton2_Click(object sender, EventArgs e) { // delete list item @@ -63,6 +83,12 @@ namespace ClientsLibrary.Configuration } } + + #endregion + + #region Role Exist Check + + private bool CheckRoleWhetherExisting(string roleName) { foreach(var m in listBox1.Items) @@ -89,6 +115,11 @@ namespace ClientsLibrary.Configuration return false; } + + #endregion + + #region Role Add + private void userButton1_Click(object sender, EventArgs e) { using (FormInputNewRole form = new FormInputNewRole()) @@ -109,6 +140,11 @@ namespace ClientsLibrary.Configuration } } + #endregion + + #region Role Edit + + private void userButton5_Click(object sender, EventArgs e) { if (listBox1.SelectedItem is RoleItem role) @@ -131,11 +167,21 @@ namespace ClientsLibrary.Configuration textBox1.Text = role.RoleCode; textBox2.Text = role.Description; + + // refresh + //for (int i = 0; i < listBox1.Items.Count; i++) + // listBox1.Items[i] = listBox1.Items[i]; + listBox1.Items[listBox1.SelectedIndex] = listBox1.Items[listBox1.SelectedIndex]; } } } } + #endregion + + #region Role Account Edit + + private void userButton3_Click(object sender, EventArgs e) { if (listBox1.SelectedItem is RoleItem role) @@ -152,6 +198,10 @@ namespace ClientsLibrary.Configuration } } + #endregion + + #region Role Upload Server + private void userButton4_Click(object sender, EventArgs e) { // save @@ -176,5 +226,30 @@ namespace ClientsLibrary.Configuration } } + #endregion + + #region Localization Support + + /// + /// 本地化显示的操作,还未完成 + /// + private void UILocalization() + { + + label1.Text = UserLocalization.Localization.AccountRoleNameList; + label2.Text = UserLocalization.Localization.AccountRoleAccountList; + label3.Text = UserLocalization.Localization.GeneralUniqueID; + label4.Text = UserLocalization.Localization.GeneralDescription; + + userButton1.UIText = UserLocalization.Localization.ButtonAdd; + userButton5.UIText = UserLocalization.Localization.ButtonEdit; + userButton2.UIText = UserLocalization.Localization.ButtonDelete; + + userButton3.UIText = UserLocalization.Localization.ButtonEdit; + userButton4.UIText = UserLocalization.Localization.ButtonSave; + } + + + #endregion } } diff --git a/ClientsLibrary/UserClient.cs b/ClientsLibrary/UserClient.cs index 1837334..3c18cb0 100644 --- a/ClientsLibrary/UserClient.cs +++ b/ClientsLibrary/UserClient.cs @@ -110,14 +110,14 @@ namespace ClientsLibrary /// /// 检查当前账户是否有role角色的权限 /// - /// 角色名称 + /// 角色名称 /// - public static bool CheckUserAccountRole(string role) + public static bool CheckUserAccountRole(string roleCode) { JObject json = new JObject { { "Name", UserAccount.UserName }, - { "Role", role } + { "Role", roleCode } }; HslCommunication.OperateResultString result = Net_simplify_client.ReadFromServer(CommonHeadCode.SimplifyHeadCode.检查角色权限, json.ToString()); diff --git a/CommonLibrary/AccountSupport/RoleAssign.cs b/CommonLibrary/AccountSupport/RoleAssign.cs index b8dd9c4..4cd8380 100644 --- a/CommonLibrary/AccountSupport/RoleAssign.cs +++ b/CommonLibrary/AccountSupport/RoleAssign.cs @@ -62,18 +62,21 @@ namespace CommonLibrary #region Public Method - public bool IsAllowAccountOperate(string role,string name) + public bool IsAllowAccountOperate(string roleCode,string name) { bool result = false; hybirdLock.Enter(); for (int i = 0; i < m_roles.Count; i++) { - if (m_roles[i].RoleName == role) + if (m_roles[i].RoleCode == roleCode) { - if(m_roles[i].Accounts.Contains(name)) + if (m_roles[i].Accounts != null) { - result = true; + if (m_roles[i].Accounts.Contains(name)) + { + result = true; + } } } } diff --git a/CommonLibrary/LocalizationSupport/ChineseLocalization.cs b/CommonLibrary/LocalizationSupport/ChineseLocalization.cs index 5a08d27..6bc0400 100644 --- a/CommonLibrary/LocalizationSupport/ChineseLocalization.cs +++ b/CommonLibrary/LocalizationSupport/ChineseLocalization.cs @@ -9,8 +9,49 @@ namespace CommonLibrary public class ChineseLocalization : ILocalization { public string FormateDateTime { get; set; } = "yyyy-MM-dd HH:mm:ss"; + /// + /// 唯一标识 + /// + public string GeneralUniqueID { get; set; } = "唯一标识"; + /// + /// 名称 + /// + public string GeneralName { get; set; } = "名称"; + /// + /// 描述 + /// + public string GeneralDescription { get; set; } = "描述"; + + + + #region 按钮相关 + + /// + /// 确认 + /// public string ButtonEnsure { get; set; } = "确认"; + /// + /// 新增 + /// + public string ButtonAdd { get; set; } = "新增"; + /// + /// 编辑 + /// + public string ButtonEdit { get; set; } = "编辑"; + /// + /// 删除 + /// + public string ButtonDelete { get; set; } = "删除"; + /// + /// 保存 + /// + public string ButtonSave { get; set; } = "保存"; + /// + /// 取消 + /// + public string ButtonCancel { get; set; } = "取消"; + #endregion #region 账户相关 @@ -33,10 +74,12 @@ namespace CommonLibrary public string AccountPortrait { get; set; } = "头像"; public string AccountDetails { get; set; } = "账户详细信息"; public string AccountRegisterTitle { get; set; } = "注册一个新的账户"; - + public string AccountRoleAdd { get; set; } = "角色新增"; + public string AccountRoleEdit { get; set; } = "角色编辑"; + public string AccountRoleNameList { get; set; } = "角色名称列表"; + public string AccountRoleAccountList { get; set; } = "关联账户列表"; #endregion - #region 配置相关 public string SettingsText { get; set; } = "配置系统的参数"; diff --git a/CommonLibrary/LocalizationSupport/EnglishLocalization.cs b/CommonLibrary/LocalizationSupport/EnglishLocalization.cs index 9216d98..b453aeb 100644 --- a/CommonLibrary/LocalizationSupport/EnglishLocalization.cs +++ b/CommonLibrary/LocalizationSupport/EnglishLocalization.cs @@ -8,12 +8,51 @@ namespace CommonLibrary public class EnglishLocalization : ILocalization { public string FormateDateTime { get; set; } = "yyyy/MM/dd HH:mm:ss"; - public string ButtonEnsure { get; set; } = "Sure"; + /// + /// 唯一标识 + /// + public string GeneralUniqueID { get; set; } = "Unique ID"; + /// + /// 名称 + /// + public string GeneralName { get; set; } = "Name"; + /// + /// 描述 + /// + public string GeneralDescription { get; set; } = "Descrition"; + + #region 按钮相关 + /// + /// 确认 + /// + public string ButtonEnsure { get; set; } = "Sure"; + /// + /// 新增 + /// + public string ButtonAdd { get; set; } = "Add"; + /// + /// 编辑 + /// + public string ButtonEdit { get; set; } = "Edit"; + /// + /// 删除 + /// + public string ButtonDelete { get; set; } = "Delete"; + /// + /// 保存 + /// + public string ButtonSave { get; set; } = "Save"; + /// + /// 取消 + /// + public string ButtonCancel { get; set; } = "Cancel"; + + #endregion #region 账户相关 - + public string AccountSelect { get; set; } = "Select"; @@ -33,11 +72,12 @@ namespace CommonLibrary public string AccountPortrait { get; set; } = "Portrait"; public string AccountDetails { get; set; } = "Account Details"; public string AccountRegisterTitle { get; set; } = "Register a new account"; - - + public string AccountRoleAdd { get; set; } = "Role add new"; + public string AccountRoleEdit { get; set; } = "Role edit"; + public string AccountRoleNameList { get; set; } = "Roles List"; + public string AccountRoleAccountList { get; set; } = "Account of selected role"; #endregion - #region 配置相关 public string SettingsText { get; set; } = "System parameters settings"; diff --git a/CommonLibrary/LocalizationSupport/Localization.cs b/CommonLibrary/LocalizationSupport/Localization.cs index 9879036..83c05b0 100644 --- a/CommonLibrary/LocalizationSupport/Localization.cs +++ b/CommonLibrary/LocalizationSupport/Localization.cs @@ -17,10 +17,6 @@ namespace CommonLibrary /// public static class UserLocalization { - /// - /// 默认的语言选项 - /// - public static ILocalization Localization = new ChineseLocalization(); /// /// 设置系统的语言选项 @@ -30,24 +26,99 @@ namespace CommonLibrary { if(language.ToLower() == "chinese") { - Localization = Chinese; + localization = Chinese; + } + else + { + localization = English; + } + } + + /// + /// 获取当前指定的语言选项信息 + /// + /// + /// + public static ILocalization GetSpecifiedLocalization(string language) + { + if (language.ToLower() == "chinese") + { + return Chinese; } else { - Localization = English; + return English; } } - private static ILocalization Chinese = new ChineseLocalization(); - private static ILocalization English = new EnglishLocalization(); + + /// + /// 默认的语言选项 + /// + public static ILocalization Localization + { + get { return localization; } + } + + + + private static ILocalization Chinese = new ChineseLocalization(); // 中文语言 + private static ILocalization English = new EnglishLocalization(); // 英文语言 + private static ILocalization localization = Chinese; // 当前语言 } + /// + /// 所有支持的语言必须从本接口继承 + /// public interface ILocalization { string FormateDateTime { get; set; } + + /// + /// 唯一标识 + /// + string GeneralUniqueID { get; set;} + /// + /// 名称 + /// + string GeneralName { get; set; } + /// + /// 描述 + /// + string GeneralDescription { get; set; } + + + + + #region 按钮相关 + + /// + /// 确认 + /// string ButtonEnsure { get; set; } + /// + /// 新增 + /// + string ButtonAdd { get; set; } + /// + /// 编辑 + /// + string ButtonEdit { get; set; } + /// + /// 删除 + /// + string ButtonDelete { get; set; } + /// + /// 保存 + /// + string ButtonSave { get; set; } + /// + /// 取消 + /// + string ButtonCancel { get; set; } + #endregion #region 账户相关 @@ -69,6 +140,10 @@ namespace CommonLibrary string AccountPortrait { get; set; } string AccountDetails { get; set; } string AccountRegisterTitle { get; set; } + string AccountRoleAdd { get; set; } + string AccountRoleEdit { get; set; } + string AccountRoleNameList { get; set; } // 角色名称列表 + string AccountRoleAccountList { get; set; } //关联账户列表 #endregion diff --git a/CommonLibrary/ProtocolSupport/CommonProtocol.cs b/CommonLibrary/ProtocolSupport/CommonProtocol.cs index 1c38bbf..c34a27d 100644 --- a/CommonLibrary/ProtocolSupport/CommonProtocol.cs +++ b/CommonLibrary/ProtocolSupport/CommonProtocol.cs @@ -45,7 +45,7 @@ namespace CommonLibrary * **************************************************************************/ - SoftBasic.FrameworkVersion = new SystemVersion("1.6.2"); + SoftBasic.FrameworkVersion = new SystemVersion("1.6.3"); } diff --git "a/\350\275\257\344\273\266\347\263\273\347\273\237\346\234\215\345\212\241\347\253\257\346\250\241\347\211\210/FormServerWindow.cs" "b/\350\275\257\344\273\266\347\263\273\347\273\237\346\234\215\345\212\241\347\253\257\346\250\241\347\211\210/FormServerWindow.cs" index 82f8435..d2c6edb 100644 --- "a/\350\275\257\344\273\266\347\263\273\347\273\237\346\234\215\345\212\241\347\253\257\346\250\241\347\211\210/FormServerWindow.cs" +++ "b/\350\275\257\344\273\266\347\263\273\347\273\237\346\234\215\345\212\241\347\253\257\346\250\241\347\211\210/FormServerWindow.cs" @@ -697,8 +697,8 @@ namespace 软件系统服务端模版 { JObject json = JObject.Parse(data); string name = SoftBasic.GetValueFromJsonObject(json, "Name", ""); - string role = SoftBasic.GetValueFromJsonObject(json, "Role", ""); - net_simplify_server.SendMessage(state, handle, UserServer.ServerRoles.IsAllowAccountOperate(role, name).ToString()); + string roleCode = SoftBasic.GetValueFromJsonObject(json, "Role", ""); + net_simplify_server.SendMessage(state, handle, UserServer.ServerRoles.IsAllowAccountOperate(roleCode, name).ToString()); } else { -- GitLab