重构代码,移动了些文件,整理了一些代码的位置

This commit is contained in:
dathlin
2017-09-15 22:41:53 +08:00
parent cafc3e065d
commit 6e7da51f2f
15 changed files with 122 additions and 47 deletions

View File

@@ -0,0 +1,126 @@
using HslCommunication.Controls;
namespace ClientsLibrary
{
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;
}
}

View File

@@ -0,0 +1,67 @@
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 ClientsLibrary
{
//=====================================================================================
//
// 用途: 本窗口用于实现对本系统的客户端进行全面的远程更新的操作。
// 第一步: 先将新版本的所有客户端传送到服务器端进行覆盖。
// 第二步: 再将版本号传送到服务器进行更新,这样所有的客户端登录后就会自动更新新的版本了
//
//=====================================================================================
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,UserClient.LogNet, 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();
}
}
}

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>