添加项目文件。

This commit is contained in:
HSL
2017-02-22 14:30:10 +08:00
parent 171b6b939c
commit dcdc6f6975
40 changed files with 15728 additions and 0 deletions

View File

@@ -0,0 +1,174 @@
namespace
{
partial class FormLog
{
/// <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.textBox1 = new System.Windows.Forms.TextBox();
this.userButton_login = new BasicFramework.UserButton();
this.userButton1 = new BasicFramework.UserButton();
this.userButton2 = new BasicFramework.UserButton();
this.userButton3 = new BasicFramework.UserButton();
this.userButton4 = new BasicFramework.UserButton();
this.userButton5 = new BasicFramework.UserButton();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.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.textBox1.Location = new System.Drawing.Point(12, 12);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(596, 457);
this.textBox1.TabIndex = 0;
//
// userButton_login
//
this.userButton_login.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
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(619, 11);
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(103, 26);
this.userButton_login.TabIndex = 6;
this.userButton_login.UIText = "网络日志查看";
this.userButton_login.Click += new System.EventHandler(this.userButton_login_Click);
//
// userButton1
//
this.userButton1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | 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(619, 45);
this.userButton1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.userButton1.Name = "userButton1";
this.userButton1.Size = new System.Drawing.Size(103, 26);
this.userButton1.TabIndex = 7;
this.userButton1.UIText = "网络日志清空";
this.userButton1.Click += new System.EventHandler(this.userButton1_Click);
//
// userButton2
//
this.userButton2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | 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(619, 118);
this.userButton2.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.userButton2.Name = "userButton2";
this.userButton2.Size = new System.Drawing.Size(103, 26);
this.userButton2.TabIndex = 8;
this.userButton2.UIText = "同步日志查看";
this.userButton2.Click += new System.EventHandler(this.userButton2_Click);
//
// userButton3
//
this.userButton3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | 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(619, 152);
this.userButton3.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.userButton3.Name = "userButton3";
this.userButton3.Size = new System.Drawing.Size(103, 26);
this.userButton3.TabIndex = 9;
this.userButton3.UIText = "同步日志清空";
this.userButton3.Click += new System.EventHandler(this.userButton3_Click);
//
// userButton4
//
this.userButton4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.userButton4.BackColor = System.Drawing.Color.Transparent;
this.userButton4.CustomerInformation = "";
this.userButton4.EnableColor = System.Drawing.Color.FromArgb(((int)(((byte)(190)))), ((int)(((byte)(190)))), ((int)(((byte)(190)))));
this.userButton4.Font = new System.Drawing.Font("微软雅黑", 9F);
this.userButton4.Location = new System.Drawing.Point(619, 225);
this.userButton4.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.userButton4.Name = "userButton4";
this.userButton4.Size = new System.Drawing.Size(103, 26);
this.userButton4.TabIndex = 10;
this.userButton4.UIText = "更新日志查看";
this.userButton4.Click += new System.EventHandler(this.userButton4_Click);
//
// userButton5
//
this.userButton5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.userButton5.BackColor = System.Drawing.Color.Transparent;
this.userButton5.CustomerInformation = "";
this.userButton5.EnableColor = System.Drawing.Color.FromArgb(((int)(((byte)(190)))), ((int)(((byte)(190)))), ((int)(((byte)(190)))));
this.userButton5.Font = new System.Drawing.Font("微软雅黑", 9F);
this.userButton5.Location = new System.Drawing.Point(619, 259);
this.userButton5.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.userButton5.Name = "userButton5";
this.userButton5.Size = new System.Drawing.Size(103, 26);
this.userButton5.TabIndex = 11;
this.userButton5.UIText = "更新日志清空";
this.userButton5.Click += new System.EventHandler(this.userButton5_Click);
//
// FormLog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(732, 492);
this.Controls.Add(this.userButton5);
this.Controls.Add(this.userButton4);
this.Controls.Add(this.userButton3);
this.Controls.Add(this.userButton2);
this.Controls.Add(this.userButton1);
this.Controls.Add(this.userButton_login);
this.Controls.Add(this.textBox1);
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 = "FormLog";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "网络日志查看";
this.Load += new System.EventHandler(this.FormLog_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBox1;
private BasicFramework.UserButton userButton_login;
private BasicFramework.UserButton userButton1;
private BasicFramework.UserButton userButton2;
private BasicFramework.UserButton userButton3;
private BasicFramework.UserButton userButton4;
private BasicFramework.UserButton userButton5;
}
}

View File

@@ -0,0 +1,72 @@
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 IndustryEthernet;
using CommonLibrary;
namespace
{
public partial class FormLog : Form
{
public FormLog(Net_Simplify_Client client)
{
InitializeComponent();
net_simplify_client = client;
}
private Net_Simplify_Client net_simplify_client = null;
private void FormLog_Load(object sender, EventArgs e)
{
}
private void ReadFromServer(string head_code)
{
OperateResultString result = net_simplify_client.ReadFromServer(head_code);
if (result.IsSuccess) textBox1.Text = result.Content;
else textBox1.Text = result.ToMessageShowString();
}
private void ClearFromServer(string head_code)
{
OperateResultString result = net_simplify_client.ReadFromServer(head_code);
if (result.IsSuccess) textBox1.Text = "清除成功";
else textBox1.Text = result.ToMessageShowString();
}
private void userButton_login_Click(object sender, EventArgs e)
{
ReadFromServer(CommonHeadCode.SimplifyHeadCode.);
}
private void userButton1_Click(object sender, EventArgs e)
{
ClearFromServer(CommonHeadCode.SimplifyHeadCode.);
}
private void userButton2_Click(object sender, EventArgs e)
{
ReadFromServer(CommonHeadCode.SimplifyHeadCode.);
}
private void userButton3_Click(object sender, EventArgs e)
{
ClearFromServer(CommonHeadCode.SimplifyHeadCode.);
}
private void userButton4_Click(object sender, EventArgs e)
{
ReadFromServer(CommonHeadCode.SimplifyHeadCode.);
}
private void userButton5_Click(object sender, EventArgs e)
{
ClearFromServer(CommonHeadCode.SimplifyHeadCode.);
}
}
}

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

@@ -0,0 +1,190 @@
namespace
{
partial class FormLogin
{
/// <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.label2 = new System.Windows.Forms.Label();
this.textBox_userName = new System.Windows.Forms.TextBox();
this.textBox_password = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.userButton_login = new BasicFramework.UserButton();
this.label_version = new System.Windows.Forms.Label();
this.label_copyright = new System.Windows.Forms.Label();
this.label_status = new System.Windows.Forms.Label();
this.checkBox_remeber = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(35, 59);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(74, 21);
this.label1.TabIndex = 0;
this.label1.Text = "用户名:";
//
// label2
//
this.label2.Font = new System.Drawing.Font("微软雅黑", 21F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.Location = new System.Drawing.Point(12, 9);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(396, 36);
this.label2.TabIndex = 1;
this.label2.Text = "[软件系统的名称]";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// textBox_userName
//
this.textBox_userName.Location = new System.Drawing.Point(115, 57);
this.textBox_userName.Name = "textBox_userName";
this.textBox_userName.Size = new System.Drawing.Size(189, 26);
this.textBox_userName.TabIndex = 2;
this.textBox_userName.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textBox_userName_KeyDown);
//
// textBox_password
//
this.textBox_password.Location = new System.Drawing.Point(115, 98);
this.textBox_password.Name = "textBox_password";
this.textBox_password.PasswordChar = '*';
this.textBox_password.Size = new System.Drawing.Size(189, 26);
this.textBox_password.TabIndex = 4;
this.textBox_password.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textBox_password_KeyDown);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label3.Location = new System.Drawing.Point(35, 100);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(73, 21);
this.label3.TabIndex = 3;
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("微软雅黑", 12F);
this.userButton_login.Location = new System.Drawing.Point(318, 57);
this.userButton_login.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.userButton_login.Name = "userButton_login";
this.userButton_login.Size = new System.Drawing.Size(76, 67);
this.userButton_login.TabIndex = 5;
this.userButton_login.UIText = "登录";
this.userButton_login.Click += new System.EventHandler(this.userButton_login_Click);
//
// label_version
//
this.label_version.AutoSize = true;
this.label_version.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label_version.ForeColor = System.Drawing.Color.Gray;
this.label_version.Location = new System.Drawing.Point(1, 176);
this.label_version.Name = "label_version";
this.label_version.Size = new System.Drawing.Size(44, 17);
this.label_version.TabIndex = 6;
this.label_version.Text = "版本:";
//
// label_copyright
//
this.label_copyright.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label_copyright.ForeColor = System.Drawing.Color.Gray;
this.label_copyright.Location = new System.Drawing.Point(215, 176);
this.label_copyright.Name = "label_copyright";
this.label_copyright.Size = new System.Drawing.Size(206, 17);
this.label_copyright.TabIndex = 7;
this.label_copyright.Text = "本软件著作权归某某某所有";
this.label_copyright.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// label_status
//
this.label_status.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label_status.ForeColor = System.Drawing.Color.Blue;
this.label_status.Location = new System.Drawing.Point(15, 151);
this.label_status.Name = "label_status";
this.label_status.Size = new System.Drawing.Size(393, 19);
this.label_status.TabIndex = 8;
this.label_status.Text = "[登录的消息提示]";
this.label_status.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// checkBox_remeber
//
this.checkBox_remeber.AutoSize = true;
this.checkBox_remeber.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.checkBox_remeber.Location = new System.Drawing.Point(115, 127);
this.checkBox_remeber.Name = "checkBox_remeber";
this.checkBox_remeber.Size = new System.Drawing.Size(87, 21);
this.checkBox_remeber.TabIndex = 9;
this.checkBox_remeber.Text = "记住密码?";
this.checkBox_remeber.UseVisualStyleBackColor = true;
//
// FormLogin
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(420, 194);
this.Controls.Add(this.checkBox_remeber);
this.Controls.Add(this.label_status);
this.Controls.Add(this.label_copyright);
this.Controls.Add(this.label_version);
this.Controls.Add(this.userButton_login);
this.Controls.Add(this.textBox_password);
this.Controls.Add(this.label3);
this.Controls.Add(this.textBox_userName);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Font = new System.Drawing.Font("微软雅黑", 10.5F, 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 = "FormLogin";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "系统登录";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormLogin_FormClosing);
this.Load += new System.EventHandler(this.FormLogin_Load);
this.Shown += new System.EventHandler(this.FormLogin_Shown);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBox_userName;
private System.Windows.Forms.TextBox textBox_password;
private System.Windows.Forms.Label label3;
private BasicFramework.UserButton userButton_login;
private System.Windows.Forms.Label label_version;
private System.Windows.Forms.Label label_copyright;
private System.Windows.Forms.Label label_status;
private System.Windows.Forms.CheckBox checkBox_remeber;
}
}

