角色管理器优化,可更改角色名,描述信息,客户端主界面测试中英文切换,v1.6.2

This commit is contained in:
dathlin
2017-10-07 10:52:36 +08:00
parent 44a511c62a
commit f248effb4c
21 changed files with 911 additions and 43 deletions

View File

@@ -0,0 +1,140 @@
namespace ClientsLibrary
{
partial class FormInputNewRole
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.userButton_login = new HslCommunication.Controls.UserButton();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 21);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(68, 17);
this.label1.TabIndex = 0;
this.label1.Text = "唯一标识:";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(86, 18);
this.textBox1.Name = "textBox1";
this.textBox1.ReadOnly = true;
this.textBox1.Size = new System.Drawing.Size(347, 23);
this.textBox1.TabIndex = 1;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 51);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(44, 17);
this.label2.TabIndex = 2;
this.label2.Text = "名称:";
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(86, 48);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(347, 23);
this.textBox2.TabIndex = 3;
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(86, 79);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(347, 23);
this.textBox3.TabIndex = 5;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(12, 82);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(44, 17);
this.label3.TabIndex = 4;
this.label3.Text = "描述:";
//
// userButton_login
//
this.userButton_login.BackColor = System.Drawing.Color.Transparent;
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(168, 109);
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(108, 27);
this.userButton_login.TabIndex = 9;
this.userButton_login.UIText = "确认";
this.userButton_login.Click += new System.EventHandler(this.userButton_login_Click);
//
// FormInputNewRole
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(445, 142);
this.Controls.Add(this.userButton_login);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.label3);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.label2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label1);
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.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(461, 181);
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(461, 181);
this.Name = "FormInputNewRole";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "FormInputNewRole";
this.Load += new System.EventHandler(this.FormInputNewRole_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Label label3;
private HslCommunication.Controls.UserButton userButton_login;
}
}

View File

