更新两种客户端的在线显示模型,v1.6.8

This commit is contained in:
dathlin
2017-10-09 22:18:51 +08:00
parent 8252e4d356
commit 1c4181363e
23 changed files with 966 additions and 40 deletions

View File

@@ -0,0 +1,77 @@
namespace ClientsLibrary.BasicSupport
{
partial class NetClientItem
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.label1 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pictureBox1.Location = new System.Drawing.Point(4, 1);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(34, 34);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(45, 4);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(41, 12);
this.label1.TabIndex = 1;
this.label1.Text = "label1";
//
// NetClientItem
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.label1);
this.Controls.Add(this.pictureBox1);
this.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Name = "NetClientItem";
this.Size = new System.Drawing.Size(185, 36);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.NetClientItem_Paint);
this.MouseEnter += new System.EventHandler(this.NetClientItem_MouseEnter);
this.MouseLeave += new System.EventHandler(this.NetClientItem_MouseLeave);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label label1;
}
}

View File

@@ -0,0 +1,102 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CommonLibrary;
using System.Threading;
namespace ClientsLibrary.BasicSupport
{
public partial class NetClientItem : UserControl
{
public NetClientItem()
{
InitializeComponent();
}
private void NetClientItem_Paint(object sender, PaintEventArgs e)
{
if (m_NetAccount != null)
{
// 绘制角色名称
if (m_NetAccount.Roles?.Length > 0)
{
int m_x = 45;
int m_y = 20;
for (int i = 0; i < m_NetAccount.Roles.Length; i++)
{
SizeF m_size = e.Graphics.MeasureString(m_NetAccount.Roles[i], Font);
e.Graphics.FillRectangle(Brushes.LightBlue, m_x, m_y - 2, m_size.Width, m_size.Height);
e.Graphics.DrawString(m_NetAccount.Roles[i], Font, Brushes.Blue, new Point(m_x, m_y));
m_x += (int)m_size.Width + 3;
}
}
}
}
public void SetNetAccount(NetAccount account)
{
m_NetAccount = account;
// 加载头像,显示信息
label1.Text = (string.IsNullOrEmpty(account.Alias) ? account.UserName : account.Alias) + $" ({account.Factory})";
ThreadPool.QueueUserWorkItem(ThreadPoolLoadPortrait, null);
}
private void ThreadPoolLoadPortrait(object obj)
{
// 向服务器请求小头像
if(m_NetAccount!=null)
{
try
{
System.IO.MemoryStream ms = new System.IO.MemoryStream();
HslCommunication.OperateResult result = UserClient.Net_File_Client.DownloadFile(
PortraitSupport.SmallPortrait,
"Files",
"Portrait",
m_NetAccount.UserName,
null,
ms
);
if (result.IsSuccess)
{
Bitmap bitmap = new Bitmap(ms);
pictureBox1.Image = bitmap;
}
else
{
MessageBox.Show(result.Message);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
private NetAccount m_NetAccount;
private void NetClientItem_MouseEnter(object sender, EventArgs e)
{
BackColor = Color.AliceBlue;
}
private void NetClientItem_MouseLeave(object sender, EventArgs e)
{
BackColor = SystemColors.Control;
}
}
}

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,81 @@
namespace ClientsLibrary.BasicSupport
{
partial class NetClientOnline
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
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(3, 4);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(92, 17);
this.label1.TabIndex = 0;
this.label1.Text = "在线客户端数:";
//
// label2
//
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
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(101, 4);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(113, 18);
this.label2.TabIndex = 1;
this.label2.Text = "0";
this.label2.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// NetClientOnline
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoScroll = true;
this.Controls.Add(this.label2);
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.Name = "NetClientOnline";
this.Size = new System.Drawing.Size(217, 465);
this.Load += new System.EventHandler(this.NetClientOnline_Load);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.NetClientOnline_Paint);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
}
}

View File

@@ -0,0 +1,73 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CommonLibrary;
namespace ClientsLibrary.BasicSupport
{
public partial class NetClientOnline : UserControl
{
public NetClientOnline()
{
InitializeComponent();
}
private void NetClientOnline_Load(object sender, EventArgs e)
{
}
private void ClearControls()
{
while (MyControls.Count > 0)
{
MyControls.Pop().Dispose();
}
}
public void SetOnlineRender(NetAccount[] accounts)
{
SuspendLayout();
//清楚缓存
ClearControls();
if (accounts != null)
{
label2.Text = accounts.Length.ToString();
if (accounts.Length > 0 && Width > 20)
{
int location_y = 25 - VerticalScroll.Value;
//添加子控件
foreach (var m in accounts)
{
NetClientItem item = new NetClientItem();
Controls.Add(item);
// 添加显示
item.SetNetAccount(m);
item.Location = new Point(2, location_y); // 控件的位置
int width = VerticalScroll.Visible ? Width - 4 - SystemInformation.VerticalScrollBarWidth : Width - 4; // 控件的宽度
item.Size = new Size(width, item.Size.Height); // 控件的大小
item.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; // 控件随窗口变化的样式
location_y += item.Height + 4; // 位置偏移
MyControls.Push(item); // 控件压入堆栈
}
}
}
ResumeLayout();
}
private Stack<IDisposable> MyControls = new Stack<IDisposable>();
private void NetClientOnline_Paint(object sender, PaintEventArgs e)
{
}
}
}

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

@@ -86,6 +86,18 @@
<Compile Include="BasicSupport\FormShowMachineId.Designer.cs">
<DependentUpon>FormShowMachineId.cs</DependentUpon>
</Compile>
<Compile Include="BasicSupport\NetClientItem.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="BasicSupport\NetClientItem.Designer.cs">
<DependentUpon>NetClientItem.cs</DependentUpon>
</Compile>
<Compile Include="BasicSupport\NetClientOnline.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="BasicSupport\NetClientOnline.Designer.cs">
<DependentUpon>NetClientOnline.cs</DependentUpon>
</Compile>
<Compile Include="Configuration\ClientConfiguration.cs">
<SubType>UserControl</SubType>
</Compile>
@@ -187,6 +199,12 @@
<EmbeddedResource Include="BasicSupport\FormShowMachineId.resx">
<DependentUpon>FormShowMachineId.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BasicSupport\NetClientItem.resx">
<DependentUpon>NetClientItem.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BasicSupport\NetClientOnline.resx">
<DependentUpon>NetClientOnline.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Configuration\ClientConfiguration.resx">
<DependentUpon>ClientConfiguration.cs</DependentUpon>
</EmbeddedResource>

View File

@@ -43,7 +43,7 @@ namespace ClientsLibrary
/// 服务器的IP地址默认为127.0.0.1,可用于单机调试,
/// 云服务器端117.48.203.204,注意,云端为最新版,客户端版本比较旧会调试失败
/// </summary>
public static string ServerIp { get; } = "117.48.203.204";//用于测试的云服务器地址
public static string ServerIp { get; } = "117.48.203.204"; // 用于测试的云服务器地址
/// <summary>
@@ -63,7 +63,7 @@ namespace ClientsLibrary
new VersionInfo()
{
VersionNum = new SystemVersion("1.0.0"),
ReleaseDate = new DateTime(2017, 10, 1),//该版本发布的日期
ReleaseDate = new DateTime(2017, 10, 1), // 该版本发布的日期
UpdateDetails = new StringBuilder(
"1.本系统第一版本正式发布使用。"+Environment.NewLine+
"2.提供了多客户端用时在线的功能。"+Environment.NewLine+