View File

@@ -0,0 +1,302 @@
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 System.Threading;
using IndustryEthernet;
using Newtonsoft.Json.Linq;
namespace
{
//=================================================================================================
// 登录窗口,此处实现了一些常用的代码,具体的版本号验证及账户验证需要根据实际需求实现
//=================================================================================================
public partial class FormLogin : Form
{
public FormLogin()
{
InitializeComponent();
}
#region
/// <summary>
/// 指示窗体是否已经显示
/// </summary>
private bool IsWindowShow { get; set; } = false;
private void FormLogin_Load(object sender, EventArgs e)
{
label_status.Visible = false;
UserClient.JsonSettings.FileSavePath = Application.StartupPath + @"\settings.txt";
UserClient.JsonSettings.LoadSettings();//根据实际实际情况选中解密算法默认采用DES加密解密算法
label_version.Text = "版本:" + UserClient.CurrentVersion.ToString();
}
private void FormLogin_Shown(object sender, EventArgs e)
{
IsWindowShow = true;
//加载数据
textBox_userName.Text = UserClient.JsonSettings.LoginName ?? "";
textBox_password.Text = UserClient.JsonSettings.Password ?? "";
checkBox_remeber.Checked = UserClient.JsonSettings.Password != "";
//初始化输入焦点
if (UserClient.JsonSettings.Password != "") userButton_login.Focus();
else if (UserClient.JsonSettings.LoginName != "") textBox_password.Focus();
else textBox_userName.Focus();
}
private void FormLogin_FormClosing(object sender, FormClosingEventArgs e)
{
//退出
IsWindowShow = false;
//延时
Thread.Sleep(100);
}
#endregion
#region
private void textBox_userName_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter) textBox_password.Focus();
}
private void textBox_password_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter) userButton_login.PerformClick();
}
private void userButton_login_Click(object sender, EventArgs e)
{
label_status.Visible = true;
//验证输入
if (string.IsNullOrEmpty(textBox_userName.Text))
{
label_status.Text = "请输入用户名";
textBox_userName.Focus();
return;
}
if(string.IsNullOrEmpty(textBox_password.Text))
{
label_status.Text = "请输入密码";
textBox_password.Focus();
return;
}
label_status.Text = "正在验证维护状态...";
UISettings(false);
ThreadAccountLogin = new Thread(ThreadCheckAccount);
ThreadAccountLogin.IsBackground = true;
ThreadAccountLogin.Start();
}
/// <summary>
/// 界面的UI使能操作
/// </summary>
/// <param name="enable">值</param>
private void UISettings(bool enable)
{
textBox_userName.Enabled = enable;
textBox_password.Enabled = enable;
userButton_login.Enabled = enable;
checkBox_remeber.Enabled = enable;
}
#endregion
#region
/// <summary>
/// 用于访问服务器数据的网络对象类,必须修改这个端口参数,否则运行失败
/// </summary>
private Net_Simplify_Client net_simplify_client = new Net_Simplify_Client(
new System.Net.IPEndPoint(System.Net.IPAddress.Parse(UserClient.ServerIp), CommonLibrary.CommonLibrary.Port_Second_Net));
/// <summary>
/// 用于验证的后台线程
/// </summary>
private Thread ThreadAccountLogin = null;
/// <summary>
/// 用户账户验证的后台端
/// </summary>
private void ThreadCheckAccount()
{
//定义委托
Action<string> message_show = delegate (string message)
{
label_status.Text = message;
};
Action start_update = delegate
{
//需要该exe支持否则将无法是实现自动版本控制
string update_file_name = Application.StartupPath + @"\软件自动更新.exe";
try
{
System.Diagnostics.Process.Start(update_file_name);
}
catch
{
MessageBox.Show("更新程序启动失败,请检查文件是否丢失,联系管理员获取。");
}
};
Action thread_finish = delegate
{
UISettings(true);
};
//延时
Thread.Sleep(200);
//请求指令头数据,该数据需要更具实际情况更改
OperateResultString result = net_simplify_client.ReadFromServer(CommonLibrary.CommonHeadCode.SimplifyHeadCode.);
if(result.IsSuccess)
{
//例如返回结果为1说明允许登录0则说明服务器处于维护中并将信息显示
if (result.Content != "1")
{
if (IsHandleCreated) Invoke(message_show, result.Content.Substring(1));
if (IsHandleCreated) Invoke(thread_finish);
return;
}
}
else
{
//访问失败
if (IsHandleCreated) Invoke(message_show, result.Message);
if (IsHandleCreated) Invoke(thread_finish);
return;
}
//版本验证
if (IsHandleCreated) Invoke(message_show, "正在验证版本...");
else return;
//延时
Thread.Sleep(200);
result = net_simplify_client.ReadFromServer(CommonLibrary.CommonHeadCode.SimplifyHeadCode.);
if (result.IsSuccess)
{
//服务器应该返回服务器的版本号
BasicFramework.SystemVersion sv = new BasicFramework.SystemVersion(result.Content);
if (UserClient.CurrentVersion != sv)
{
//保存新版本信息
UserClient.JsonSettings.IsNewVersionRunning = true;
UserClient.JsonSettings.SaveSettings();
//和当前系统版本号不一致,启动更新
if (IsHandleCreated) Invoke(start_update);
return;
}
}
else
{
//访问失败
if (IsHandleCreated) Invoke(message_show, result.Message);
if (IsHandleCreated) Invoke(thread_finish);
return;
}
//检查账户
if (IsHandleCreated) Invoke(message_show, "正在检查账户...");
else return;
//延时
Thread.Sleep(200);
//===================================================================================
// 根据实际情况校验,选择数据库校验或是将用户名密码发至服务器校验
// 以下展示了服务器校验的方法如您需要数据库校验请删除下面并改成SQL访问验证的方式
//包装数据
Newtonsoft.Json.Linq.JObject json = new Newtonsoft.Json.Linq.JObject();
json.Add(BasicFramework.UserAccount.UserNameText, new Newtonsoft.Json.Linq.JValue(textBox_userName.Text));
json.Add(BasicFramework.UserAccount.PasswordText, new Newtonsoft.Json.Linq.JValue(textBox_password.Text));
result = net_simplify_client.ReadFromServer(CommonLibrary.CommonHeadCode.SimplifyHeadCode.+json.ToString());
if (result.IsSuccess)
{
//服务器应该返回账户的信息
BasicFramework.UserAccount account = JObject.Parse(result.Content).ToObject<BasicFramework.UserAccount>();
if(!account.LoginEnable)
{
//不允许登录
if (IsHandleCreated) Invoke(message_show, account.ForbidMessage);
if (IsHandleCreated) Invoke(thread_finish);
return;
}
UserClient.UserAccount = account;
}
else
{
//访问失败
if (IsHandleCreated) Invoke(message_show, result.Message);
if (IsHandleCreated) Invoke(thread_finish);
return;
}
//登录成功,进行保存用户名称和密码
UserClient.JsonSettings.LoginName = textBox_userName.Text;
UserClient.JsonSettings.Password = checkBox_remeber.Checked ? textBox_password.Text : "";
UserClient.JsonSettings.SaveSettings();
//================================================================================
//验证结束后,根据需要是否下载服务器的数据,或是等到进入主窗口下载也可以
//如果有参数决定主窗口的显示方式,那么必要在下面向服务器请求数据
//以下展示了初始化参数的功能
if (IsHandleCreated) Invoke(message_show, "正在下载参数...");
else return;
//延时
Thread.Sleep(200);
result = net_simplify_client.ReadFromServer(CommonLibrary.CommonHeadCode.SimplifyHeadCode.);
if(result.IsSuccess)
{
//服务器返回初始化的数据,此处进行数据的提取,有可能包含了多个数据
json = Newtonsoft.Json.Linq.JObject.Parse(result.Content);
//例如公告数据
UserClient.Announcement = BasicFramework.SoftBasic.GetValueFromJsonObject(json, nameof(UserClient.Announcement), "");
}
else
{
//访问失败
if (IsHandleCreated) Invoke(message_show, result.Message);
if (IsHandleCreated) Invoke(thread_finish);
return;
}
//启动主窗口
if (IsHandleCreated) Invoke(new Action(() =>
{
DialogResult = DialogResult.OK;
return;
}));
}
#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