@@ -0,0 +1,111 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CommonLibrary;
namespace ClientsLibrary
{
/// <summary>
/// 用户输入或者编辑新的角色内容
/// </summary>
public partial class FormInputNewRole : Form
{
#region Constructor
public FormInputNewRole()
{
InitializeComponent();
Icon = UserClient.GetFormWindowIcon();
}
#endregion
#region Form Load
private void FormInputNewRole_Load(object sender, EventArgs e)
{
if (m_RoleItem == null)
{
textBox1.Text = Guid.NewGuid().ToString("N");
}
}
#endregion
#region Show Dialog
public DialogResult ShowDialog(RoleItem roleItem)
{
// 此处是编辑
m_RoleItem = roleItem;
if (m_RoleItem != null)
{
textBox1.Text = m_RoleItem.RoleCode;
textBox2.Text = m_RoleItem.RoleName;
textBox3.Text = m_RoleItem.Description;
}
return ShowDialog();
}
#endregion
#region Public Property
public RoleItem RoleItem
{
get { return m_RoleItem; }
}
public string RoleName
{
get { return textBox2.Text; }
}
public string RoleDescription
{
get { return textBox3.Text; }
}
#endregion
#region Private Members
private RoleItem m_RoleItem;
#endregion
#region Save
private void userButton_login_Click(object sender, EventArgs e)
{
if(m_RoleItem == null)
{
m_RoleItem = new RoleItem()
{
RoleCode = textBox1.Text,
RoleName = textBox2.Text,
Description = textBox3.Text,
};
}
DialogResult = DialogResult.OK;
}
#endregion
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -43,6 +43,8 @@ namespace ClientsLibrary
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.comboBox2 = new System.Windows.Forms.ComboBox();
this.comboBox_factory = new System.Windows.Forms.ComboBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label1
@@ -56,22 +58,22 @@ namespace ClientsLibrary
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(98, 15);
this.textBox1.Location = new System.Drawing.Point(129, 15);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(232, 23);
this.textBox1.Size = new System.Drawing.Size(201, 23);
this.textBox1.TabIndex = 1;
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(98, 51);
this.textBox2.Location = new System.Drawing.Point(129, 83);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(232, 23);
this.textBox2.Size = new System.Drawing.Size(201, 23);
this.textBox2.TabIndex = 3;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(21, 54);
this.label2.Location = new System.Drawing.Point(21, 86);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(44, 17);
this.label2.TabIndex = 2;
@@ -80,7 +82,7 @@ namespace ClientsLibrary
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(21, 90);
this.label3.Location = new System.Drawing.Point(21, 122);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(44, 17);
this.label3.TabIndex = 4;
@@ -89,7 +91,7 @@ namespace ClientsLibrary
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(21, 125);
this.label4.Location = new System.Drawing.Point(21, 157);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(44, 17);
this.label4.TabIndex = 6;
@@ -98,7 +100,7 @@ namespace ClientsLibrary
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(21, 161);
this.label5.Location = new System.Drawing.Point(21, 193);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(68, 17);
this.label5.TabIndex = 8;
@@ -106,15 +108,15 @@ namespace ClientsLibrary
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(98, 192);
this.textBox4.Location = new System.Drawing.Point(129, 224);
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(232, 23);
this.textBox4.Size = new System.Drawing.Size(201, 23);
this.textBox4.TabIndex = 11;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(21, 195);
this.label6.Location = new System.Drawing.Point(21, 227);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(68, 17);
this.label6.TabIndex = 10;
@@ -126,7 +128,7 @@ namespace ClientsLibrary
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(149, 279);
this.userButton_login.Location = new System.Drawing.Point(129, 284);
this.userButton_login.Margin = new System.Windows.Forms.Padding(3, 5, 3, 5);
this.userButton_login.Name = "userButton_login";
this.userButton_login.Size = new System.Drawing.Size(97, 31);
@@ -138,34 +140,52 @@ namespace ClientsLibrary
//
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(98, 122);
this.comboBox1.Location = new System.Drawing.Point(129, 154);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(232, 25);
this.comboBox1.Size = new System.Drawing.Size(201, 25);
this.comboBox1.TabIndex = 13;
//
// comboBox2
//
this.comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox2.FormattingEnabled = true;
this.comboBox2.Location = new System.Drawing.Point(98, 157);
this.comboBox2.Location = new System.Drawing.Point(129, 189);
this.comboBox2.Name = "comboBox2";
this.comboBox2.Size = new System.Drawing.Size(232, 25);
this.comboBox2.Size = new System.Drawing.Size(201, 25);
this.comboBox2.TabIndex = 14;
//
// comboBox_factory
//
this.comboBox_factory.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox_factory.FormattingEnabled = true;
this.comboBox_factory.Location = new System.Drawing.Point(98, 86);
this.comboBox_factory.Location = new System.Drawing.Point(129, 118);
this.comboBox_factory.Name = "comboBox_factory";
this.comboBox_factory.Size = new System.Drawing.Size(232, 25);
this.comboBox_factory.Size = new System.Drawing.Size(201, 25);
this.comboBox_factory.TabIndex = 15;
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(129, 48);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(201, 23);
this.textBox3.TabIndex = 17;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(21, 51);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(44, 17);
this.label7.TabIndex = 16;
this.label7.Text = "别名:";
//
// FormRegisterAccount
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(382, 342);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.label7);
this.Controls.Add(this.comboBox_factory);
this.Controls.Add(this.comboBox2);
this.Controls.Add(this.comboBox1);
@@ -207,5 +227,7 @@ namespace ClientsLibrary
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.ComboBox comboBox2;
private System.Windows.Forms.ComboBox comboBox_factory;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Label label7;
}
}

View File

@@ -49,8 +49,32 @@ namespace ClientsLibrary
comboBox_factory.DataSource = Factories.ToArray();
textBox4.Text = (new UserAccount()).ForbidMessage;
UILocalization();
}
#endregion
#region Localization Support
/// <summary>
/// 本地化显示的操作,还未完成
/// </summary>
private void UILocalization()
{
Text = UserLocalization.Localization.AccountRegisterTitle;
label1.Text = UserLocalization.Localization.AccountName + "";
label7.Text = UserLocalization.Localization.AccountAlias + "";
label2.Text = UserLocalization.Localization.AccountPassword + "";
label3.Text = UserLocalization.Localization.AccountFactory + "";
label4.Text = UserLocalization.Localization.AccountGrade + "";
label5.Text = UserLocalization.Localization.AccountLoginEnable + "";
label6.Text = UserLocalization.Localization.AccountForbidMessage + "";
}
#endregion
#region Register Account
@@ -61,6 +85,7 @@ namespace ClientsLibrary
// 点击了注册,先获取数据
UserAccount account = new UserAccount();
account.UserName = textBox1.Text;
account.NameAlias = textBox3.Text;
account.Password = textBox2.Text;
account.Factory = comboBox_factory.SelectedItem.ToString();
switch (comboBox1.SelectedIndex)