提交 cb3e4ec5 编写于 作者: Richard__Hu's avatar Richard__Hu

删除原先一些重复代码,使用了ClientsLibrary代码实现

上级 6c7129c6
......@@ -83,5 +83,20 @@ namespace ClientsLibrary
{
KeyToken = CommonHeadCode.KeyToken,
};
public static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
if (e.ExceptionObject is Exception ex)
{
//使用UDP方法传送会服务器
string info = $"{Environment.NewLine}信息:{ex.Message}" +
$"{Environment.NewLine}类型:{ex.GetType().ToString()}" +
$"{Environment.NewLine}堆栈:{ex.StackTrace}" +
$"{Environment.NewLine}方法:{ex.TargetSite.Name}" +
$"{Environment.NewLine}" + "=".PadLeft(50, '=');
UserClient.Net_simplify_client.ReadFromServer(CommonHeadCode.SimplifyHeadCode.异常消息, info);
}
}
}
}
......@@ -26,7 +26,7 @@ namespace 软件系统客户端Wpf
{
base.OnStartup(e);
//捕获未处理的异常
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
AppDomain.CurrentDomain.UnhandledException += ClientsLibrary.UserClient.CurrentDomain_UnhandledException;
Process process = Process.GetCurrentProcess();
//遍历应用程序的同名进程组
......@@ -71,11 +71,7 @@ namespace 软件系统客户端Wpf
}
}
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
}
[DllImport("User32.dll")]
private static extern bool ShowWindowAsync(IntPtr hWnd, int cmdShow);
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HslCommunication.Enthernet;
using HslCommunication.BasicFramework;
using CommonLibrary;
namespace 软件系统客户端Wpf
{
//====================================================================================================
// 模版说明:
//====================================================================================================
public class UserClient
{
public static JsonSettings JsonSettings = new JsonSettings();
/// <summary>
/// 本软件的当前版本,用来验证更新的关键依据
/// </summary>
public static SystemVersion CurrentVersion { get; } = new SystemVersion("1.0.0");
/// <summary>
/// 服务器的IP地址,默认为127.0.0.1,可用于单机调试
/// </summary>
public static string ServerIp { get; } = "127.0.0.1";
/// <summary>
/// 所有版本更新信息的对象
/// </summary>
public static List<VersionInfo> HistoryVersions { get; } = new List<VersionInfo>
{
//写入所有的历史版本信息,这样就能在更新日志的界面查看到信息
new VersionInfo()
{
VersionNum=new 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 UserAccount UserAccount { get; set; } = new UserAccount();
/// <summary>
/// 服务器的时间,该时间与服务器同步,每隔10秒钟,防止客户端串改单机时间,可以作为各种时间条件判定
/// </summary>
public static DateTime DateTimeServer { get; set; } = DateTime.Now;
/// <summary>
/// 用于访问服务器数据的网络对象类,必须修改这个端口参数,否则运行失败
/// </summary>
public static Net_Simplify_Client Net_simplify_client = new Net_Simplify_Client(
new System.Net.IPEndPoint(System.Net.IPAddress.Parse(ServerIp),
CommonLibrary.CommonLibrary.Port_Second_Net))
{
KeyToken = CommonHeadCode.KeyToken,
ConnectTimeout = 5000,
};
/// <summary>
/// 用于使用udp向服务器进行发送即时可丢失数据的对象
/// </summary>
public static Net_Udp_Client Net_Udp_Client = new Net_Udp_Client(
new System.Net.IPEndPoint(System.Net.IPAddress.Parse(ServerIp),
CommonLibrary.CommonLibrary.Port_Udp_Server))
{
KeyToken = CommonHeadCode.KeyToken,
};
}
}
......@@ -17,6 +17,7 @@ using HslCommunication;
using CommonLibrary;
using HslCommunication.BasicFramework;
using Newtonsoft.Json.Linq;
using ClientsLibrary;
namespace 软件系统客户端Wpf
{
......
......@@ -17,6 +17,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ClientsLibrary;
namespace 软件系统客户端Wpf
{
......
......@@ -33,6 +33,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="ClientsLibrary">
<HintPath>..\ClientsLibrary\bin\Debug\ClientsLibrary.dll</HintPath>
</Reference>
<Reference Include="CommonLibrary">
<HintPath>..\CommonLibrary\bin\Debug\CommonLibrary.dll</HintPath>
</Reference>
......@@ -82,7 +85,6 @@
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="BasicSupport\UserClient.cs" />
<Compile Include="LoginWindow.xaml.cs">
<DependentUpon>LoginWindow.xaml</DependentUpon>
</Compile>
......
namespace 软件系统客户端模版
{
partial class FormDownloading
{
/// <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.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(56, 28);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(43, 17);
this.label1.TabIndex = 0;
this.label1.Text = "label1";
//
// FormDownloading
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(300, 56);
this.Controls.Add(this.label1);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FormDownloading";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "FormDownloading";
this.Load += new System.EventHandler(this.FormDownloading_Load);
this.Shown += new System.EventHandler(this.FormDownloading_Shown);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.FormDownloading_Paint);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
}
}
\ No newline at end of file
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 HslCommunication;
namespace 软件系统客户端模版
{
//=============================================================================
//
// 时间:2017-03-08 12:41:37
// 用于下载数据的提示窗口
//
//=============================================================================
public partial class FormDownloading : Form
{
public FormDownloading(int customer,Action<OperateResultString> action)
{
InitializeComponent();
net_cmd = customer;
DealWithResult = action;
DoubleBuffered = true;
}
private void FormDownloading_Paint(object sender, PaintEventArgs e)
{
//绘制显示
e.Graphics.DrawLines(pen_dash, new Point[]
{
new Point(44,44),
new Point(14,44),
new Point(14,14),
new Point(44,14),
new Point(44,44),
});
//画边框
e.Graphics.DrawRectangle(Pens.LightGray, new Rectangle(0, 0, Width - 1, Height - 1));
}
Pen pen_dash = new Pen(Color.Green);
float Pen_Offect = 0;
private void FormDownloading_Load(object sender, EventArgs e)
{
pen_dash.DashStyle = System.Drawing.Drawing2D.DashStyle.Custom;
pen_dash.DashPattern = new float[] { 5, 5 };
pen_dash.DashOffset = 0;
time.Interval = 38;//2017-03-08 13:20:33
time.Tick += Time_Tick;
label1.Text = "正在请求数据...";
}
private void Time_Tick(object sender, EventArgs e)
{
Pen_Offect--;
if (Pen_Offect < -5) Pen_Offect = 4;
pen_dash.DashOffset = Pen_Offect;
Invalidate();//引发重画
}
//定时块
private Timer time = new Timer();
private void FormDownloading_Shown(object sender, EventArgs e)
{
time.Start();
System.Threading.Thread thread = new System.Threading.Thread(ThreadRequestServer);
thread.IsBackground = true;
thread.Start();
}
private int net_cmd = 0;
private Action<OperateResultString> DealWithResult = null;
private void ThreadRequestServer()
{
//后台请求数据
System.Threading.Thread.Sleep(100);
OperateResultString result = UserClient.Net_simplify_client.ReadFromServer(net_cmd);
Invoke(new Action(() =>
{
DealWithResult(result);
time.Stop();
System.Threading.Thread.Sleep(20);
Dispose();
}));
}
}
}
<?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>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CommonLibrary;
using System.Text.RegularExpressions;
using HslCommunication;
using HslCommunication.Enthernet;
namespace 软件系统客户端模版
{
public partial class FormLog : Form
{
public FormLog()
{
InitializeComponent();
net_simplify_client = UserClient.Net_simplify_client;
}
private Net_Simplify_Client net_simplify_client = null;
private void FormLog_Load(object sender, EventArgs e)
{
}
private void ReadFromServer(int head_code)
{
OperateResultString result = net_simplify_client.ReadFromServer(head_code);
if (result.IsSuccess)
{
textBox1.Text = result.Content;
LogTemp = result.Content;
}
else textBox1.Text = result.ToMessageShowString();
}
private void ClearFromServer(int 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.更新日志清空);
}
private void userButton7_Click(object sender, EventArgs e)
{
ReadFromServer(CommonHeadCode.SimplifyHeadCode.运行日志查看);
}
private void userButton6_Click(object sender, EventArgs e)
{
ClearFromServer(CommonHeadCode.SimplifyHeadCode.运行日志清空);
}
private void userButton9_Click(object sender, EventArgs e)
{
ReadFromServer(CommonHeadCode.SimplifyHeadCode.文件日志查看);
}
private void userButton8_Click(object sender, EventArgs e)
{
ClearFromServer(CommonHeadCode.SimplifyHeadCode.文件日志清空);
}
private void userButton11_Click(object sender, EventArgs e)
{
ReadFromServer(CommonHeadCode.SimplifyHeadCode.反馈日志查看);
}
private void userButton10_Click(object sender, EventArgs e)
{
ClearFromServer(CommonHeadCode.SimplifyHeadCode.反馈日志清空);
}
private void userButton13_Click(object sender, EventArgs e)
{
ReadFromServer(CommonHeadCode.SimplifyHeadCode.UDP日志查看);
}
private void userButton12_Click(object sender, EventArgs e)
{
ClearFromServer(CommonHeadCode.SimplifyHeadCode.UDP日志清空);
}
private void userButton14_Click(object sender, EventArgs e)
{
ReadFromServer(CommonHeadCode.SimplifyHeadCode.客户端日志查看);
}
private void userButton15_Click(object sender, EventArgs e)
{
ClearFromServer(CommonHeadCode.SimplifyHeadCode.客户端日志清空);
}
private void userButton17_Click(object sender, EventArgs e)
{
ReadFromServer(CommonHeadCode.SimplifyHeadCode.头像日志查看);
}
private void userButton16_Click(object sender, EventArgs e)
{
ClearFromServer(CommonHeadCode.SimplifyHeadCode.头像日志清空);
}
/// <summary>
/// 查询日志的缓存
/// </summary>
private string LogTemp = string.Empty;
/// <summary>
/// 筛选出符合需求的日志
/// </summary>
/// <param name="filter"></param>
/// <returns></returns>
private string FilterString(string filter)
{
StringBuilder sb = new StringBuilder();
MatchCollection mc = Regex.Matches(LogTemp, @"\u0002\[" + filter + @"[^\u0002]+");
foreach (Match m in mc)
{
sb.Append(m.Value);
}
return sb.ToString();
}
private void userButton_log1_Click(object sender, EventArgs e)
{
textBox1.Text = FilterString(HslCommunication.BasicFramework.SoftLogHelper.Normal);
}
private void userButton_log2_Click(object sender, EventArgs e)
{
textBox1.Text = FilterString(HslCommunication.BasicFramework.SoftLogHelper.Information);
}
private void userButton_log3_Click(object sender, EventArgs e)
{
textBox1.Text = FilterString(HslCommunication.BasicFramework.SoftLogHelper.Warnning);
}
private void userButton_log4_Click(object sender, EventArgs e)
{
textBox1.Text = FilterString(HslCommunication.BasicFramework.SoftLogHelper.Error);
}
private void userButton_log_Click(object sender, EventArgs e)
{
textBox1.Text = LogTemp;
}
}
}
<?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>
\ No newline at end of file
......@@ -11,6 +11,7 @@ using Newtonsoft.Json.Linq;
using HslCommunication;
using CommonLibrary;
using HslCommunication.BasicFramework;
using ClientsLibrary;
namespace 软件系统客户端模版
{
......
......@@ -12,6 +12,7 @@ using System.Threading;
using HslCommunication;
using HslCommunication.Enthernet;
using HslCommunication.BasicFramework;
using ClientsLibrary;
/***************************************************************************************
......
using HslCommunication.Controls;
namespace 软件系统客户端模版
{
partial class FormRegisterAccount
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.textBox3 = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.textBox4 = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.userButton_login = new UserButton();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.comboBox2 = new System.Windows.Forms.ComboBox();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(21, 18);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(56, 17);
this.label1.TabIndex = 0;
this.label1.Text = "用户名:";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(98, 15);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(232, 23);
this.textBox1.TabIndex = 1;
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(98, 51);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(232, 23);
this.textBox2.TabIndex = 3;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(21, 54);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(44, 17);
this.label2.TabIndex = 2;
this.label2.Text = "密码:";
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(98, 87);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(232, 23);
this.textBox3.TabIndex = 5;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(21, 90);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(44, 17);
this.label3.TabIndex = 4;
this.label3.Text = "工厂:";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(21, 125);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(44, 17);
this.label4.TabIndex = 6;
this.label4.Text = "权限:";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(21, 161);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(68, 17);
this.label5.TabIndex = 8;
this.label5.Text = "能否登录:";
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(98, 192);
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(232, 23);
this.textBox4.TabIndex = 11;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(21, 195);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(68, 17);
this.label6.TabIndex = 10;
this.label6.Text = "禁止原因:";
//
// userButton_login
//
this.userButton_login.BackColor = System.Drawing.Color.Transparent;
this.userButton_login.CustomerInformation = "";
this.userButton_login.EnableColor = System.Drawing.Color.FromArgb(((int)(((byte)(190)))), ((int)(((byte)(190)))), ((int)(((byte)(190)))));
this.userButton_login.Font = new System.Drawing.Font("微软雅黑", 9F);
this.userButton_login.Location = new System.Drawing.Point(149, 279);
this.userButton_login.Margin = new System.Windows.Forms.Padding(3, 5, 3, 5);
this.userButton_login.Name = "userButton_login";
this.userButton_login.Size = new System.Drawing.Size(97, 31);
this.userButton_login.TabIndex = 12;
this.userButton_login.UIText = "注册";
this.userButton_login.Click += new System.EventHandler(this.userButton_login_Click);
//
// comboBox1
//
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(98, 122);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(232, 25);
this.comboBox1.TabIndex = 13;
//
// comboBox2
//
this.comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox2.FormattingEnabled = true;
this.comboBox2.Location = new System.Drawing.Point(98, 157);
this.comboBox2.Name = "comboBox2";
this.comboBox2.Size = new System.Drawing.Size(232, 25);
this.comboBox2.TabIndex = 14;
//
// FormRegisterAccount
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(382, 342);
this.Controls.Add(this.comboBox2);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.userButton_login);
this.Controls.Add(this.textBox4);
this.Controls.Add(this.label6);
this.Controls.Add(this.label5);
this.Controls.Add(this.label4);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.label3);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.label2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label1);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.MaximizeBox = false;
this.Name = "FormRegisterAccount";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "注册新账户";
this.Load += new System.EventHandler(this.FormRegisterAccount_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.Label label6;
private UserButton userButton_login;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.ComboBox comboBox2;
}
}
\ No newline at end of file
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 HslCommunication.Enthernet;
using HslCommunication;
using CommonLibrary;
namespace 软件系统客户端模版
{
public partial class FormRegisterAccount : Form
{
public FormRegisterAccount()
{
InitializeComponent();
net_client = UserClient.Net_simplify_client;
}
private void FormRegisterAccount_Load(object sender, EventArgs e)
{
comboBox1.DataSource = AccountGrade.GetDescription();
comboBox2.DataSource = new string[] { "允许", "不允许" };
comboBox1.SelectedItem = AccountGrade.GetDescription(AccountGrade.Technology);
comboBox2.SelectedItem = "允许";
textBox4.Text = (new UserAccount()).ForbidMessage;
}
private Net_Simplify_Client net_client = null;
private void userButton_login_Click(object sender, EventArgs e)
{
//点击了注册,先获取数据
UserAccount account = new UserAccount();
account.UserName = textBox1.Text;
account.Password = textBox2.Text;
account.Factory = textBox3.Text;
switch (comboBox1.SelectedIndex)
{
case 0: account.Grade = AccountGrade.SuperAdministrator; break;
case 1: account.Grade = AccountGrade.Admin; break;
case 2: account.Grade = AccountGrade.Technology; break;
default: account.Grade = AccountGrade.General; break;
}
account.LoginEnable = comboBox2.SelectedItem.ToString() == "允许";
account.ForbidMessage = textBox4.Text;
OperateResultString result = net_client.ReadFromServer(CommonHeadCode.SimplifyHeadCode.注册账号, account.ToJsonString());
if (result.IsSuccess && result.Content == "1")
{
MessageBox.Show("注册成功!");
}
else
{
MessageBox.Show("注册失败!");
}
}
}
}
<?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>
\ No newline at end of file
using HslCommunication.Controls;
namespace 软件系统客户端模版
{
partial class FormUpdateRemote
{
/// <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.userButton_file = new UserButton();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.userButton_version = new UserButton();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(24, 22);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(188, 17);
this.label1.TabIndex = 0;
this.label1.Text = "第一步:更新所有新版本的文件。";
//
// userButton_file
//
this.userButton_file.BackColor = System.Drawing.Color.Transparent;
this.userButton_file.CustomerInformation = "";
this.userButton_file.EnableColor = System.Drawing.Color.FromArgb(((int)(((byte)(190)))), ((int)(((byte)(190)))), ((int)(((byte)(190)))));
this.userButton_file.Font = new System.Drawing.Font("微软雅黑", 9F);
this.userButton_file.Location = new System.Drawing.Point(216, 62);
this.userButton_file.Margin = new System.Windows.Forms.Padding(3, 5, 3, 5);
this.userButton_file.Name = "userButton_file";
this.userButton_file.Size = new System.Drawing.Size(94, 37);
this.userButton_file.TabIndex = 13;
this.userButton_file.UIText = "选择文件";
this.userButton_file.Click += new System.EventHandler(this.userButton_file_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(141, 181);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(245, 23);
this.textBox1.TabIndex = 14;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.Location = new System.Drawing.Point(24, 132);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(176, 17);
this.label2.TabIndex = 15;
this.label2.Text = "第二步:更新服务器的版本号。";
//
// userButton_version
//
this.userButton_version.BackColor = System.Drawing.Color.Transparent;
this.userButton_version.CustomerInformation = "";
this.userButton_version.EnableColor = System.Drawing.Color.FromArgb(((int)(((byte)(190)))), ((int)(((byte)(190)))), ((int)(((byte)(190)))));
this.userButton_version.Font = new System.Drawing.Font("微软雅黑", 9F);
this.userButton_version.Location = new System.Drawing.Point(216, 236);
this.userButton_version.Margin = new System.Windows.Forms.Padding(3, 5, 3, 5);
this.userButton_version.Name = "userButton_version";
this.userButton_version.Size = new System.Drawing.Size(94, 37);
this.userButton_version.TabIndex = 16;
this.userButton_version.UIText = "提交版本号";
this.userButton_version.Click += new System.EventHandler(this.userButton_version_Click);
//
// FormUpdateRemote
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(569, 311);
this.Controls.Add(this.userButton_version);
this.Controls.Add(this.label2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.userButton_file);
this.Controls.Add(this.label1);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.MaximumSize = new System.Drawing.Size(585, 350);
this.MinimumSize = new System.Drawing.Size(585, 350);
this.Name = "FormUpdateRemote";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "远程更新客户端";
this.Load += new System.EventHandler(this.FormUpdateRemote_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private UserButton userButton_file;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label2;
private UserButton userButton_version;
}
}
\ No newline at end of file
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 HslCommunication;
using HslCommunication.Enthernet;
using CommonLibrary;
namespace 软件系统客户端模版
{
//=====================================================================================
//
// 用途: 本窗口用于实现对本系统的客户端进行全面的远程更新的操作。
// 第一步: 先将新版本的所有客户端传送到服务器端进行覆盖。
// 第二步: 再将版本号传送到服务器进行更新,这样所有的客户端登录后就会自动更新新的版本了
//
//=====================================================================================
public partial class FormUpdateRemote : Form
{
public FormUpdateRemote()
{
InitializeComponent();
}
private void userButton_file_Click(object sender, EventArgs e)
{
using (OpenFileDialog ofd = new OpenFileDialog())
{
ofd.Multiselect = true;
if (ofd.ShowDialog() == DialogResult.OK)
{
using (FormFileOperate fUpload = new FormFileOperate(CommonHeadCode.KeyToken, new System.Net.IPEndPoint(
System.Net.IPAddress.Parse(UserClient.ServerIp), CommonLibrary.CommonLibrary.Port_Update_Remote),
ofd.FileNames, "", "", ""))
{
fUpload.ShowDialog();
}
}
}
}
private void userButton_version_Click(object sender, EventArgs e)
{
OperateResultString result = UserClient.Net_simplify_client.ReadFromServer(CommonHeadCode.SimplifyHeadCode.更新版本, textBox1.Text);
if (result.IsSuccess && result.Content == "1")
{
MessageBox.Show("更新成功!");
}
else
{
MessageBox.Show("更新失败!原因:" + result.ToMessageShowString());
}
}
private void FormUpdateRemote_Load(object sender, EventArgs e)
{
textBox1.Text = UserClient.CurrentVersion.ToString();
}
}
}
<?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>
\ No newline at end of file
......@@ -5,6 +5,7 @@ using System.Linq;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace 软件系统客户端模版
{
static class Program
......@@ -20,7 +21,7 @@ namespace 软件系统客户端模版
static void Main()
{
//捕获未处理的异常
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
AppDomain.CurrentDomain.UnhandledException += ClientsLibrary.UserClient.CurrentDomain_UnhandledException;
//=====================================================================
//为了强制只启动一个应用程序的实例
......@@ -65,19 +66,7 @@ namespace 软件系统客户端模版
}
}
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
if(e.ExceptionObject is Exception ex)
{
//使用UDP方法传送会服务器
string info = $"{Environment.NewLine}信息:{ex.Message}" +
$"{Environment.NewLine}类型:{ex.GetType().ToString()}" +
$"{Environment.NewLine}堆栈:{ex.StackTrace}" +
$"{Environment.NewLine}方法:{ex.TargetSite.Name}" +
$"{Environment.NewLine}" + "=".PadLeft(50, '=');
UserClient.Net_simplify_client.ReadFromServer(CommonLibrary.CommonHeadCode.SimplifyHeadCode.异常消息, info);
}
}
[DllImport("User32.dll")]
private static extern bool ShowWindowAsync(IntPtr hWnd, int cmdShow);
......
......@@ -10,6 +10,7 @@ using Newtonsoft.Json.Linq;
using HslCommunication.Enthernet;
using HslCommunication;
using CommonLibrary;
using ClientsLibrary;
namespace 软件系统客户端模版.UIControls
{
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HslCommunication.Enthernet;
using HslCommunication.BasicFramework;
using CommonLibrary;
namespace 软件系统客户端模版
{
//====================================================================================================
// 模版说明:
//====================================================================================================
public class UserClient
{
public static JsonSettings JsonSettings = new JsonSettings();
/// <summary>
/// 本软件的当前版本,用来验证更新的关键依据
/// </summary>
public static SystemVersion CurrentVersion { get; } = new SystemVersion("1.0.0");
/// <summary>
/// 服务器的IP地址,默认为127.0.0.1,可用于单机调试
/// </summary>
public static string ServerIp { get; } = "127.0.0.1";
/// <summary>
/// 所有版本更新信息的对象
/// </summary>
public static List<VersionInfo> HistoryVersions { get; } = new List<VersionInfo>
{
//写入所有的历史版本信息,这样就能在更新日志的界面查看到信息
new VersionInfo()
{
VersionNum=new 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 UserAccount UserAccount { get; set; } = new UserAccount();
/// <summary>
/// 服务器的时间,该时间与服务器同步,每隔10秒钟,防止客户端串改单机时间,可以作为各种时间条件判定
/// </summary>
public static DateTime DateTimeServer { get; set; } = DateTime.Now;
/// <summary>
/// 用于访问服务器数据的网络对象类,必须修改这个端口参数,否则运行失败
/// </summary>
public static Net_Simplify_Client Net_simplify_client = new Net_Simplify_Client(
new System.Net.IPEndPoint(System.Net.IPAddress.Parse(ServerIp),
CommonLibrary.CommonLibrary.Port_Second_Net))
{
KeyToken = CommonHeadCode.KeyToken,
ConnectTimeout = 5000,
};
/// <summary>
/// 用于使用udp向服务器进行发送即时可丢失数据的对象
/// </summary>
public static Net_Udp_Client Net_Udp_Client = new Net_Udp_Client(
new System.Net.IPEndPoint(System.Net.IPAddress.Parse(ServerIp),
CommonLibrary.CommonLibrary.Port_Udp_Server))
{
KeyToken = CommonHeadCode.KeyToken,
};
}
}
......@@ -32,6 +32,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="ClientsLibrary">
<HintPath>..\ClientsLibrary\bin\Debug\ClientsLibrary.dll</HintPath>
</Reference>
<Reference Include="CommonLibrary">
<HintPath>..\CommonLibrary\bin\Debug\CommonLibrary.dll</HintPath>
</Reference>
......@@ -53,18 +56,6 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="FormDownloading.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FormDownloading.Designer.cs">
<DependentUpon>FormDownloading.cs</DependentUpon>
</Compile>
<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>
......@@ -77,18 +68,6 @@
<Compile Include="FormMainWindow.Designer.cs">
<DependentUpon>FormMainWindow.cs</DependentUpon>
</Compile>
<Compile Include="FormRegisterAccount.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FormRegisterAccount.Designer.cs">
<DependentUpon>FormRegisterAccount.cs</DependentUpon>
</Compile>
<Compile Include="FormUpdateRemote.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FormUpdateRemote.Designer.cs">
<DependentUpon>FormUpdateRemote.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UIControls\OnlineChatRender.cs">
......@@ -103,25 +82,12 @@
<Compile Include="UIControls\ShareFilesRender.Designer.cs">
<DependentUpon>ShareFilesRender.cs</DependentUpon>
</Compile>
<Compile Include="UserClient.cs" />
<EmbeddedResource Include="FormDownloading.resx">
<DependentUpon>FormDownloading.cs</DependentUpon>
</EmbeddedResource>
<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="FormRegisterAccount.resx">
<DependentUpon>FormRegisterAccount.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FormUpdateRemote.resx">
<DependentUpon>FormUpdateRemote.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册