@@ -0,0 +1,481 @@
namespace
{
partial class FormMainWindow
{
/// <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 Windows
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabel_Version = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabel3 = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabel_status = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabel4 = new System.Windows.Forms.ToolStripStatusLabel();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
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.panel1 = new System.Windows.Forms.Panel();
this.label7 = new System.Windows.Forms.Label();
this.listBox1 = new System.Windows.Forms.ListBox();
this.label_address = new System.Windows.Forms.Label();
this.label_last = new System.Windows.Forms.Label();
this.label_times = new System.Windows.Forms.Label();
this.label_register = new System.Windows.Forms.Label();
this.label_grade = new System.Windows.Forms.Label();
this.label_userName = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.label_Announcement = new System.Windows.Forms.Label();
this.label_factory = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.statusStrip1.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// statusStrip1
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripStatusLabel1,
this.toolStripStatusLabel2,
this.toolStripStatusLabel_Version,
this.toolStripStatusLabel3,
this.toolStripStatusLabel_status,
this.toolStripStatusLabel4});
this.statusStrip1.Location = new System.Drawing.Point(0, 454);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(921, 22);
this.statusStrip1.TabIndex = 0;
this.statusStrip1.Text = "statusStrip1";
//
// toolStripStatusLabel1
//
this.toolStripStatusLabel1.ForeColor = System.Drawing.Color.Gray;
this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
this.toolStripStatusLabel1.Size = new System.Drawing.Size(152, 17);
this.toolStripStatusLabel1.Text = "本软件著作权归某某某所有";
//
// toolStripStatusLabel2
//
this.toolStripStatusLabel2.Name = "toolStripStatusLabel2";
this.toolStripStatusLabel2.Size = new System.Drawing.Size(68, 17);
this.toolStripStatusLabel2.Text = " 版本:";
//
// toolStripStatusLabel_Version
//
this.toolStripStatusLabel_Version.ForeColor = System.Drawing.Color.Purple;
this.toolStripStatusLabel_Version.Name = "toolStripStatusLabel_Version";
this.toolStripStatusLabel_Version.Size = new System.Drawing.Size(43, 17);
this.toolStripStatusLabel_Version.Text = "V1.0.0";
//
// toolStripStatusLabel3
//
this.toolStripStatusLabel3.Name = "toolStripStatusLabel3";
this.toolStripStatusLabel3.Size = new System.Drawing.Size(108, 17);
this.toolStripStatusLabel3.Text = " 客户端状态:";
//
// toolStripStatusLabel_status
//
this.toolStripStatusLabel_status.Name = "toolStripStatusLabel_status";
this.toolStripStatusLabel_status.Size = new System.Drawing.Size(101, 17);
this.toolStripStatusLabel_status.Text = "正在连接服务器...";
//
// toolStripStatusLabel4
//
this.toolStripStatusLabel4.Name = "toolStripStatusLabel4";
this.toolStripStatusLabel4.Size = new System.Drawing.Size(84, 17);
this.toolStripStatusLabel4.Text = " 温馨提示:";
//
// menuStrip1
//
this.menuStrip1.BackColor = System.Drawing.SystemColors.Control;
this.menuStrip1.Font = new System.Drawing.Font("Microsoft YaHei UI", 15F);
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.ToolStripMenuItem,
this.ToolStripMenuItem,
this.ToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(921, 33);
this.menuStrip1.TabIndex = 1;
this.menuStrip1.Text = "menuStrip1";
//
// 管理员ToolStripMenuItem
//
this.ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.ToolStripMenuItem,
this.ToolStripMenuItem,
this.ToolStripMenuItem,
this.ToolStripMenuItem});
this.ToolStripMenuItem.Name = "管理员ToolStripMenuItem";
this.ToolStripMenuItem.Size = new System.Drawing.Size(84, 29);
this.ToolStripMenuItem.Text = "管理员";
//
// 更改公告ToolStripMenuItem
//
this.ToolStripMenuItem.Name = "更改公告ToolStripMenuItem";
this.ToolStripMenuItem.Size = new System.Drawing.Size(164, 30);
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, 30);
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, 30);
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, 30);
this.ToolStripMenuItem.Text = "远程更新";
this.ToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click);
//
// 设置ToolStripMenuItem
//
this.ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.ToolStripMenuItem});
this.ToolStripMenuItem.Name = "设置ToolStripMenuItem";
this.ToolStripMenuItem.Size = new System.Drawing.Size(64, 29);
this.ToolStripMenuItem.Text = "设置";
//
// 修改密码ToolStripMenuItem
//
this.ToolStripMenuItem.Name = "修改密码ToolStripMenuItem";
this.ToolStripMenuItem.Size = new System.Drawing.Size(164, 30);
this.ToolStripMenuItem.Text = "修改密码";
this.ToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click);
//
// 关于ToolStripMenuItem
//
this.ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.ToolStripMenuItem,
this.ToolStripMenuItem,
this.ToolStripMenuItem});
this.ToolStripMenuItem.Name = "关于ToolStripMenuItem";
this.ToolStripMenuItem.Size = new System.Drawing.Size(64, 29);
this.ToolStripMenuItem.Text = "关于";
//
// 关于本软件ToolStripMenuItem
//
this.ToolStripMenuItem.Name = "关于本软件ToolStripMenuItem";
this.ToolStripMenuItem.Size = new System.Drawing.Size(184, 30);
this.ToolStripMenuItem.Text = "关于本软件";
this.ToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click);
//
// 更新日志ToolStripMenuItem
//
this.ToolStripMenuItem.Name = "更新日志ToolStripMenuItem";
this.ToolStripMenuItem.Size = new System.Drawing.Size(184, 30);
this.ToolStripMenuItem.Text = "更新日志";
this.ToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click);
//
// 版本号说明ToolStripMenuItem
//
this.ToolStripMenuItem.Name = "版本号说明ToolStripMenuItem";
this.ToolStripMenuItem.Size = new System.Drawing.Size(184, 30);
this.ToolStripMenuItem.Text = "版本号说明";
this.ToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click);
//
// panel1
//
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel1.Controls.Add(this.label_factory);
this.panel1.Controls.Add(this.label9);
this.panel1.Controls.Add(this.label7);
this.panel1.Controls.Add(this.listBox1);
this.panel1.Controls.Add(this.label_address);
this.panel1.Controls.Add(this.label_last);
this.panel1.Controls.Add(this.label_times);
this.panel1.Controls.Add(this.label_register);
this.panel1.Controls.Add(this.label_grade);
this.panel1.Controls.Add(this.label_userName);
this.panel1.Controls.Add(this.label6);
this.panel1.Controls.Add(this.label5);
this.panel1.Controls.Add(this.label4);
this.panel1.Controls.Add(this.label3);
this.panel1.Controls.Add(this.label2);
this.panel1.Controls.Add(this.label1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Right;
this.panel1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.panel1.Location = new System.Drawing.Point(697, 33);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(224, 421);
this.panel1.TabIndex = 2;
//
// label7
//
this.label7.AutoSize = true;
this.label7.ForeColor = System.Drawing.Color.DimGray;
this.label7.Location = new System.Drawing.Point(8, 146);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(104, 17);
this.label7.TabIndex = 13;
this.label7.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(11, 166);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(200, 242);
this.listBox1.TabIndex = 12;
//
// label_address
//
this.label_address.AutoSize = true;
this.label_address.Location = new System.Drawing.Point(82, 109);
this.label_address.Name = "label_address";
this.label_address.Size = new System.Drawing.Size(13, 17);
this.label_address.TabIndex = 11;
this.label_address.Text = "-";
//
// label_last
//
this.label_last.AutoSize = true;
this.label_last.Location = new System.Drawing.Point(82, 92);
this.label_last.Name = "label_last";
this.label_last.Size = new System.Drawing.Size(13, 17);
this.label_last.TabIndex = 10;
this.label_last.Text = "-";
//
// label_times
//
this.label_times.AutoSize = true;
this.label_times.Location = new System.Drawing.Point(82, 75);
this.label_times.Name = "label_times";
this.label_times.Size = new System.Drawing.Size(13, 17);
this.label_times.TabIndex = 9;
this.label_times.Text = "-";
//
// label_register
//
this.label_register.AutoSize = true;
this.label_register.Location = new System.Drawing.Point(82, 58);
this.label_register.Name = "label_register";
this.label_register.Size = new System.Drawing.Size(13, 17);
this.label_register.TabIndex = 8;
this.label_register.Text = "-";
//
// label_grade
//
this.label_grade.AutoSize = true;
this.label_grade.Location = new System.Drawing.Point(82, 24);
this.label_grade.Name = "label_grade";
this.label_grade.Size = new System.Drawing.Size(13, 17);
this.label_grade.TabIndex = 7;
this.label_grade.Text = "-";
//
// label_userName
//
this.label_userName.AutoSize = true;
this.label_userName.Location = new System.Drawing.Point(82, 7);
this.label_userName.Name = "label_userName";
this.label_userName.Size = new System.Drawing.Size(13, 17);
this.label_userName.TabIndex = 6;
this.label_userName.Text = "-";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(8, 109);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(79, 17);
this.label6.TabIndex = 5;
this.label6.Text = "上次登录IP";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(8, 92);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(68, 17);
this.label5.TabIndex = 4;
this.label5.Text = "最近登录:";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(8, 75);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(68, 17);
this.label4.TabIndex = 3;
this.label4.Text = "登录频次:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(8, 58);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(68, 17);
this.label3.TabIndex = 2;
this.label3.Text = "注册时间:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(8, 24);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(68, 17);
this.label2.TabIndex = 1;
this.label2.Text = "权限等级:";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(8, 7);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(56, 17);
this.label1.TabIndex = 0;
this.label1.Text = "用户名:";
//
// label_Announcement
//
this.label_Announcement.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label_Announcement.Font = new System.Drawing.Font("楷体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label_Announcement.ForeColor = System.Drawing.Color.Red;
this.label_Announcement.Location = new System.Drawing.Point(283, 0);
this.label_Announcement.Name = "label_Announcement";
this.label_Announcement.Size = new System.Drawing.Size(638, 33);
this.label_Announcement.TabIndex = 3;
this.label_Announcement.Text = "[公告]";
this.label_Announcement.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label_factory
//
this.label_factory.AutoSize = true;
this.label_factory.Location = new System.Drawing.Point(82, 41);
this.label_factory.Name = "label_factory";
this.label_factory.Size = new System.Drawing.Size(13, 17);
this.label_factory.TabIndex = 15;
this.label_factory.Text = "-";
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(8, 41);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(68, 17);
this.label9.TabIndex = 14;
this.label9.Text = "所属分厂:";
//
// FormMainWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(921, 476);
this.Controls.Add(this.label_Announcement);
this.Controls.Add(this.panel1);
this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.menuStrip1);
this.MainMenuStrip = this.menuStrip1;
this.Name = "FormMainWindow";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "主界面";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormMainWindow_FormClosing);
this.Load += new System.EventHandler(this.FormMainWindow_Load);
this.Shown += new System.EventHandler(this.FormMainWindow_Shown);
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel2;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel_Version;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel3;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel_status;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel4;
private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.ListBox listBox1;
private System.Windows.Forms.Label label_address;
private System.Windows.Forms.Label label_last;
private System.Windows.Forms.Label label_times;
private System.Windows.Forms.Label label_register;
private System.Windows.Forms.Label label_grade;
private System.Windows.Forms.Label label_userName;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label_Announcement;
private System.Windows.Forms.Label label_factory;
private System.Windows.Forms.Label label9;
}
}

