diff --git a/CommonLibrary/Common.cs b/CommonLibrary/Common.cs
index 769a442..e5a3f36 100644
--- a/CommonLibrary/Common.cs
+++ b/CommonLibrary/Common.cs
@@ -57,6 +57,10 @@ namespace CommonLibrary
/// 用于UDP传输的端口号
///
public static int Port_Udp_Server { get; } = 32566;
+ ///
+ /// 头像管理的服务器端口
+ ///
+ public static int Port_Portrait_Server { get; } = 24672;
#endregion
///
diff --git a/CommonLibrary/CommonLibrary.csproj b/CommonLibrary/CommonLibrary.csproj
index 3d9b6df..6cdf5f2 100644
--- a/CommonLibrary/CommonLibrary.csproj
+++ b/CommonLibrary/CommonLibrary.csproj
@@ -90,6 +90,7 @@
+
diff --git a/CommonLibrary/HeadCode.cs b/CommonLibrary/HeadCode.cs
index 7abd0d1..7102a8d 100644
--- a/CommonLibrary/HeadCode.cs
+++ b/CommonLibrary/HeadCode.cs
@@ -55,6 +55,10 @@ namespace CommonLibrary
public static int 群发消息 { get; } = 10012;
public static int 异常消息 { get; } = 10013;
public static int 性能计数 { get; } = 10014;
+ public static int 请求小头 { get; } = 10015;
+ public static int 下载小头 { get; } = 10016;
+ public static int 请求大头 { get; } = 10017;
+ public static int 下载大头 { get; } = 10018;
diff --git a/CommonLibrary/PortraitSupport/PortraitSupport.cs b/CommonLibrary/PortraitSupport/PortraitSupport.cs
new file mode 100644
index 0000000..119eea9
--- /dev/null
+++ b/CommonLibrary/PortraitSupport/PortraitSupport.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.IO;
+
+namespace CommonLibrary
+{
+ public class PortraitSupport
+ {
+ ///
+ /// 小尺寸头像
+ ///
+ public const string SmallPortraitHead = "Size_32_";
+ ///
+ /// 大尺寸头像
+ ///
+ public const string LargePortraitHead = "Size_300_";
+
+
+ public static string GetSmallPortraitFileName(string dirPath)
+ {
+ string[] files = Directory.GetFiles(dirPath);
+ foreach(var m in files)
+ {
+ if(m.Contains(SmallPortraitHead))
+ {
+ return m;
+ }
+ }
+ return string.Empty;
+ }
+ public static string GetLargePortraitFileName(string dirPath)
+ {
+ string[] files = Directory.GetFiles(dirPath);
+ foreach (var m in files)
+ {
+ if (m.Contains(LargePortraitHead))
+ {
+ return m;
+ }
+ }
+ return string.Empty;
+ }
+ }
+}
diff --git a/软件系统客户端模版/FormMainWindow.Designer.cs b/软件系统客户端模版/FormMainWindow.Designer.cs
index 9587ab3..815f74d 100644
--- a/软件系统客户端模版/FormMainWindow.Designer.cs
+++ b/软件系统客户端模版/FormMainWindow.Designer.cs
@@ -37,6 +37,22 @@
this.toolStripStatusLabel4 = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabel_time = 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.关于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.panel_right = new System.Windows.Forms.Panel();
this.label_file_count = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
@@ -61,26 +77,13 @@
this.panel_left = new System.Windows.Forms.Panel();
this.label10 = new System.Windows.Forms.Label();
this.panel_main = new System.Windows.Forms.Panel();
- this.管理员ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.更改公告ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.日志查看ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.账户管理ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.远程更新ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.注册账号ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.消息发送ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.设置ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.修改密码ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.留言板ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.关于ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.关于本软件ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- 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.pictureBox1 = new System.Windows.Forms.PictureBox();
this.statusStrip1.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.panel_right.SuspendLayout();
this.panel_left.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// statusStrip1
@@ -158,6 +161,135 @@
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,
+ this.消息发送ToolStripMenuItem,
+ this.开发中心ToolStripMenuItem});
+ this.管理员ToolStripMenuItem.Image = global::软件系统客户端模版.Properties.Resources.Team_32xLG;
+ this.管理员ToolStripMenuItem.Name = "管理员ToolStripMenuItem";
+ this.管理员ToolStripMenuItem.Size = new System.Drawing.Size(100, 31);
+ this.管理员ToolStripMenuItem.Text = "管理员";
+ //
+ // 更改公告ToolStripMenuItem
+ //
+ this.更改公告ToolStripMenuItem.Name = "更改公告ToolStripMenuItem";
+ this.更改公告ToolStripMenuItem.Size = new System.Drawing.Size(164, 32);
+ this.更改公告ToolStripMenuItem.Text = "更改公告";
+ this.更改公告ToolStripMenuItem.Click += new System.EventHandler(this.更改公告ToolStripMenuItem_Click);
+ //
+ // 日志查看ToolStripMenuItem
+ //
+ this.日志查看ToolStripMenuItem.Name = "日志查看ToolStripMenuItem";
+ this.日志查看ToolStripMenuItem.Size = new System.Drawing.Size(164, 32);
+ this.日志查看ToolStripMenuItem.Text = "日志查看";
+ this.日志查看ToolStripMenuItem.Click += new System.EventHandler(this.日志查看ToolStripMenuItem_Click);
+ //
+ // 账户管理ToolStripMenuItem
+ //
+ this.账户管理ToolStripMenuItem.Name = "账户管理ToolStripMenuItem";
+ this.账户管理ToolStripMenuItem.Size = new System.Drawing.Size(164, 32);
+ this.账户管理ToolStripMenuItem.Text = "账户管理";
+ this.账户管理ToolStripMenuItem.Click += new System.EventHandler(this.账户管理ToolStripMenuItem_Click);
+ //
+ // 远程更新ToolStripMenuItem
+ //
+ this.远程更新ToolStripMenuItem.Name = "远程更新ToolStripMenuItem";
+ this.远程更新ToolStripMenuItem.Size = new System.Drawing.Size(164, 32);
+ this.远程更新ToolStripMenuItem.Text = "远程更新";
+ this.远程更新ToolStripMenuItem.Click += new System.EventHandler(this.远程更新ToolStripMenuItem_Click);
+ //
+ // 注册账号ToolStripMenuItem
+ //
+ this.注册账号ToolStripMenuItem.Name = "注册账号ToolStripMenuItem";
+ this.注册账号ToolStripMenuItem.Size = new System.Drawing.Size(164, 32);
+ this.注册账号ToolStripMenuItem.Text = "注册账号";
+ this.注册账号ToolStripMenuItem.Click += new System.EventHandler(this.注册账号ToolStripMenuItem_Click);
+ //
+ // 消息发送ToolStripMenuItem
+ //
+ this.消息发送ToolStripMenuItem.Name = "消息发送ToolStripMenuItem";
+ this.消息发送ToolStripMenuItem.Size = new System.Drawing.Size(164, 32);
+ this.消息发送ToolStripMenuItem.Text = "消息发送";
+ this.消息发送ToolStripMenuItem.Click += new System.EventHandler(this.消息发送ToolStripMenuItem_Click);
+ //
+ // 开发中心ToolStripMenuItem
+ //
+ this.开发中心ToolStripMenuItem.Name = "开发中心ToolStripMenuItem";
+ this.开发中心ToolStripMenuItem.Size = new System.Drawing.Size(164, 32);
+ this.开发中心ToolStripMenuItem.Text = "开发中心";
+ this.开发中心ToolStripMenuItem.Click += new System.EventHandler(this.开发中心ToolStripMenuItem_Click);
+ //
+ // 设置ToolStripMenuItem
+ //
+ this.设置ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.修改密码ToolStripMenuItem,
+ this.留言板ToolStripMenuItem,
+ this.更换头像ToolStripMenuItem});
+ this.设置ToolStripMenuItem.Image = global::软件系统客户端模版.Properties.Resources.PickAxe_32xLG;
+ this.设置ToolStripMenuItem.Name = "设置ToolStripMenuItem";
+ this.设置ToolStripMenuItem.Size = new System.Drawing.Size(80, 31);
+ this.设置ToolStripMenuItem.Text = "设置";
+ //
+ // 修改密码ToolStripMenuItem
+ //
+ this.修改密码ToolStripMenuItem.Name = "修改密码ToolStripMenuItem";
+ this.修改密码ToolStripMenuItem.Size = new System.Drawing.Size(164, 32);
+ this.修改密码ToolStripMenuItem.Text = "修改密码";
+ this.修改密码ToolStripMenuItem.Click += new System.EventHandler(this.修改密码ToolStripMenuItem_Click);
+ //
+ // 留言板ToolStripMenuItem
+ //
+ this.留言板ToolStripMenuItem.Name = "留言板ToolStripMenuItem";
+ this.留言板ToolStripMenuItem.Size = new System.Drawing.Size(164, 32);
+ this.留言板ToolStripMenuItem.Text = "留言板";
+ this.留言板ToolStripMenuItem.Click += new System.EventHandler(this.留言板ToolStripMenuItem_Click);
+ //
+ // 关于ToolStripMenuItem
+ //
+ this.关于ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.关于本软件ToolStripMenuItem,
+ this.更新日志ToolStripMenuItem,
+ this.版本号说明ToolStripMenuItem,
+ this.意见反馈ToolStripMenuItem});
+ this.关于ToolStripMenuItem.Image = global::软件系统客户端模版.Properties.Resources.ASCube_32xLG;
+ this.关于ToolStripMenuItem.Name = "关于ToolStripMenuItem";
+ this.关于ToolStripMenuItem.Size = new System.Drawing.Size(80, 31);
+ this.关于ToolStripMenuItem.Text = "关于";
+ //
+ // 关于本软件ToolStripMenuItem
+ //
+ this.关于本软件ToolStripMenuItem.Name = "关于本软件ToolStripMenuItem";
+ this.关于本软件ToolStripMenuItem.Size = new System.Drawing.Size(184, 32);
+ 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, 32);
+ 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, 32);
+ 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, 32);
+ this.意见反馈ToolStripMenuItem.Text = "意见反馈";
+ this.意见反馈ToolStripMenuItem.Click += new System.EventHandler(this.意见反馈ToolStripMenuItem_Click);
+ //
// panel_right
//
this.panel_right.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
@@ -376,7 +508,7 @@
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.Size = new System.Drawing.Size(593, 33);
this.label_Announcement.TabIndex = 3;
this.label_Announcement.Text = "[公告]";
this.label_Announcement.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@@ -407,139 +539,28 @@
this.panel_main.Size = new System.Drawing.Size(557, 419);
this.panel_main.TabIndex = 5;
//
- // 管理员ToolStripMenuItem
+ // 更换头像ToolStripMenuItem
//
- this.管理员ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.更改公告ToolStripMenuItem,
- this.日志查看ToolStripMenuItem,
- this.账户管理ToolStripMenuItem,
- this.远程更新ToolStripMenuItem,
- this.注册账号ToolStripMenuItem,
- this.消息发送ToolStripMenuItem,
- this.开发中心ToolStripMenuItem});
- this.管理员ToolStripMenuItem.Image = global::软件系统客户端模版.Properties.Resources.Team_32xLG;
- this.管理员ToolStripMenuItem.Name = "管理员ToolStripMenuItem";
- this.管理员ToolStripMenuItem.Size = new System.Drawing.Size(100, 31);
- this.管理员ToolStripMenuItem.Text = "管理员";
+ this.更换头像ToolStripMenuItem.Name = "更换头像ToolStripMenuItem";
+ this.更换头像ToolStripMenuItem.Size = new System.Drawing.Size(164, 32);
+ this.更换头像ToolStripMenuItem.Text = "更换头像";
+ this.更换头像ToolStripMenuItem.Click += new System.EventHandler(this.更换头像ToolStripMenuItem_Click);
//
- // 更改公告ToolStripMenuItem
+ // pictureBox1
//
- this.更改公告ToolStripMenuItem.Name = "更改公告ToolStripMenuItem";
- this.更改公告ToolStripMenuItem.Size = new System.Drawing.Size(164, 32);
- this.更改公告ToolStripMenuItem.Text = "更改公告";
- this.更改公告ToolStripMenuItem.Click += new System.EventHandler(this.更改公告ToolStripMenuItem_Click);
- //
- // 日志查看ToolStripMenuItem
- //
- this.日志查看ToolStripMenuItem.Name = "日志查看ToolStripMenuItem";
- this.日志查看ToolStripMenuItem.Size = new System.Drawing.Size(164, 32);
- this.日志查看ToolStripMenuItem.Text = "日志查看";
- this.日志查看ToolStripMenuItem.Click += new System.EventHandler(this.日志查看ToolStripMenuItem_Click);
- //
- // 账户管理ToolStripMenuItem
- //
- this.账户管理ToolStripMenuItem.Name = "账户管理ToolStripMenuItem";
- this.账户管理ToolStripMenuItem.Size = new System.Drawing.Size(164, 32);
- this.账户管理ToolStripMenuItem.Text = "账户管理";
- this.账户管理ToolStripMenuItem.Click += new System.EventHandler(this.账户管理ToolStripMenuItem_Click);
- //
- // 远程更新ToolStripMenuItem
- //
- this.远程更新ToolStripMenuItem.Name = "远程更新ToolStripMenuItem";
- this.远程更新ToolStripMenuItem.Size = new System.Drawing.Size(164, 32);
- this.远程更新ToolStripMenuItem.Text = "远程更新";
- this.远程更新ToolStripMenuItem.Click += new System.EventHandler(this.远程更新ToolStripMenuItem_Click);
- //
- // 注册账号ToolStripMenuItem
- //
- this.注册账号ToolStripMenuItem.Name = "注册账号ToolStripMenuItem";
- this.注册账号ToolStripMenuItem.Size = new System.Drawing.Size(164, 32);
- this.注册账号ToolStripMenuItem.Text = "注册账号";
- this.注册账号ToolStripMenuItem.Click += new System.EventHandler(this.注册账号ToolStripMenuItem_Click);
- //
- // 消息发送ToolStripMenuItem
- //
- this.消息发送ToolStripMenuItem.Name = "消息发送ToolStripMenuItem";
- this.消息发送ToolStripMenuItem.Size = new System.Drawing.Size(164, 32);
- this.消息发送ToolStripMenuItem.Text = "消息发送";
- this.消息发送ToolStripMenuItem.Click += new System.EventHandler(this.消息发送ToolStripMenuItem_Click);
- //
- // 设置ToolStripMenuItem
- //
- this.设置ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.修改密码ToolStripMenuItem,
- this.留言板ToolStripMenuItem});
- this.设置ToolStripMenuItem.Image = global::软件系统客户端模版.Properties.Resources.PickAxe_32xLG;
- this.设置ToolStripMenuItem.Name = "设置ToolStripMenuItem";
- this.设置ToolStripMenuItem.Size = new System.Drawing.Size(80, 31);
- this.设置ToolStripMenuItem.Text = "设置";
- //
- // 修改密码ToolStripMenuItem
- //
- this.修改密码ToolStripMenuItem.Name = "修改密码ToolStripMenuItem";
- this.修改密码ToolStripMenuItem.Size = new System.Drawing.Size(164, 32);
- this.修改密码ToolStripMenuItem.Text = "修改密码";
- this.修改密码ToolStripMenuItem.Click += new System.EventHandler(this.修改密码ToolStripMenuItem_Click);
- //
- // 留言板ToolStripMenuItem
- //
- this.留言板ToolStripMenuItem.Name = "留言板ToolStripMenuItem";
- this.留言板ToolStripMenuItem.Size = new System.Drawing.Size(164, 32);
- this.留言板ToolStripMenuItem.Text = "留言板";
- this.留言板ToolStripMenuItem.Click += new System.EventHandler(this.留言板ToolStripMenuItem_Click);
- //
- // 关于ToolStripMenuItem
- //
- this.关于ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.关于本软件ToolStripMenuItem,
- this.更新日志ToolStripMenuItem,
- this.版本号说明ToolStripMenuItem,
- this.意见反馈ToolStripMenuItem});
- this.关于ToolStripMenuItem.Image = global::软件系统客户端模版.Properties.Resources.ASCube_32xLG;
- this.关于ToolStripMenuItem.Name = "关于ToolStripMenuItem";
- this.关于ToolStripMenuItem.Size = new System.Drawing.Size(80, 31);
- this.关于ToolStripMenuItem.Text = "关于";
- //
- // 关于本软件ToolStripMenuItem
- //
- this.关于本软件ToolStripMenuItem.Name = "关于本软件ToolStripMenuItem";
- this.关于本软件ToolStripMenuItem.Size = new System.Drawing.Size(184, 32);
- 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, 32);
- 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, 32);
- 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, 32);
- this.意见反馈ToolStripMenuItem.Text = "意见反馈";
- this.意见反馈ToolStripMenuItem.Click += new System.EventHandler(this.意见反馈ToolStripMenuItem_Click);
- //
- // 开发中心ToolStripMenuItem
- //
- this.开发中心ToolStripMenuItem.Name = "开发中心ToolStripMenuItem";
- this.开发中心ToolStripMenuItem.Size = new System.Drawing.Size(164, 32);
- this.开发中心ToolStripMenuItem.Text = "开发中心";
- this.开发中心ToolStripMenuItem.Click += new System.EventHandler(this.开发中心ToolStripMenuItem_Click);
+ this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.pictureBox1.Location = new System.Drawing.Point(887, 1);
+ this.pictureBox1.Name = "pictureBox1";
+ this.pictureBox1.Size = new System.Drawing.Size(32, 32);
+ this.pictureBox1.TabIndex = 6;
+ this.pictureBox1.TabStop = false;
//
// 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.pictureBox1);
this.Controls.Add(this.panel_main);
this.Controls.Add(this.panel_left);
this.Controls.Add(this.label_Announcement);
@@ -561,6 +582,7 @@
this.panel_right.ResumeLayout(false);
this.panel_right.PerformLayout();
this.panel_left.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -617,6 +639,8 @@
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.PictureBox pictureBox1;
}
}
diff --git a/软件系统客户端模版/FormMainWindow.cs b/软件系统客户端模版/FormMainWindow.cs
index d9075bb..ef99d27 100644
--- a/软件系统客户端模版/FormMainWindow.cs
+++ b/软件系统客户端模版/FormMainWindow.cs
@@ -116,6 +116,8 @@ namespace 软件系统客户端模版
}
//启动定时器
TimeTickInitilization();
+ //显示头像
+ DownloadUserPortraint();
}
private void FormMainWindow_FormClosing(object sender, FormClosingEventArgs e)
{
@@ -294,6 +296,12 @@ namespace 软件系统客户端模版
}
}
+
+ private void 更换头像ToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ ChangePortrait();
+ }
+
#endregion
#region 异步网络块
@@ -609,8 +617,104 @@ namespace 软件系统客户端模版
+
#endregion
-
+ #region 头像图片上传下载块
+
+ private string GetPortraitPath()
+ {
+ string path = Application.StartupPath + @"\Portrait\" + UserClient.UserAccount.UserName;
+ if (!System.IO.Directory.Exists(path))
+ {
+ System.IO.Directory.CreateDirectory(path);
+ }
+ return path;
+ }
+
+ private void ChangePortrait()
+ {
+ using (FormPortraitSelect fps = new FormPortraitSelect())
+ {
+ if (fps.ShowDialog() == DialogResult.OK)
+ {
+ string path = GetPortraitPath();
+
+ string guid = Guid.NewGuid().ToString("N");
+ string path300 = path + @"\" + PortraitSupport.LargePortraitHead + guid + ".png";
+ string path32 = path + @"\" + PortraitSupport.SmallPortraitHead + guid + ".png";
+
+ Bitmap bitmap300 = (Bitmap)fps.GetSpecifiedSizeImage(300);
+ bitmap300.Save(path300);
+ Bitmap bitmap32 = (Bitmap)fps.GetSpecifiedSizeImage(32);
+ bitmap32.Save(path32);
+ //传送服务器
+ bitmap300.Dispose();
+ bitmap32.Dispose();
+
+ using (FormFileOperate ffo = new FormFileOperate(CommonHeadCode.KeyToken, new System.Net.IPEndPoint(
+ System.Net.IPAddress.Parse(UserClient.ServerIp), CommonLibrary.CommonLibrary.Port_Portrait_Server),
+ new string[]
+ {
+ path300,
+ path32
+ }, "Files", "Portrait", UserClient.UserAccount.UserName))
+ {
+ ffo.ShowDialog();
+ }
+ DownloadUserPortraint();
+ }
+ }
+ }
+
+
+
+ private void DownloadUserPortraint()
+ {
+ string path = GetPortraitPath();
+ //获取服务器文件名称
+ OperateResultString result = UserClient.Net_simplify_client.ReadFromServer(CommonHeadCode.SimplifyHeadCode.请求小头, UserClient.UserAccount.UserName);
+ if(result.IsSuccess)
+ {
+ if(result.Content[0]=='Y')
+ {
+ //服务器存在头像
+ string fileName = PortraitSupport.GetSmallPortraitFileName(path);
+ string serverName = result.Content.Substring(1);
+ if (!string.IsNullOrEmpty(fileName))
+ {
+ if (PortraitSupport.GetSmallPortraitFileName(path).Contains(serverName))
+ {
+ //加载本地头像
+ pictureBox1.LoadAsync(fileName);
+ }
+ else
+ {
+ //头像已经换了
+ P1:
+ result = UserClient.Net_simplify_client.ReadFromServer(CommonHeadCode.SimplifyHeadCode.下载小头, UserClient.UserAccount.UserName);
+ if(result.IsSuccess)
+ {
+ byte[] data = Convert.FromBase64String(result.Content);
+ System.IO.File.WriteAllBytes(path + @"\" + serverName, data);
+ pictureBox1.LoadAsync(path + @"\" + serverName);
+ }
+ }
+ }
+ else
+ {
+ //客户端不存在头像
+ goto P1;
+ }
+ }
+ else
+ {
+ //服务器不存在头像,本次加载结束
+ }
+ }
+ }
+
+
+ #endregion
}
}
diff --git a/软件系统服务端模版/FormServerWindow.cs b/软件系统服务端模版/FormServerWindow.cs
index fdfa898..f3a649b 100644
--- a/软件系统服务端模版/FormServerWindow.cs
+++ b/软件系统服务端模版/FormServerWindow.cs
@@ -220,6 +220,7 @@ namespace 软件系统服务端模版
Net_SoftUpdate_Server_Initialization();//软件更新引擎初始化
Net_File_Update_Initialization();//软件异地更新引擎初始化
Simple_File_Initiaization();//共享文件引擎初始化
+ Net_File_Portrait_Initialization();//头像文件管理服务
Net_Udp_Server_Initialization();//UDP引擎服务初始化
启动服务器ToolStripMenuItem.Text = "已启动";
启动服务器ToolStripMenuItem.BackColor = Color.LimeGreen;
@@ -1209,6 +1210,31 @@ namespace 软件系统服务端模版
#endregion
+ #region 头像管理块
+ ///
+ /// 用于用户账户的头像文件保存
+ ///
+ private Net_File_Server net_file_Portrait = new Net_File_Server();
+ ///
+ /// 用户头像管理服务的引擎
+ ///
+ private void Net_File_Portrait_Initialization()
+ {
+ try
+ {
+ net_file_Portrait.FilesPath = Application.StartupPath;
+ net_file_Portrait.LogHelper.LogSaveFileName = LogSavePath + @"\Portrait_file_log.txt";
+ net_file_Portrait.KeyToken = CommonHeadCode.KeyToken;
+ net_file_Portrait.ServerStart(CommonLibrary.CommonLibrary.Port_Portrait_Server);
+ }
+ catch (Exception ex)
+ {
+ SoftBasic.ShowExceptionMessage(ex);
+ }
+ }
+
+
+ #endregion
}
}