客户端新增系统配置界面,集中处理系统配置功能,完成信任客户端列表功能,v1.4.7
This commit is contained in:
@@ -23,6 +23,7 @@ namespace ClientsLibrary
|
||||
public FormAccountDetails(UserPortrait userPortrait)
|
||||
{
|
||||
InitializeComponent();
|
||||
Icon = UserClient.GetFormWindowIcon();
|
||||
UserPortrait = userPortrait;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace ClientsLibrary
|
||||
public FormRegisterAccount(string[] factories)
|
||||
{
|
||||
InitializeComponent();
|
||||
Icon = UserClient.GetFormWindowIcon();
|
||||
|
||||
net_client = UserClient.Net_simplify_client;
|
||||
Factories = new List<string>(factories);
|
||||
|
||||
@@ -25,6 +25,9 @@ namespace ClientsLibrary
|
||||
public FormDownloading(int customer,Action<OperateResultString> action)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Icon = UserClient.GetFormWindowIcon();
|
||||
|
||||
net_cmd = customer;
|
||||
DealWithResult = action;
|
||||
DoubleBuffered = true;
|
||||
|
||||
@@ -68,6 +68,18 @@
|
||||
<Compile Include="BasicSupport\FormShowMachineId.Designer.cs">
|
||||
<DependentUpon>FormShowMachineId.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Configuration\ClientConfiguration.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Configuration\ClientConfiguration.Designer.cs">
|
||||
<DependentUpon>ClientConfiguration.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Configuration\GeneralConfiguration.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Configuration\GeneralConfiguration.Designer.cs">
|
||||
<DependentUpon>GeneralConfiguration.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Configuration\ListConfiguration.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
@@ -117,6 +129,12 @@
|
||||
<EmbeddedResource Include="BasicSupport\FormShowMachineId.resx">
|
||||
<DependentUpon>FormShowMachineId.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Configuration\ClientConfiguration.resx">
|
||||
<DependentUpon>ClientConfiguration.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Configuration\GeneralConfiguration.resx">
|
||||
<DependentUpon>GeneralConfiguration.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Configuration\ListConfiguration.resx">
|
||||
<DependentUpon>ListConfiguration.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
175
ClientsLibrary/Configuration/ClientConfiguration.Designer.cs
generated
Normal file
175
ClientsLibrary/Configuration/ClientConfiguration.Designer.cs
generated
Normal file
@@ -0,0 +1,175 @@
|
||||
namespace ClientsLibrary.Configuration
|
||||
{
|
||||
partial class ClientConfiguration
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要修改
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.checkBox1 = new System.Windows.Forms.CheckBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.listBox1 = new System.Windows.Forms.ListBox();
|
||||
this.userButton_delete = new HslCommunication.Controls.UserButton();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.userButton1 = new HslCommunication.Controls.UserButton();
|
||||
this.userButton2 = new HslCommunication.Controls.UserButton();
|
||||
this.userButton3 = new HslCommunication.Controls.UserButton();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// checkBox1
|
||||
//
|
||||
this.checkBox1.AutoSize = true;
|
||||
this.checkBox1.Location = new System.Drawing.Point(3, 3);
|
||||
this.checkBox1.Name = "checkBox1";
|
||||
this.checkBox1.Size = new System.Drawing.Size(183, 21);
|
||||
this.checkBox1.TabIndex = 0;
|
||||
this.checkBox1.Text = "是否强制启用指定客户端登录";
|
||||
this.checkBox1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(34)))), ((int)(((byte)(34)))), ((int)(((byte)(34)))));
|
||||
this.label1.Location = new System.Drawing.Point(0, 31);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(92, 17);
|
||||
this.label1.TabIndex = 1;
|
||||
this.label1.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.FormattingEnabled = true;
|
||||
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.TabIndex = 2;
|
||||
//
|
||||
// userButton_delete
|
||||
//
|
||||
this.userButton_delete.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.userButton_delete.BackColor = System.Drawing.Color.Transparent;
|
||||
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.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.TabIndex = 9;
|
||||
this.userButton_delete.UIText = "删除选中项";
|
||||
this.userButton_delete.Click += new System.EventHandler(this.userButton_delete_Click);
|
||||
//
|
||||
// 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(3, 391);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(435, 23);
|
||||
this.textBox1.TabIndex = 10;
|
||||
//
|
||||
// userButton1
|
||||
//
|
||||
this.userButton1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.userButton1.BackColor = System.Drawing.Color.Transparent;
|
||||
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.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.TabIndex = 11;
|
||||
this.userButton1.UIText = "添加客户端标识";
|
||||
this.userButton1.Click += new System.EventHandler(this.userButton1_Click);
|
||||
//
|
||||
// userButton2
|
||||
//
|
||||
this.userButton2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.userButton2.BackColor = System.Drawing.Color.Transparent;
|
||||
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.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.TabIndex = 12;
|
||||
this.userButton2.UIText = "获取本机标识";
|
||||
this.userButton2.Click += new System.EventHandler(this.userButton2_Click);
|
||||
//
|
||||
// userButton3
|
||||
//
|
||||
this.userButton3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.userButton3.BackColor = System.Drawing.Color.Transparent;
|
||||
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.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.TabIndex = 13;
|
||||
this.userButton3.UIText = "保存";
|
||||
this.userButton3.Click += new System.EventHandler(this.userButton3_Click);
|
||||
//
|
||||
// ClientConfiguration
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.userButton3);
|
||||
this.Controls.Add(this.userButton2);
|
||||
this.Controls.Add(this.userButton1);
|
||||
this.Controls.Add(this.textBox1);
|
||||
this.Controls.Add(this.userButton_delete);
|
||||
this.Controls.Add(this.listBox1);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.checkBox1);
|
||||
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 = "ClientConfiguration";
|
||||
this.Size = new System.Drawing.Size(558, 465);
|
||||
this.Load += new System.EventHandler(this.ClientConfiguration_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.CheckBox checkBox1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.ListBox listBox1;
|
||||
private HslCommunication.Controls.UserButton userButton_delete;
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
private HslCommunication.Controls.UserButton userButton1;
|
||||
private HslCommunication.Controls.UserButton userButton2;
|
||||
private HslCommunication.Controls.UserButton userButton3;
|
||||
}
|
||||
}
|
||||
96
ClientsLibrary/Configuration/ClientConfiguration.cs
Normal file
96
ClientsLibrary/Configuration/ClientConfiguration.cs
Normal file
@@ -0,0 +1,96 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using HslCommunication;
|
||||
|
||||
namespace ClientsLibrary.Configuration
|
||||
{
|
||||
public partial class ClientConfiguration : UserControl
|
||||
{
|
||||
public ClientConfiguration()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void userButton_delete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(listBox1.SelectedItem!=null)
|
||||
{
|
||||
listBox1.Items.Remove(listBox1.SelectedItem);
|
||||
}
|
||||
}
|
||||
|
||||
private void userButton2_Click(object sender, EventArgs e)
|
||||
{
|
||||
textBox1.Text = UserClient.JsonSettings.SystemInfo;
|
||||
}
|
||||
|
||||
private void userButton1_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(textBox1.Text)) return;
|
||||
|
||||
if(!listBox1.Items.Contains(textBox1.Text))
|
||||
{
|
||||
listBox1.Items.Add(textBox1.Text);
|
||||
}
|
||||
}
|
||||
|
||||
private void ClientConfiguration_Load(object sender, EventArgs e)
|
||||
{
|
||||
// 初始化
|
||||
|
||||
OperateResultString result = UserClient.Net_simplify_client.ReadFromServer(CommonLibrary.CommonHeadCode.SimplifyHeadCode.请求信任客户端, "");
|
||||
if(result.IsSuccess)
|
||||
{
|
||||
JObject json=JObject.Parse(result.Content);
|
||||
checkBox1.Checked = json["TrustEnable"].ToObject<bool>();
|
||||
string[] data = json["TrustList"].ToObject<string[]>();
|
||||
foreach(var m in data)
|
||||
{
|
||||
listBox1.Items.Add(m);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("请求服务器失败,请稍后重试!");
|
||||
userButton3.Enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void userButton3_Click(object sender, EventArgs e)
|
||||
{
|
||||
List<string> list = new List<string>();
|
||||
foreach(var m in listBox1.Items)
|
||||
{
|
||||
if(!string.IsNullOrEmpty(m.ToString()))
|
||||
{
|
||||
list.Add(m.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
JObject json = new JObject
|
||||
{
|
||||
{ "TrustEnable", new JValue(checkBox1.Checked) },
|
||||
{ "TrustList", new JArray(list.ToArray()) }
|
||||
};
|
||||
|
||||
OperateResultString result = UserClient.Net_simplify_client.ReadFromServer(
|
||||
CommonLibrary.CommonHeadCode.SimplifyHeadCode.上传信任客户端, json.ToString());
|
||||
|
||||
if(result.IsSuccess)
|
||||
{
|
||||
MessageBox.Show("上传成功!");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("上传失败!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
120
ClientsLibrary/Configuration/ClientConfiguration.resx
Normal file
120
ClientsLibrary/Configuration/ClientConfiguration.resx
Normal 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>
|
||||
@@ -28,25 +28,48 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("系统相关");
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.treeView1 = new System.Windows.Forms.TreeView();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.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.panel1.Location = new System.Drawing.Point(232, 12);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(573, 525);
|
||||
this.panel1.TabIndex = 1;
|
||||
//
|
||||
// treeView1
|
||||
//
|
||||
this.treeView1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.treeView1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.treeView1.Location = new System.Drawing.Point(12, 12);
|
||||
this.treeView1.Name = "treeView1";
|
||||
this.treeView1.Size = new System.Drawing.Size(199, 507);
|
||||
this.treeView1.TabIndex = 0;
|
||||
treeNode1.Name = "System";
|
||||
treeNode1.Text = "系统相关";
|
||||
this.treeView1.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
|
||||
treeNode1});
|
||||
this.treeView1.ShowLines = false;
|
||||
this.treeView1.Size = new System.Drawing.Size(199, 525);
|
||||
this.treeView1.TabIndex = 2;
|
||||
//
|
||||
// FormConfiguration
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(801, 533);
|
||||
this.ClientSize = new System.Drawing.Size(812, 549);
|
||||
this.Controls.Add(this.treeView1);
|
||||
this.Controls.Add(this.panel1);
|
||||
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.Name = "FormConfiguration";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "FormConfiguration";
|
||||
this.Load += new System.EventHandler(this.FormConfiguration_Load);
|
||||
this.ResumeLayout(false);
|
||||
@@ -54,7 +77,7 @@
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.TreeView treeView1;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using ClientsLibrary.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
@@ -14,6 +15,7 @@ namespace ClientsLibrary
|
||||
public FormConfiguration()
|
||||
{
|
||||
InitializeComponent();
|
||||
Icon = UserClient.GetFormWindowIcon();
|
||||
}
|
||||
|
||||
|
||||
@@ -21,16 +23,63 @@ namespace ClientsLibrary
|
||||
{
|
||||
Text = "配置系统的参数";
|
||||
|
||||
treeView1.ShowRootLines = false;
|
||||
treeView1.Nodes.Clear();
|
||||
|
||||
treeView1.AfterSelect += TreeView1_AfterSelect;
|
||||
TreeNode treeNodeSystem = treeView1.Nodes[0];
|
||||
|
||||
TreeNode root = new TreeNode("配置系统数据");
|
||||
treeNodeSystem.Nodes.Add("General", "常规配置");
|
||||
treeNodeSystem.Nodes.Add("Factory", "配置分厂信息");
|
||||
treeNodeSystem.Nodes.Add("Client", "客户端信任功能");
|
||||
|
||||
treeNodeSystem.Expand();
|
||||
}
|
||||
|
||||
private void TreeView1_AfterSelect(object sender, TreeViewEventArgs e)
|
||||
{
|
||||
if (e.Node.Name == "System") return;
|
||||
|
||||
if (m_Current != null)
|
||||
{
|
||||
if (m_Current.Tag.ToString() == e.Node.Name)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_Current?.Dispose();
|
||||
UserControl control;
|
||||
|
||||
treeView1.Nodes.Add(root);
|
||||
if (e.Node.Name == "General")
|
||||
{
|
||||
control = new GeneralConfiguration();
|
||||
}
|
||||
else if (e.Node.Name == "Factory")
|
||||
{
|
||||
control = new ArrayConfiguration(
|
||||
CommonLibrary.CommonHeadCode.SimplifyHeadCode.请求分厂,
|
||||
CommonLibrary.CommonHeadCode.SimplifyHeadCode.上传分厂,
|
||||
e.Node.Text);
|
||||
}
|
||||
else if(e.Node.Name == "Client")
|
||||
{
|
||||
control = new ClientConfiguration();
|
||||
}
|
||||
else
|
||||
{
|
||||
control = new UserControl();
|
||||
}
|
||||
|
||||
|
||||
|
||||
control.Width = panel1.Width;
|
||||
control.Height = panel1.Height;
|
||||
control.Location = new Point(0, 0);
|
||||
control.Parent = panel1;
|
||||
control.Tag = e.Node.Name;
|
||||
m_Current = control;
|
||||
}
|
||||
|
||||
|
||||
private UserControl m_Current = null;
|
||||
}
|
||||
}
|
||||
|
||||
97
ClientsLibrary/Configuration/GeneralConfiguration.Designer.cs
generated
Normal file
97
ClientsLibrary/Configuration/GeneralConfiguration.Designer.cs
generated
Normal file
@@ -0,0 +1,97 @@
|
||||
namespace ClientsLibrary.Configuration
|
||||
{
|
||||
partial class GeneralConfiguration
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要修改
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.checkBox1 = new System.Windows.Forms.CheckBox();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.userButton2 = new HslCommunication.Controls.UserButton();
|
||||
this.panel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// checkBox1
|
||||
//
|
||||
this.checkBox1.AutoSize = true;
|
||||
this.checkBox1.Location = new System.Drawing.Point(3, 3);
|
||||
this.checkBox1.Name = "checkBox1";
|
||||
this.checkBox1.Size = new System.Drawing.Size(247, 21);
|
||||
this.checkBox1.TabIndex = 0;
|
||||
this.checkBox1.Text = "是否允许一个账户重复登录 (admin 除外)";
|
||||
this.checkBox1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.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.panel1.AutoScroll = true;
|
||||
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.TabIndex = 1;
|
||||
//
|
||||
// userButton2
|
||||
//
|
||||
this.userButton2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.userButton2.BackColor = System.Drawing.Color.Transparent;
|
||||
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.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.TabIndex = 10;
|
||||
this.userButton2.UIText = "保存";
|
||||
this.userButton2.Click += new System.EventHandler(this.userButton2_Click);
|
||||
//
|
||||
// GeneralConfiguration
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.userButton2);
|
||||
this.Controls.Add(this.panel1);
|
||||
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 = "GeneralConfiguration";
|
||||
this.Size = new System.Drawing.Size(561, 433);
|
||||
this.Load += new System.EventHandler(this.GeneralConfiguration_Load);
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.CheckBox checkBox1;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private HslCommunication.Controls.UserButton userButton2;
|
||||
}
|
||||
}
|
||||
58
ClientsLibrary/Configuration/GeneralConfiguration.cs
Normal file
58
ClientsLibrary/Configuration/GeneralConfiguration.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using HslCommunication;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace ClientsLibrary.Configuration
|
||||
{
|
||||
public partial class GeneralConfiguration : UserControl
|
||||
{
|
||||
public GeneralConfiguration()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void GeneralConfiguration_Load(object sender, EventArgs e)
|
||||
{
|
||||
// 初始化
|
||||
|
||||
OperateResultString result = UserClient.Net_simplify_client.ReadFromServer(CommonLibrary.CommonHeadCode.SimplifyHeadCode.请求信任客户端, "");
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
JObject json = JObject.Parse(result.Content);
|
||||
checkBox1.Checked = HslCommunication.BasicFramework.SoftBasic.GetValueFromJsonObject(json, "AllowUserMulti", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("请求服务器失败,请稍后重试!");
|
||||
userButton2.Enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void userButton2_Click(object sender, EventArgs e)
|
||||
{
|
||||
JObject json = new JObject
|
||||
{
|
||||
{ "AllowUserMulti", new JValue(checkBox1.Checked) },
|
||||
};
|
||||
|
||||
OperateResultString result = UserClient.Net_simplify_client.ReadFromServer(
|
||||
CommonLibrary.CommonHeadCode.SimplifyHeadCode.上传信任客户端, json.ToString());
|
||||
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
MessageBox.Show("上传成功!");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("上传失败!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
120
ClientsLibrary/Configuration/GeneralConfiguration.resx
Normal file
120
ClientsLibrary/Configuration/GeneralConfiguration.resx
Normal 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>
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace ClientsLibrary
|
||||
namespace ClientsLibrary.Configuration
|
||||
{
|
||||
partial class FactoryConfiguration
|
||||
partial class ArrayConfiguration
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
@@ -40,6 +40,9 @@
|
||||
//
|
||||
this.dataGridView1.AllowUserToAddRows = false;
|
||||
this.dataGridView1.AllowUserToDeleteRows = false;
|
||||
this.dataGridView1.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.dataGridView1.BackgroundColor = System.Drawing.Color.White;
|
||||
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
@@ -48,7 +51,7 @@
|
||||
this.dataGridView1.Name = "dataGridView1";
|
||||
this.dataGridView1.RowTemplate.Height = 23;
|
||||
this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
||||
this.dataGridView1.Size = new System.Drawing.Size(509, 404);
|
||||
this.dataGridView1.Size = new System.Drawing.Size(500, 408);
|
||||
this.dataGridView1.TabIndex = 0;
|
||||
//
|
||||
// Factory
|
||||
@@ -59,11 +62,12 @@
|
||||
//
|
||||
// userButton_login
|
||||
//
|
||||
this.userButton_login.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
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(3, 411);
|
||||
this.userButton_login.Location = new System.Drawing.Point(3, 415);
|
||||
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);
|
||||
@@ -73,11 +77,12 @@
|
||||
//
|
||||
// userButton1
|
||||
//
|
||||
this.userButton1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.userButton1.BackColor = System.Drawing.Color.Transparent;
|
||||
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, 411);
|
||||
this.userButton1.Location = new System.Drawing.Point(64, 415);
|
||||
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);
|
||||
@@ -87,11 +92,12 @@
|
||||
//
|
||||
// userButton2
|
||||
//
|
||||
this.userButton2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.userButton2.BackColor = System.Drawing.Color.Transparent;
|
||||
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(451, 411);
|
||||
this.userButton2.Location = new System.Drawing.Point(442, 415);
|
||||
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);
|
||||
@@ -110,7 +116,7 @@
|
||||
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.Size = new System.Drawing.Size(509, 442);
|
||||
this.Size = new System.Drawing.Size(500, 446);
|
||||
this.Load += new System.EventHandler(this.FactoryConfiguration_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
@@ -6,21 +6,31 @@ using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using HslCommunication;
|
||||
|
||||
namespace ClientsLibrary
|
||||
namespace ClientsLibrary.Configuration
|
||||
{
|
||||
public partial class FactoryConfiguration : UserControl
|
||||
public partial class ArrayConfiguration : UserControl
|
||||
{
|
||||
public FactoryConfiguration(int download,int upload,string headText)
|
||||
#region Constructor
|
||||
|
||||
|
||||
public ArrayConfiguration(int download, int upload, string headText)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Download = download;
|
||||
Upload = upload;
|
||||
HeadText = headText;
|
||||
SetInfomation(download, upload, headText);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public ArrayConfiguration()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Member
|
||||
|
||||
private int Download = 0;
|
||||
@@ -29,13 +39,19 @@ namespace ClientsLibrary
|
||||
|
||||
#endregion
|
||||
|
||||
public void SetInfomation(int download, int upload, string headText)
|
||||
{
|
||||
Download = download;
|
||||
Upload = upload;
|
||||
HeadText = headText;
|
||||
}
|
||||
|
||||
|
||||
private void FactoryConfiguration_Load(object sender, EventArgs e)
|
||||
{
|
||||
dataGridView1.Columns[0].HeaderText = HeadText;
|
||||
|
||||
HslCommunication.OperateResultString result = UserClient.Net_simplify_client.ReadFromServer(Download, "");
|
||||
OperateResultString result = UserClient.Net_simplify_client.ReadFromServer(Download, "");
|
||||
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
@@ -50,6 +66,7 @@ namespace ClientsLibrary
|
||||
else
|
||||
{
|
||||
MessageBox.Show(result.Message);
|
||||
userButton2.Enabled = false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -63,22 +80,35 @@ namespace ClientsLibrary
|
||||
{
|
||||
if (dataGridView1.SelectedRows != null)
|
||||
{
|
||||
dataGridView1.Rows.Remove(dataGridView1.SelectedRows[0]);
|
||||
if (dataGridView1.Rows.Count > 0)
|
||||
{
|
||||
dataGridView1.Rows.Remove(dataGridView1.SelectedRows[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void userButton2_Click(object sender, EventArgs e)
|
||||
{
|
||||
List<string> data = new List<string>();
|
||||
for(int i=0;i<dataGridView1.Rows.Count;i++)
|
||||
for (int i = 0; i < dataGridView1.Rows.Count; i++)
|
||||
{
|
||||
if(!string.IsNullOrEmpty(dataGridView1.Rows[i].Cells[0].Value.ToString()))
|
||||
if (!string.IsNullOrEmpty(dataGridView1.Rows[i].Cells[0].Value.ToString()))
|
||||
{
|
||||
data.Add(dataGridView1.Rows[i].Cells[0].Value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
OperateResultString result = UserClient.Net_simplify_client.ReadFromServer(Upload,
|
||||
Newtonsoft.Json.Linq.JArray.FromObject(data).ToString());
|
||||
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
MessageBox.Show("修改成功!");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("修改失败!原因:" + result.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +120,4 @@
|
||||
<metadata name="Factory.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Factory.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -17,6 +17,9 @@ namespace ClientsLibrary
|
||||
public FormLogView()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Icon = UserClient.GetFormWindowIcon();
|
||||
|
||||
net_simplify_client = UserClient.Net_simplify_client;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,8 @@ namespace ClientsLibrary
|
||||
public FormUpdateRemote()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Icon = UserClient.GetFormWindowIcon();
|
||||
}
|
||||
|
||||
private void userButton_file_Click(object sender, EventArgs e)
|
||||
|
||||
@@ -6,6 +6,8 @@ using HslCommunication.Enthernet;
|
||||
using HslCommunication.BasicFramework;
|
||||
using CommonLibrary;
|
||||
using System.Net;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ClientsLibrary
|
||||
{
|
||||
@@ -134,5 +136,10 @@ namespace ClientsLibrary
|
||||
Net_simplify_client.ReadFromServer(CommonHeadCode.SimplifyHeadCode.异常消息, info);
|
||||
}
|
||||
}
|
||||
|
||||
public static Icon GetFormWindowIcon()
|
||||
{
|
||||
return Icon.ExtractAssociatedIcon(Application.ExecutablePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,10 @@ namespace CommonLibrary
|
||||
/// </summary>
|
||||
public bool Can_Account_Login { get; set; } = true;
|
||||
/// <summary>
|
||||
/// 是否允许一个用户名重复登录系统
|
||||
/// </summary>
|
||||
public bool AllowUserMultiOnline { get; set; } = false;
|
||||
/// <summary>
|
||||
/// 不允许登录系统的原因
|
||||
/// </summary>
|
||||
public string Account_Forbidden_Reason { get; set; } = "系统处于维护中,请稍后登录。";
|
||||
@@ -149,6 +153,7 @@ namespace CommonLibrary
|
||||
{ nameof(SystemVersion), new JValue(SystemVersion.ToString()) },
|
||||
{ nameof(Announcement), new JValue(Announcement) },
|
||||
{ nameof(Can_Account_Login), new JValue(Can_Account_Login) },
|
||||
{ nameof(AllowUserMultiOnline),new JValue(AllowUserMultiOnline) },
|
||||
{ nameof(Account_Forbidden_Reason), new JValue(Account_Forbidden_Reason) },
|
||||
{ nameof(SystemFactories), new JArray(SystemFactories) },
|
||||
{ nameof(WhetherToEnableTrustedClientAuthentication),new JValue(WhetherToEnableTrustedClientAuthentication) },
|
||||
@@ -166,6 +171,7 @@ namespace CommonLibrary
|
||||
SystemVersion = new SystemVersion(SoftBasic.GetValueFromJsonObject(json, nameof(SystemVersion), "1.0.0"));
|
||||
Announcement = SoftBasic.GetValueFromJsonObject(json, nameof(Announcement), Announcement);
|
||||
Can_Account_Login = SoftBasic.GetValueFromJsonObject(json, nameof(Can_Account_Login), Can_Account_Login);
|
||||
AllowUserMultiOnline = SoftBasic.GetValueFromJsonObject(json, nameof(AllowUserMultiOnline), AllowUserMultiOnline);
|
||||
Account_Forbidden_Reason = SoftBasic.GetValueFromJsonObject(json, nameof(Account_Forbidden_Reason), Account_Forbidden_Reason);
|
||||
|
||||
if (json[nameof(SystemFactories)] != null)
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace CommonLibrary
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
SoftBasic.FrameworkVersion = new SystemVersion("1.4.6");
|
||||
SoftBasic.FrameworkVersion = new SystemVersion("1.4.7");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace CommonLibrary
|
||||
*
|
||||
* 关于 NetHandle:
|
||||
* 一个数据结构值,无论实际数据还是用法上等同于int,可以和int数据无缝的转化
|
||||
* 将4个字节的int数据拆分成了三个属性,一个ushort和两个byte,可以分别访问
|
||||
* 本质上将4个字节的int数据拆分成了三个属性,一个ushort和两个byte,可以分别访问
|
||||
*
|
||||
* 2个低字节 第二高字节 最高的字节
|
||||
* [byte1][byte2] [byte3] [byte4]
|
||||
@@ -61,17 +61,20 @@ namespace CommonLibrary
|
||||
public static NetHandle 上传头像MD5 { get; } = new NetHandle(1, 1, 00016);
|
||||
public static NetHandle 请求分厂 { get; } = new NetHandle(1, 1, 00017);
|
||||
public static NetHandle 上传分厂 { get; } = new NetHandle(1, 1, 00018);
|
||||
public static NetHandle 请求信任客户端 { get; } = new NetHandle(1, 1, 00019);
|
||||
public static NetHandle 上传信任客户端 { get; } = new NetHandle(1, 1, 00020);
|
||||
public static NetHandle 请求一般配置 { get; } = new NetHandle(1, 1, 00021);
|
||||
public static NetHandle 上传一般配置 { get; } = new NetHandle(1, 1, 00022);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* 1.2.* 的指令为日志的请求与查看相关
|
||||
*
|
||||
*******************************************************************************************/
|
||||
|
||||
|
||||
|
||||
public static NetHandle 网络日志查看 { get; } = new NetHandle(1, 2, 00001);//1.2.开头的是日志请求和清空
|
||||
public static NetHandle 网络日志清空 { get; } = new NetHandle(1, 2, 00002);
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
</MenuItem>
|
||||
|
||||
<Separator />
|
||||
<MenuItem Header="分厂配置" x:Name="MenuItem分厂配置" Click="MenuItem分厂配置_Click">
|
||||
<MenuItem Header="系统配置" x:Name="MenuItem系统配置" Click="MenuItem系统配置_Click">
|
||||
<MenuItem.Icon>
|
||||
<materialDesign:PackIcon Kind="City" />
|
||||
</MenuItem.Icon>
|
||||
|
||||
@@ -34,9 +34,9 @@ namespace 软件系统客户端Wpf
|
||||
|
||||
/***************************************************************************************
|
||||
*
|
||||
* 模版日期 2017-07-11
|
||||
* 创建人 胡少林
|
||||
* 版权所有 胡少林
|
||||
* 模版日期 2017-09-24
|
||||
* 创建人 Richard Hu
|
||||
* 版权所有 Richard Hu
|
||||
* 授权说明 模版仅授权个人使用,如需商用,请联系hsl200909@163.com洽谈
|
||||
* 说明一 JSON组件引用自james newton-king,遵循MIT授权协议
|
||||
* 说明二 主题及各种主件来自:https://github.com/ButchersBoy/MaterialDesignInXamlToolkit
|
||||
@@ -123,7 +123,7 @@ namespace 软件系统客户端Wpf
|
||||
MenuItem注册账户.IsEnabled = false;
|
||||
MenuItem消息发送.IsEnabled = false;
|
||||
MenuItem开发中心.IsEnabled = false;
|
||||
MenuItem分厂配置.IsEnabled = false;
|
||||
MenuItem系统配置.IsEnabled = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -375,15 +375,11 @@ namespace 软件系统客户端Wpf
|
||||
}
|
||||
|
||||
|
||||
private void MenuItem分厂配置_Click(object sender, RoutedEventArgs e)
|
||||
private void MenuItem系统配置_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
using (FormInputAndAction fiaa = new FormInputAndAction(
|
||||
str => UserClient.Net_simplify_client.ReadFromServer(
|
||||
CommonHeadCode.SimplifyHeadCode.上传分厂, str).IsSuccess,
|
||||
JArray.FromObject(UserClient.SystemFactories).ToString(),
|
||||
"请按照JSON格式更新分厂信息,然后提交:"))
|
||||
using (FormConfiguration fc = new FormConfiguration())
|
||||
{
|
||||
fiaa.ShowDialog();
|
||||
fc.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
32
软件系统客户端模版/FormMainWindow.Designer.cs
generated
32
软件系统客户端模版/FormMainWindow.Designer.cs
generated
@@ -45,10 +45,11 @@
|
||||
this.注册账号ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.消息发送ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.开发中心ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.分厂配置ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.系统配置ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.设置ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.修改密码ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.留言板ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.我的信息ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.关于ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.关于本软件ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.更新日志ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
@@ -79,7 +80,6 @@
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.panel_main = new System.Windows.Forms.Panel();
|
||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
this.我的信息ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.statusStrip1.SuspendLayout();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.panel_right.SuspendLayout();
|
||||
@@ -172,7 +172,7 @@
|
||||
this.注册账号ToolStripMenuItem,
|
||||
this.消息发送ToolStripMenuItem,
|
||||
this.开发中心ToolStripMenuItem,
|
||||
this.分厂配置ToolStripMenuItem});
|
||||
this.系统配置ToolStripMenuItem});
|
||||
this.管理员ToolStripMenuItem.Image = global::软件系统客户端模版.Properties.Resources.Team_32xLG;
|
||||
this.管理员ToolStripMenuItem.Name = "管理员ToolStripMenuItem";
|
||||
this.管理员ToolStripMenuItem.Size = new System.Drawing.Size(100, 31);
|
||||
@@ -227,12 +227,12 @@
|
||||
this.开发中心ToolStripMenuItem.Text = "开发中心";
|
||||
this.开发中心ToolStripMenuItem.Click += new System.EventHandler(this.开发中心ToolStripMenuItem_Click);
|
||||
//
|
||||
// 分厂配置ToolStripMenuItem
|
||||
// 系统配置ToolStripMenuItem
|
||||
//
|
||||
this.分厂配置ToolStripMenuItem.Name = "分厂配置ToolStripMenuItem";
|
||||
this.分厂配置ToolStripMenuItem.Size = new System.Drawing.Size(164, 32);
|
||||
this.分厂配置ToolStripMenuItem.Text = "分厂配置";
|
||||
this.分厂配置ToolStripMenuItem.Click += new System.EventHandler(this.分厂配置ToolStripMenuItem_Click);
|
||||
this.系统配置ToolStripMenuItem.Name = "系统配置ToolStripMenuItem";
|
||||
this.系统配置ToolStripMenuItem.Size = new System.Drawing.Size(164, 32);
|
||||
this.系统配置ToolStripMenuItem.Text = "系统配置";
|
||||
this.系统配置ToolStripMenuItem.Click += new System.EventHandler(this.系统配置ToolStripMenuItem_Click);
|
||||
//
|
||||
// 设置ToolStripMenuItem
|
||||
//
|
||||
@@ -259,6 +259,13 @@
|
||||
this.留言板ToolStripMenuItem.Text = "留言板";
|
||||
this.留言板ToolStripMenuItem.Click += new System.EventHandler(this.留言板ToolStripMenuItem_Click);
|
||||
//
|
||||
// 我的信息ToolStripMenuItem
|
||||
//
|
||||
this.我的信息ToolStripMenuItem.Name = "我的信息ToolStripMenuItem";
|
||||
this.我的信息ToolStripMenuItem.Size = new System.Drawing.Size(164, 32);
|
||||
this.我的信息ToolStripMenuItem.Text = "我的信息";
|
||||
this.我的信息ToolStripMenuItem.Click += new System.EventHandler(this.我的信息ToolStripMenuItem_Click);
|
||||
//
|
||||
// 关于ToolStripMenuItem
|
||||
//
|
||||
this.关于ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
@@ -559,13 +566,6 @@
|
||||
this.pictureBox1.TabStop = false;
|
||||
this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
|
||||
//
|
||||
// 我的信息ToolStripMenuItem
|
||||
//
|
||||
this.我的信息ToolStripMenuItem.Name = "我的信息ToolStripMenuItem";
|
||||
this.我的信息ToolStripMenuItem.Size = new System.Drawing.Size(164, 32);
|
||||
this.我的信息ToolStripMenuItem.Text = "我的信息";
|
||||
this.我的信息ToolStripMenuItem.Click += new System.EventHandler(this.我的信息ToolStripMenuItem_Click);
|
||||
//
|
||||
// FormMainWindow
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
@@ -651,7 +651,7 @@
|
||||
private System.Windows.Forms.ToolStripMenuItem 消息发送ToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem 开发中心ToolStripMenuItem;
|
||||
private System.Windows.Forms.PictureBox pictureBox1;
|
||||
private System.Windows.Forms.ToolStripMenuItem 分厂配置ToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem 系统配置ToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem 我的信息ToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace 软件系统客户端模版
|
||||
注册账号ToolStripMenuItem.Enabled = false;
|
||||
消息发送ToolStripMenuItem.Enabled = false;
|
||||
开发中心ToolStripMenuItem.Enabled = false;
|
||||
分厂配置ToolStripMenuItem.Enabled = false;
|
||||
系统配置ToolStripMenuItem.Enabled = false;
|
||||
}
|
||||
//启动定时器
|
||||
TimeTickInitilization();
|
||||
@@ -311,15 +311,19 @@ namespace 软件系统客户端模版
|
||||
}
|
||||
}
|
||||
|
||||
private void 分厂配置ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
private void 系统配置ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (FormInputAndAction fiaa = new FormInputAndAction(
|
||||
str => UserClient.Net_simplify_client.ReadFromServer(
|
||||
CommonHeadCode.SimplifyHeadCode.上传分厂, str).IsSuccess,
|
||||
JArray.FromObject(UserClient.SystemFactories).ToString(),
|
||||
"请按照JSON格式更新分厂信息,然后提交:"))
|
||||
//using (FormInputAndAction fiaa = new FormInputAndAction(
|
||||
// str => UserClient.Net_simplify_client.ReadFromServer(
|
||||
// CommonHeadCode.SimplifyHeadCode.上传分厂, str).IsSuccess,
|
||||
// JArray.FromObject(UserClient.SystemFactories).ToString(),
|
||||
// "请按照JSON格式更新分厂信息,然后提交:"))
|
||||
//{
|
||||
// fiaa.ShowDialog();
|
||||
//}
|
||||
using (FormConfiguration fc = new FormConfiguration())
|
||||
{
|
||||
fiaa.ShowDialog();
|
||||
fc.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -526,17 +526,33 @@ namespace 软件系统服务端模版
|
||||
string name = SoftBasic.GetValueFromJsonObject(json, UserAccount.UserNameText, "");
|
||||
string password = SoftBasic.GetValueFromJsonObject(json, UserAccount.PasswordText, "");
|
||||
string way = SoftBasic.GetValueFromJsonObject(json, UserAccount.LoginWayText, "winform");
|
||||
string machineId= SoftBasic.GetValueFromJsonObject(json, UserAccount.DeviceUniqueID, "ABCDEFHIGKLMN");
|
||||
|
||||
|
||||
UserAccount account = UserServer.ServerAccounts.CheckAccount(name, password, state.GetRemoteEndPoint().Address.ToString(), way);
|
||||
UserAccount account = UserServer.ServerAccounts.CheckAccount(name, password, state.GetRemoteEndPoint().Address.ToString(), way);
|
||||
//检测是否重复登录
|
||||
if (account.LoginEnable)
|
||||
{
|
||||
if (IsClinetOnline(account.UserName))
|
||||
if (!UserServer.ServerSettings.AllowUserMultiOnline)
|
||||
{
|
||||
account.LoginEnable = false;
|
||||
account.ForbidMessage = "该账户已经登录";
|
||||
if (IsClinetOnline(account.UserName))
|
||||
{
|
||||
account.LoginEnable = false;
|
||||
account.ForbidMessage = "该账户已经登录";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 检测客户端id是否被授权
|
||||
if(UserServer.ServerSettings.WhetherToEnableTrustedClientAuthentication)
|
||||
{
|
||||
if(!UserServer.ServerSettings.CanClientLogin(machineId))
|
||||
{
|
||||
account.LoginEnable = false;
|
||||
account.ForbidMessage = "该客户端不再服务器信任列表";
|
||||
}
|
||||
}
|
||||
|
||||
net_simplify_server.SendMessage(state, handle, JObject.FromObject(account).ToString());
|
||||
}
|
||||
else if (handle == CommonHeadCode.SimplifyHeadCode.更新公告)
|
||||
@@ -628,6 +644,10 @@ namespace 软件系统服务端模版
|
||||
net_simplify_server.SendMessage(state, handle, "失败,原因是:" + ex.Message);
|
||||
}
|
||||
}
|
||||
else if(handle==CommonHeadCode.SimplifyHeadCode.请求分厂)
|
||||
{
|
||||
net_simplify_server.SendMessage(state, handle, JArray.FromObject(UserServer.ServerSettings.SystemFactories).ToString());
|
||||
}
|
||||
else if (handle == CommonHeadCode.SimplifyHeadCode.上传分厂)
|
||||
{
|
||||
try
|
||||
@@ -641,6 +661,36 @@ namespace 软件系统服务端模版
|
||||
}
|
||||
net_simplify_server.SendMessage(state, handle, "1");
|
||||
}
|
||||
else if (handle == CommonHeadCode.SimplifyHeadCode.请求信任客户端)
|
||||
{
|
||||
JObject json = new JObject
|
||||
{
|
||||
{ "TrustEnable", new JValue(UserServer.ServerSettings.WhetherToEnableTrustedClientAuthentication) },
|
||||
{ "TrustList", new JArray(UserServer.ServerSettings.TrustedClientList) }
|
||||
};
|
||||
net_simplify_server.SendMessage(state, handle, json.ToString());
|
||||
}
|
||||
else if (handle == CommonHeadCode.SimplifyHeadCode.上传信任客户端)
|
||||
{
|
||||
JObject json = JObject.Parse(data);
|
||||
UserServer.ServerSettings.WhetherToEnableTrustedClientAuthentication = json["TrustEnable"].ToObject<bool>();
|
||||
UserServer.ServerSettings.TrustedClientList = json["TrustList"].ToObject<List<string>>();
|
||||
net_simplify_server.SendMessage(state, handle, "成功");
|
||||
}
|
||||
else if (handle == CommonHeadCode.SimplifyHeadCode.请求一般配置)
|
||||
{
|
||||
JObject json = new JObject
|
||||
{
|
||||
{ "AllowUserMulti", new JValue(UserServer.ServerSettings.AllowUserMultiOnline) },
|
||||
};
|
||||
net_simplify_server.SendMessage(state, handle, json.ToString());
|
||||
}
|
||||
else if (handle == CommonHeadCode.SimplifyHeadCode.上传一般配置)
|
||||
{
|
||||
JObject json = JObject.Parse(data);
|
||||
UserServer.ServerSettings.AllowUserMultiOnline = SoftBasic.GetValueFromJsonObject(json, "AllowUserMulti", false);
|
||||
net_simplify_server.SendMessage(state, handle, json.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
net_simplify_server.SendMessage(state, handle, data);
|
||||
@@ -945,6 +995,7 @@ namespace 软件系统服务端模版
|
||||
/// 所有在线客户端的信息
|
||||
/// </summary>
|
||||
private string Net_Socket_All_Clients = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 用来判断客户端是否已经在线,除了超级管理员,其他的账户不允许重复在线,重复登录的账户予以特殊标记
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user