View File

@@ -0,0 +1,307 @@
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 BasicFramework;
using IndustryEthernet;
using Newtonsoft.Json.Linq;
using CommonLibrary;
using System.Threading;
//============================================================================
// 模版日期 2017-02-21
// 创建人 胡少林
// 版权所有 胡少林
// 授权说明 模版仅授权个人使用如需商用请联系hsl200909@163.com洽谈
// 说明 JSON组件引用自james newton-king遵循MIT授权协议
//============================================================================
//============================================================================
//
// 注意:本代码的相关操作未作密码验证,如有需要,请自行完成
// 示例具体示例参照Form1_FormClosing(object sender, FormClosingEventArgs e)方法
// 如果遇到启动调试就退出了请注释掉Program.cs文件中的指允许启动一个实例的代码
//
//============================================================================
namespace
{
public partial class FormMainWindow : Form
{
public FormMainWindow()
{
InitializeComponent();
}
#region
/// <summary>
/// 指示窗口是否显示的标志
/// </summary>
private bool IsWindowShow { get; set; } = false;
private void FormMainWindow_Load(object sender, EventArgs e)
{
//窗口载入
label_userName.Text = UserClient.UserAccount.UserName;
label_grade.Text = AccountGrade.GetDescription(UserClient.UserAccount.Grade);
label_factory.Text = UserClient.UserAccount.Factory;
label_register.Text = UserClient.UserAccount.RegisterTime.ToString();
label_last.Text = UserClient.UserAccount.LastLoginTime.ToString();
label_times.Text = UserClient.UserAccount.LoginFrequency.ToString();
label_address.Text = UserClient.UserAccount.LastLoginIpAddress;
//绑定事件仅执行一次不能放到show方法里
net_socket_client.MessageAlerts += Net_socket_client_MessageAlerts;
net_socket_client.LoginFailed += Net_socket_client_LoginFailed;
net_socket_client.LoginSuccess += Net_socket_client_LoginSuccess;
net_socket_client.AcceptByte += Net_socket_client_AcceptByte;
net_socket_client.AcceptString += Net_socket_client_AcceptString;
//启动网络服务
Net_Socket_Client_Initialization();
label_Announcement.Text = UserClient.Announcement;
toolStripStatusLabel_Version.Text = UserClient.CurrentVersion.ToString();
}
private void FormMainWindow_Shown(object sender, EventArgs e)
{
//窗口显示
IsWindowShow = true;
//是否显示更新日志
if(UserClient.JsonSettings.IsNewVersionRunning)
{
UserClient.JsonSettings.IsNewVersionRunning = false;
UserClient.JsonSettings.SaveSettings();
ToolStripMenuItem_Click(null, new EventArgs());
}
//根据权限使能菜单
if(UserClient.UserAccount.Grade<AccountGrade.SuperAdministrator)
{
ToolStripMenuItem.Enabled = false;
ToolStripMenuItem.Enabled = false;
ToolStripMenuItem.Enabled = false;
}
}
private void FormMainWindow_FormClosing(object sender, FormClosingEventArgs e)
{
//窗口关闭
IsWindowShow = false;
net_socket_client.ClientClose();
//等待一秒退出
FormWaitInfomation fwm = new FormWaitInfomation("正在退出程序...", 1000);
fwm.ShowDialog();
fwm.Dispose();
}
#endregion
#region
private void ToolStripMenuItem_Click(object sender, EventArgs e)
{
//实例化一个密码修改的窗口,并指定了实现修改的具体方法,指定了密码长度
FormPasswordModify fpm = new FormPasswordModify(UserClient.UserAccount.Password,
p => {
JObject json = new JObject();json.Add(UserAccount.UserNameText, UserClient.UserAccount.UserName);
json.Add(UserAccount.PasswordText, p);
return net_simplify_client.ReadFromServer(CommonHeadCode.SimplifyHeadCode. + json.ToString()).IsSuccess;
}, 6, 8);
fpm.ShowDialog();
fpm.Dispose();
}
private void ToolStripMenuItem_Click(object sender, EventArgs e)
{
FormAbout fa = new FormAbout("软件系统", UserClient.CurrentVersion, 2017, "张三");
fa.ShowDialog();
fa.Dispose();
}
private void ToolStripMenuItem_Click(object sender, EventArgs e)
{
//更新情况复位
if (UserClient.JsonSettings.IsNewVersionRunning)
{
UserClient.JsonSettings.IsNewVersionRunning = false;
UserClient.JsonSettings.SaveSettings();
}
FormUpdateLog ful = new FormUpdateLog(UserClient.HistoryVersions);
ful.ShowDialog();
ful.Dispose();
}
private void ToolStripMenuItem_Click(object sender, EventArgs e)
{
FormAboutVersion fav = new FormAboutVersion(UserClient.CurrentVersion);
fav.ShowDialog();
fav.Dispose();
}
private void ToolStripMenuItem_Click(object sender, EventArgs e)
{
FormInputAndAction fiaa = new FormInputAndAction(str => net_simplify_client.ReadFromServer(
CommonHeadCode.SimplifyHeadCode. + str).IsSuccess,UserClient.Announcement);
fiaa.ShowDialog();
fiaa.Dispose();
}
private void ToolStripMenuItem_Click(object sender, EventArgs e)
{
FormLog flg = new FormLog(net_simplify_client);
flg.ShowDialog();
flg.Dispose();
}
private void ToolStripMenuItem_Click(object sender, EventArgs e)
{
FormAccountManage fam = new FormAccountManage(() =>
{
OperateResultString result = net_simplify_client.ReadFromServer(CommonHeadCode.SimplifyHeadCode.);
if (result.IsSuccess) return result.Content;
else return result.ToMessageShowString();
},m => net_simplify_client.ReadFromServer(CommonHeadCode.SimplifyHeadCode. + m).IsSuccess);
fam.ShowDialog();
fam.Dispose();
}
private void ToolStripMenuItem_Click(object sender, EventArgs e)
{
//暂不支持,期待下个版本
MessageBox.Show("暂不支持该特性");
}
#endregion
#region
private Net_Socket_Client net_socket_client = new Net_Socket_Client();
private void Net_Socket_Client_Initialization()
{
try
{
net_socket_client.EndPointServer = new System.Net.IPEndPoint(
System.Net.IPAddress.Parse(UserClient.ServerIp),
CommonLibrary.CommonLibrary.Port_Main_Net);
net_socket_client.ClientAlias = UserClient.UserAccount.UserName;
net_socket_client.ClientStart();
}
catch(Exception ex)
{
SoftBasic.ShowExceptionMessage(ex);
}
}
private void Net_socket_client_AcceptString(HuTcpState object1, string object2)
{
//接收到服务器发来的字符串数据
string head_code = object2.Substring(0, 4);
if (head_code == CommonHeadCode.MultiNetHeadCode.)
{
if (IsHandleCreated) Invoke(new Action(() =>
{
FormPopup fpp = new FormPopup(object2.Substring(4), Color.DodgerBlue, 10000);
fpp.Show();
}));
}
else if (head_code == CommonHeadCode.MultiNetHeadCode.线)
{
if (IsHandleCreated) Invoke(new Action(() =>
{
listBox1.DataSource = object2.Substring(4).Split('#');
}));
}
else if (head_code == CommonHeadCode.MultiNetHeadCode.)
{
if (IsHandleCreated) Invoke(new Action(() =>
{
Close();
}));
}
else if(head_code==CommonHeadCode.SimplifyHeadCode.)
{
//此处应用到了同步类的指令头
if (IsHandleCreated) Invoke(new Action(() =>
{
UserClient.Announcement = object2.Substring(4);
label_Announcement.Text= object2.Substring(4);
FormPopup fpp = new FormPopup(object2.Substring(4), Color.DodgerBlue, 10000);
fpp.Show();
}));
}
}
private void Net_socket_client_AcceptByte(HuTcpState object1, byte[] object2)
{
//接收到服务器发来的字节数据
}
private void Net_socket_client_LoginSuccess()
{
//登录成功,或重新登录成功的事件,有些数据的初始化可以放在此处
if (IsHandleCreated) Invoke(new Action(() =>
{
toolStripStatusLabel_status.Text = "客户端启动成功";
}));
}
private void Net_socket_client_LoginFailed(int object1)
{
//登录失败的情况,如果连续三次连接失败,请考虑退出系统
if (object1 > 3)
{
if (IsHandleCreated) Invoke(new Action(() =>
{
Close();
}));
}
}
private void Net_socket_client_MessageAlerts(string object1)
{
//信息提示
if (IsHandleCreated) Invoke(new Action(() =>
{
toolStripStatusLabel_status.Text = object1;
}));
}
#endregion
#region
//=========================================================================================
//
// 在本界面任意地方调用net_simplify_client.ReadFromServer("[指令头]")即可获取服务器数据
// 处理结果之前先进行判定,具体参照示例
//
//=========================================================================================
/// <summary>
/// 用于界面请求访问服务器数据所用
/// </summary>
private Net_Simplify_Client net_simplify_client = new Net_Simplify_Client(
new System.Net.IPEndPoint(System.Net.IPAddress.Parse(UserClient.ServerIp),
CommonLibrary.CommonLibrary.Port_Second_Net));
#endregion
}
}

View File

@@ -0,0 +1,126 @@
<?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>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>138, 17</value>
</metadata>
</root>

View File

@@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
//=====================================================================
//为了强制只启动一个应用程序的实例
Process process = Process.GetCurrentProcess();
//遍历应用程序的同名进程组
foreach (Process p in Process.GetProcessesByName(process.ProcessName))
{
//不是同一进程则关闭刚刚创建的进程
if (p.Id != process.Id)
{
//此处显示原先的窗口需要一定的时间,不然无法显示
ShowWindowAsync(p.MainWindowHandle, 9);
SetForegroundWindow(p.MainWindowHandle);
System.Threading.Thread.Sleep(10);
Application.Exit();//关闭当前的应用程序
return;
}
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
//===================================================================
//运行主窗口之前先进行账户的验证
FormLogin login = new FormLogin();
if (login.ShowDialog() == DialogResult.OK)
{
login.Dispose();
Application.Run(new FormMainWindow());
}
else
{
login.Dispose();
}
}
[DllImport("User32.dll")]
private static extern bool ShowWindowAsync(IntPtr hWnd, int cmdShow);
[DllImport("User32.dll")]
private static extern bool SetForegroundWindow(IntPtr hWnd);
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("软件系统客户端模版")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("软件系统客户端模版")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//将 ComVisible 设置为 false 将使此程序集中的类型
//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("1a4c9858-c8d6-45fb-802a-3513400d11f3")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace .Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("软件系统客户端模版.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 覆盖当前线程的 CurrentUICulture 属性
/// 使用此强类型的资源类的资源查找。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@@ -0,0 +1,117 @@
<?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.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: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" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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

@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace .Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace
{
//====================================================================================================
// 模版说明:
//====================================================================================================
public class UserClient
{
public static BasicFramework.JsonSettings JsonSettings = new BasicFramework.JsonSettings();
/// <summary>
/// 本软件的当前版本,用来验证更新的关键依据
/// </summary>
public static BasicFramework.SystemVersion CurrentVersion { get; } = new BasicFramework.SystemVersion("1.0.0");
/// <summary>
/// 服务器的IP地址默认为127.0.0.1,可用于单机调试
/// </summary>
public static string ServerIp { get; } = "127.0.0.1";
/// <summary>
/// 所有版本更新信息的对象
/// </summary>
public static BasicFramework.ClassSystemVersion HistoryVersions { get; } = new BasicFramework.ClassSystemVersion()
{
Versions = new List<BasicFramework.VersionInfo>()
{
//写入所有的历史版本信息,这样就能在更新日志的界面查看到信息
new BasicFramework.VersionInfo()
{
VersionNum=new BasicFramework.SystemVersion("1.0.0"),
ReleaseDate=new DateTime(2017,1,1),//该版本发布的日期
UpdateDetails=new StringBuilder("1.本系统第一版本正式发布使用。"+Environment.NewLine+
"2.提供了多客户端用时在线的功能。"+Environment.NewLine+
"3.需要用户自行添加"),
},
},
};
/// <summary>
/// 设置或获取系统的公告
/// </summary>
public static string Announcement { get; set; } = "";
/// <summary>
/// 当前系统的登录账户
/// </summary>
public static BasicFramework.UserAccount UserAccount { get; set; } = new BasicFramework.UserAccount();
}
}

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net35" />
</packages>

View File

@@ -0,0 +1,119 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{1A4C9858-C8D6-45FB-802A-3513400D11F3}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>软件系统客户端模版</RootNamespace>
<AssemblyName>软件系统客户端模版</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="BasicFramework, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Public\BasicFramework.dll</HintPath>
</Reference>
<Reference Include="CommonLibrary">
<HintPath>..\CommonLibrary\bin\Debug\CommonLibrary.dll</HintPath>
</Reference>
<Reference Include="IndustryEthernet, Version=3.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Public\IndustryEthernet.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net35\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="FormLog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FormLog.Designer.cs">
<DependentUpon>FormLog.cs</DependentUpon>
</Compile>
<Compile Include="FormLogin.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FormLogin.Designer.cs">
<DependentUpon>FormLogin.cs</DependentUpon>
</Compile>
<Compile Include="FormMainWindow.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FormMainWindow.Designer.cs">
<DependentUpon>FormMainWindow.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UserClient.cs" />
<EmbeddedResource Include="FormLog.resx">
<DependentUpon>FormLog.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FormLogin.resx">
<DependentUpon>FormLogin.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FormMainWindow.resx">
<DependentUpon>FormMainWindow.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>