整理代码,更改头像部分移动到我的信息中,服务器适配

This commit is contained in:
dathlin
2017-09-18 17:35:59 +08:00
parent 78c04eadfb
commit 57f5eb83a6
21 changed files with 1050 additions and 486 deletions

View File

@@ -1,56 +0,0 @@
using CommonLibrary;
using HslCommunication.Enthernet;
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;
namespace ClientsLibrary.AccountSupport
{
public partial class AccountDetails : Form
{
public AccountDetails(AdvancedFileClient fileClient, UserPortrait userPortrait)
{
InitializeComponent();
FileClient = fileClient;
UserPortrait = userPortrait;
}
private void AccountDetails_Shown(object sender, EventArgs e)
{
// 加载各种数据
textBox_Factory.Text = UserClient.UserAccount.Factory;
textBox_GradeDescription.Text = AccountGrade.GetDescription(UserClient.UserAccount.Grade);
textBox_LastLoginIpAddress.Text = UserClient.UserAccount.LastLoginIpAddress;
textBox_LastLoginTime.Text = UserClient.UserAccount.LastLoginTime.ToString();
textBox_LastLoginWay.Text = UserClient.UserAccount.LastLoginWay;
textBox_LoginEnable.Text = UserClient.UserAccount.LoginEnable ? "允许" : "禁止";
textBox_LoginFailedCount.Text = UserClient.UserAccount.LoginFailedCount.ToString();
textBox_LoginFrequency.Text = UserClient.UserAccount.LoginFrequency.ToString();
textBox_NameAlias.Text = UserClient.UserAccount.NameAlias;
textBox_RegisterTime.Text = UserClient.UserAccount.RegisterTime.ToString();
textBox_UserName.Text = UserClient.UserAccount.UserName;
// 加载头像
}
private void AccountDetails_Load(object sender, EventArgs e)
{
Text = "账户详细信息";
}
public AdvancedFileClient FileClient { get; }
public UserPortrait UserPortrait { get; }
}
}

View File

@@ -1,6 +1,6 @@
namespace ClientsLibrary.AccountSupport
namespace ClientsLibrary
{
partial class AccountDetails
partial class FormAccountDetails
{
/// <summary>
/// Required designer variable.
@@ -28,39 +28,40 @@
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.TreeNode treeNode4 = new System.Windows.Forms.TreeNode("我的文件(下载中)");
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label1 = new System.Windows.Forms.Label();
this.textBox_UserName = new System.Windows.Forms.TextBox();
this.textBox_NameAlias = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.textBox_Factory = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.textBox_GradeDescription = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.textBox_RegisterTime = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.textBox_LoginEnable = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.textBox_LoginFrequency = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.textBox_LastLoginTime = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.textBox_LastLoginIpAddress = new System.Windows.Forms.TextBox();
this.label9 = new System.Windows.Forms.Label();
this.textBox_LastLoginWay = new System.Windows.Forms.TextBox();
this.label10 = new System.Windows.Forms.Label();
this.pictureBox_UserPortrait = new System.Windows.Forms.PictureBox();
this.label12 = new System.Windows.Forms.Label();
this.textBox_LoginFailedCount = new System.Windows.Forms.TextBox();
this.label11 = new System.Windows.Forms.Label();
this.textBox_LastLoginWay = new System.Windows.Forms.TextBox();
this.label10 = new System.Windows.Forms.Label();
this.textBox_LastLoginIpAddress = new System.Windows.Forms.TextBox();
this.label9 = new System.Windows.Forms.Label();
this.textBox_LastLoginTime = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.textBox_LoginFrequency = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.textBox_LoginEnable = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.textBox_RegisterTime = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.textBox_GradeDescription = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.textBox_Factory = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.textBox_NameAlias = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.textBox_UserName = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.treeView1 = new System.Windows.Forms.TreeView();
this.userButton_upload = new HslCommunication.Controls.UserButton();
this.userButton1 = new HslCommunication.Controls.UserButton();
this.userButton2 = new HslCommunication.Controls.UserButton();
this.label12 = new System.Windows.Forms.Label();
this.pictureBox_UserPortrait = new System.Windows.Forms.PictureBox();
this.userButton1 = new HslCommunication.Controls.UserButton();
this.userButton_upload = new HslCommunication.Controls.UserButton();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox_UserPortrait)).BeginInit();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
@@ -98,167 +99,44 @@
this.groupBox1.TabStop = false;
this.groupBox1.Text = "账户信息";
//
// label1
// pictureBox_UserPortrait
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(20, 167);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(56, 17);
this.label1.TabIndex = 0;
this.label1.Text = "用户名:";
this.pictureBox_UserPortrait.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pictureBox_UserPortrait.Cursor = System.Windows.Forms.Cursors.Hand;
this.pictureBox_UserPortrait.Location = new System.Drawing.Point(112, 22);
this.pictureBox_UserPortrait.Name = "pictureBox_UserPortrait";
this.pictureBox_UserPortrait.Size = new System.Drawing.Size(136, 136);
this.pictureBox_UserPortrait.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBox_UserPortrait.TabIndex = 23;
this.pictureBox_UserPortrait.TabStop = false;
this.pictureBox_UserPortrait.Click += new System.EventHandler(this.pictureBox_UserPortrait_Click);
//
// textBox_UserName
// label12
//
this.textBox_UserName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox_UserName.Location = new System.Drawing.Point(112, 164);
this.textBox_UserName.Name = "textBox_UserName";
this.textBox_UserName.ReadOnly = true;
this.textBox_UserName.Size = new System.Drawing.Size(177, 23);
this.textBox_UserName.TabIndex = 1;
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(20, 24);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(44, 17);
this.label12.TabIndex = 22;
this.label12.Text = "头像:";
//
// textBox_NameAlias
// textBox_LoginFailedCount
//
this.textBox_NameAlias.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox_NameAlias.Location = new System.Drawing.Point(112, 194);
this.textBox_NameAlias.Name = "textBox_NameAlias";
this.textBox_NameAlias.ReadOnly = true;
this.textBox_NameAlias.Size = new System.Drawing.Size(177, 23);
this.textBox_NameAlias.TabIndex = 3;
this.textBox_LoginFailedCount.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox_LoginFailedCount.Location = new System.Drawing.Point(112, 459);
this.textBox_LoginFailedCount.Name = "textBox_LoginFailedCount";
this.textBox_LoginFailedCount.ReadOnly = true;
this.textBox_LoginFailedCount.Size = new System.Drawing.Size(177, 23);
this.textBox_LoginFailedCount.TabIndex = 21;
//
// label2
// label11
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(20, 197);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(44, 17);
this.label2.TabIndex = 2;
this.label2.Text = "别名";
//
// textBox_Factory
//
this.textBox_Factory.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox_Factory.Location = new System.Drawing.Point(112, 223);
this.textBox_Factory.Name = "textBox_Factory";
this.textBox_Factory.ReadOnly = true;
this.textBox_Factory.Size = new System.Drawing.Size(177, 23);
this.textBox_Factory.TabIndex = 5;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(20, 226);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(44, 17);
this.label3.TabIndex = 4;
this.label3.Text = "工厂:";
//
// textBox_GradeDescription
//
this.textBox_GradeDescription.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox_GradeDescription.Location = new System.Drawing.Point(112, 251);
this.textBox_GradeDescription.Name = "textBox_GradeDescription";
this.textBox_GradeDescription.ReadOnly = true;
this.textBox_GradeDescription.Size = new System.Drawing.Size(177, 23);
this.textBox_GradeDescription.TabIndex = 7;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(20, 254);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(44, 17);
this.label4.TabIndex = 6;
this.label4.Text = "权限:";
//
// textBox_RegisterTime
//
this.textBox_RegisterTime.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox_RegisterTime.Location = new System.Drawing.Point(112, 279);
this.textBox_RegisterTime.Name = "textBox_RegisterTime";
this.textBox_RegisterTime.ReadOnly = true;
this.textBox_RegisterTime.Size = new System.Drawing.Size(177, 23);
this.textBox_RegisterTime.TabIndex = 9;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(20, 282);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(68, 17);
this.label5.TabIndex = 8;
this.label5.Text = "注册时间:";
//
// textBox_LoginEnable
//
this.textBox_LoginEnable.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox_LoginEnable.Location = new System.Drawing.Point(112, 308);
this.textBox_LoginEnable.Name = "textBox_LoginEnable";
this.textBox_LoginEnable.ReadOnly = true;
this.textBox_LoginEnable.Size = new System.Drawing.Size(177, 23);
this.textBox_LoginEnable.TabIndex = 11;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(20, 311);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(92, 17);
this.label6.TabIndex = 10;
this.label6.Text = "是否允许登录:";
//
// textBox_LoginFrequency
//
this.textBox_LoginFrequency.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox_LoginFrequency.Location = new System.Drawing.Point(112, 338);
this.textBox_LoginFrequency.Name = "textBox_LoginFrequency";
this.textBox_LoginFrequency.ReadOnly = true;
this.textBox_LoginFrequency.Size = new System.Drawing.Size(177, 23);
this.textBox_LoginFrequency.TabIndex = 13;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(20, 341);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(80, 17);
this.label7.TabIndex = 12;
this.label7.Text = "总登录次数:";
//
// textBox_LastLoginTime
//
this.textBox_LastLoginTime.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox_LastLoginTime.Location = new System.Drawing.Point(112, 368);
this.textBox_LastLoginTime.Name = "textBox_LastLoginTime";
this.textBox_LastLoginTime.ReadOnly = true;
this.textBox_LastLoginTime.Size = new System.Drawing.Size(177, 23);
this.textBox_LastLoginTime.TabIndex = 15;
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(20, 371);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(92, 17);
this.label8.TabIndex = 14;
this.label8.Text = "上次登录时间:";
//
// textBox_LastLoginIpAddress
//
this.textBox_LastLoginIpAddress.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox_LastLoginIpAddress.Location = new System.Drawing.Point(112, 398);
this.textBox_LastLoginIpAddress.Name = "textBox_LastLoginIpAddress";
this.textBox_LastLoginIpAddress.ReadOnly = true;
this.textBox_LastLoginIpAddress.Size = new System.Drawing.Size(177, 23);
this.textBox_LastLoginIpAddress.TabIndex = 17;
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(20, 401);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(92, 17);
this.label9.TabIndex = 16;
this.label9.Text = "上次登录地址:";
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(20, 462);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(92, 17);
this.label11.TabIndex = 20;
this.label11.Text = "登录失败次数";
//
// textBox_LastLoginWay
//
@@ -278,23 +156,167 @@
this.label10.TabIndex = 18;
this.label10.Text = "上次登录方式:";
//
// textBox_LoginFailedCount
// textBox_LastLoginIpAddress
//
this.textBox_LoginFailedCount.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox_LoginFailedCount.Location = new System.Drawing.Point(112, 459);
this.textBox_LoginFailedCount.Name = "textBox_LoginFailedCount";
this.textBox_LoginFailedCount.ReadOnly = true;
this.textBox_LoginFailedCount.Size = new System.Drawing.Size(177, 23);
this.textBox_LoginFailedCount.TabIndex = 21;
this.textBox_LastLoginIpAddress.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox_LastLoginIpAddress.Location = new System.Drawing.Point(112, 398);
this.textBox_LastLoginIpAddress.Name = "textBox_LastLoginIpAddress";
this.textBox_LastLoginIpAddress.ReadOnly = true;
this.textBox_LastLoginIpAddress.Size = new System.Drawing.Size(177, 23);
this.textBox_LastLoginIpAddress.TabIndex = 17;
//
// label11
// label9
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(20, 462);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(92, 17);
this.label11.TabIndex = 20;
this.label11.Text = "登录失败次数";
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(20, 401);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(92, 17);
this.label9.TabIndex = 16;
this.label9.Text = "上次登录地址";
//
// textBox_LastLoginTime
//
this.textBox_LastLoginTime.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox_LastLoginTime.Location = new System.Drawing.Point(112, 368);
this.textBox_LastLoginTime.Name = "textBox_LastLoginTime";
this.textBox_LastLoginTime.ReadOnly = true;
this.textBox_LastLoginTime.Size = new System.Drawing.Size(177, 23);
this.textBox_LastLoginTime.TabIndex = 15;
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(20, 371);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(92, 17);
this.label8.TabIndex = 14;
this.label8.Text = "上次登录时间:";
//
// textBox_LoginFrequency
//
this.textBox_LoginFrequency.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox_LoginFrequency.Location = new System.Drawing.Point(112, 338);
this.textBox_LoginFrequency.Name = "textBox_LoginFrequency";
this.textBox_LoginFrequency.ReadOnly = true;
this.textBox_LoginFrequency.Size = new System.Drawing.Size(177, 23);
this.textBox_LoginFrequency.TabIndex = 13;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(20, 341);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(80, 17);
this.label7.TabIndex = 12;
this.label7.Text = "总登录次数:";
//
// textBox_LoginEnable
//
this.textBox_LoginEnable.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox_LoginEnable.Location = new System.Drawing.Point(112, 308);
this.textBox_LoginEnable.Name = "textBox_LoginEnable";
this.textBox_LoginEnable.ReadOnly = true;
this.textBox_LoginEnable.Size = new System.Drawing.Size(177, 23);
this.textBox_LoginEnable.TabIndex = 11;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(20, 311);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(92, 17);
this.label6.TabIndex = 10;
this.label6.Text = "是否允许登录:";
//
// textBox_RegisterTime
//
this.textBox_RegisterTime.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox_RegisterTime.Location = new System.Drawing.Point(112, 279);
this.textBox_RegisterTime.Name = "textBox_RegisterTime";
this.textBox_RegisterTime.ReadOnly = true;
this.textBox_RegisterTime.Size = new System.Drawing.Size(177, 23);
this.textBox_RegisterTime.TabIndex = 9;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(20, 282);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(68, 17);
this.label5.TabIndex = 8;
this.label5.Text = "注册时间:";
//
// textBox_GradeDescription
//
this.textBox_GradeDescription.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox_GradeDescription.Location = new System.Drawing.Point(112, 251);
this.textBox_GradeDescription.Name = "textBox_GradeDescription";
this.textBox_GradeDescription.ReadOnly = true;
this.textBox_GradeDescription.Size = new System.Drawing.Size(177, 23);
this.textBox_GradeDescription.TabIndex = 7;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(20, 254);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(44, 17);
this.label4.TabIndex = 6;
this.label4.Text = "权限:";
//
// textBox_Factory
//
this.textBox_Factory.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox_Factory.Location = new System.Drawing.Point(112, 223);
this.textBox_Factory.Name = "textBox_Factory";
this.textBox_Factory.ReadOnly = true;
this.textBox_Factory.Size = new System.Drawing.Size(177, 23);
this.textBox_Factory.TabIndex = 5;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(20, 226);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(44, 17);
this.label3.TabIndex = 4;
this.label3.Text = "工厂:";
//
// textBox_NameAlias
//
this.textBox_NameAlias.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox_NameAlias.Location = new System.Drawing.Point(112, 194);
this.textBox_NameAlias.Name = "textBox_NameAlias";
this.textBox_NameAlias.ReadOnly = true;
this.textBox_NameAlias.Size = new System.Drawing.Size(177, 23);
this.textBox_NameAlias.TabIndex = 3;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(20, 197);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(44, 17);
this.label2.TabIndex = 2;
this.label2.Text = "别名:";
//
// textBox_UserName
//
this.textBox_UserName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox_UserName.Location = new System.Drawing.Point(112, 164);
this.textBox_UserName.Name = "textBox_UserName";
this.textBox_UserName.ReadOnly = true;
this.textBox_UserName.Size = new System.Drawing.Size(177, 23);
this.textBox_UserName.TabIndex = 1;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(20, 167);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(56, 17);
this.label1.TabIndex = 0;
this.label1.Text = "用户名:";
//
// groupBox2
//
@@ -317,37 +339,14 @@
| System.Windows.Forms.AnchorStyles.Left)));
this.treeView1.Location = new System.Drawing.Point(10, 24);
this.treeView1.Name = "treeView1";
treeNode4.Name = "files_root";
treeNode4.Text = "我的文件(下载中)";
this.treeView1.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
treeNode4});
this.treeView1.ShowLines = false;
this.treeView1.Size = new System.Drawing.Size(353, 429);
this.treeView1.TabIndex = 0;
//
// userButton_upload
//
this.userButton_upload.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.userButton_upload.BackColor = System.Drawing.Color.Transparent;
this.userButton_upload.CustomerInformation = "";
this.userButton_upload.EnableColor = System.Drawing.Color.FromArgb(((int)(((byte)(190)))), ((int)(((byte)(190)))), ((int)(((byte)(190)))));
this.userButton_upload.Font = new System.Drawing.Font("微软雅黑", 9F);
this.userButton_upload.Location = new System.Drawing.Point(10, 460);
this.userButton_upload.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.userButton_upload.Name = "userButton_upload";
this.userButton_upload.Size = new System.Drawing.Size(65, 23);
this.userButton_upload.TabIndex = 8;
this.userButton_upload.UIText = "上传";
//
// userButton1
//
this.userButton1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.userButton1.BackColor = System.Drawing.Color.Transparent;
this.userButton1.CustomerInformation = "";
this.userButton1.EnableColor = System.Drawing.Color.FromArgb(((int)(((byte)(190)))), ((int)(((byte)(190)))), ((int)(((byte)(190)))));
this.userButton1.Font = new System.Drawing.Font("微软雅黑", 9F);
this.userButton1.Location = new System.Drawing.Point(81, 460);
this.userButton1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.userButton1.Name = "userButton1";
this.userButton1.Size = new System.Drawing.Size(65, 23);
this.userButton1.TabIndex = 9;
this.userButton1.UIText = "下载";
//
// userButton2
//
this.userButton2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
@@ -361,25 +360,37 @@
this.userButton2.Size = new System.Drawing.Size(65, 23);
this.userButton2.TabIndex = 10;
this.userButton2.UIText = "删除";
this.userButton2.Click += new System.EventHandler(this.userButton2_Click);
//
// label12
// userButton1
//
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(20, 24);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(44, 17);
this.label12.TabIndex = 22;
this.label12.Text = "头像:";
this.userButton1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.userButton1.BackColor = System.Drawing.Color.Transparent;
this.userButton1.CustomerInformation = "";
this.userButton1.EnableColor = System.Drawing.Color.FromArgb(((int)(((byte)(190)))), ((int)(((byte)(190)))), ((int)(((byte)(190)))));
this.userButton1.Font = new System.Drawing.Font("微软雅黑", 9F);
this.userButton1.Location = new System.Drawing.Point(81, 460);
this.userButton1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.userButton1.Name = "userButton1";
this.userButton1.Size = new System.Drawing.Size(65, 23);
this.userButton1.TabIndex = 9;
this.userButton1.UIText = "下载";
this.userButton1.Click += new System.EventHandler(this.userButton1_Click);
//
// pictureBox_UserPortrait
// userButton_upload
//
this.pictureBox_UserPortrait.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pictureBox_UserPortrait.Cursor = System.Windows.Forms.Cursors.Hand;
this.pictureBox_UserPortrait.Location = new System.Drawing.Point(112, 22);
this.pictureBox_UserPortrait.Name = "pictureBox_UserPortrait";
this.pictureBox_UserPortrait.Size = new System.Drawing.Size(136, 136);
this.pictureBox_UserPortrait.TabIndex = 23;
this.pictureBox_UserPortrait.TabStop = false;
this.userButton_upload.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.userButton_upload.BackColor = System.Drawing.Color.Transparent;
this.userButton_upload.CustomerInformation = "";
this.userButton_upload.EnableColor = System.Drawing.Color.FromArgb(((int)(((byte)(190)))), ((int)(((byte)(190)))), ((int)(((byte)(190)))));
this.userButton_upload.Font = new System.Drawing.Font("微软雅黑", 9F);
this.userButton_upload.Location = new System.Drawing.Point(10, 460);
this.userButton_upload.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.userButton_upload.Name = "userButton_upload";
this.userButton_upload.Size = new System.Drawing.Size(65, 23);
this.userButton_upload.TabIndex = 8;
this.userButton_upload.UIText = "上传";
this.userButton_upload.Click += new System.EventHandler(this.userButton_upload_Click);
//
// AccountDetails
//
@@ -400,8 +411,8 @@
this.Shown += new System.EventHandler(this.AccountDetails_Shown);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox_UserPortrait)).EndInit();
this.groupBox2.ResumeLayout(false);
this.ResumeLayout(false);
}

View File

@@ -0,0 +1,231 @@
using CommonLibrary;
using HslCommunication.Enthernet;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using HslCommunication;
using HslCommunication.BasicFramework;
namespace ClientsLibrary
{
public partial class FormAccountDetails : Form
{
#region Constructor
public FormAccountDetails(UserPortrait userPortrait)
{
InitializeComponent();
UserPortrait = userPortrait;
}
#endregion
#region Load Show Close
private void AccountDetails_Shown(object sender, EventArgs e)
{
// 加载各种数据
textBox_Factory.Text = UserClient.UserAccount.Factory;
textBox_GradeDescription.Text = AccountGrade.GetDescription(UserClient.UserAccount.Grade);
textBox_LastLoginIpAddress.Text = UserClient.UserAccount.LastLoginIpAddress;
textBox_LastLoginTime.Text = UserClient.UserAccount.LastLoginTime.ToString();
textBox_LastLoginWay.Text = UserClient.UserAccount.LastLoginWay;
textBox_LoginEnable.Text = UserClient.UserAccount.LoginEnable ? "允许" : "禁止";
textBox_LoginFailedCount.Text = UserClient.UserAccount.LoginFailedCount.ToString();
textBox_LoginFrequency.Text = UserClient.UserAccount.LoginFrequency.ToString();
textBox_NameAlias.Text = UserClient.UserAccount.NameAlias;
textBox_RegisterTime.Text = UserClient.UserAccount.RegisterTime.ToString();
textBox_UserName.Text = UserClient.UserAccount.UserName;
// 加载头像
ThreadPool.QueueUserWorkItem(new WaitCallback(ThreadPoolLoadPortrait), null);
// 加载文件列表
DownloadUserFileNames();
}
private void AccountDetails_Load(object sender, EventArgs e)
{
Text = "账户详细信息";
treeView1.ImageList = new ImageList();
treeView1.ImageList.Images.Add(Properties.Resources.ExtensionManager_vsix_OSReg_16x);
treeView1.ImageList.Images.Add(Properties.Resources.Flagthread_7317);
treeView1.Nodes[0].ImageIndex = 0;
treeView1.Nodes[0].SelectedImageIndex = 0;
}
#endregion
#region
public UserPortrait UserPortrait { get; }
private void LoadPortraitByFileName(string fileName)
{
if(IsHandleCreated)
{
if(InvokeRequired)
{
BeginInvoke(new Action(() =>
{
LoadPortraitByFileName(fileName);
}));
return;
}
try
{
pictureBox_UserPortrait.LoadAsync(fileName);
}
catch(Exception ex)
{
UserClient.LogNet?.WriteException("加载图片异常!", ex);
}
}
}
private void ThreadPoolLoadPortrait(object obj)
{
UserPortrait.LoadUserLargePortraint(LoadPortraitByFileName);
}
private void pictureBox_UserPortrait_Click(object sender, EventArgs e)
{
UserPortrait.ChangePortrait();
UserPortrait.LoadUserLargePortraint(LoadPortraitByFileName);
}
#endregion
#region
public void DownloadUserFileNames()
{
treeView1.Nodes[0].Text = "我的云端文件(下载中)";
treeView1.Nodes[0].Nodes.Clear();
treeView1.Refresh();
// 向服务器请求自身的文件列表
OperateResult result = UserClient.Net_File_Client.DownloadPathFileNames(
out string[] files, "Files", "Personal", UserClient.UserAccount.UserName
);
if (result.IsSuccess)
{
if (files != null)
{
foreach(var m in files)
{
TreeNode node = new TreeNode(m, 1, 1);
treeView1.Nodes[0].Nodes.Add(node);
}
treeView1.Nodes[0].Text = "我的云端文件(" + files.Length + "";
}
else
{
treeView1.Nodes[0].Text = "我的云端文件NULL";
}
}
else
{
treeView1.Nodes[0].Text = "我的云端文件(下载失败)";
}
treeView1.ExpandAll();
}
private void userButton_upload_Click(object sender, EventArgs e)
{
// 上传个人文件
using (OpenFileDialog openFileDialog = new OpenFileDialog())
{
openFileDialog.Multiselect = true;
if(openFileDialog.ShowDialog()==DialogResult.OK)
{
FormFileOperate upload = new FormFileOperate(UserClient.Net_File_Client,
openFileDialog.FileNames,
"Files",
"Personal",
UserClient.UserAccount.UserName);
upload.ShowDialog();
// 更新文件列表
DownloadUserFileNames();
}
}
}
private void userButton1_Click(object sender, EventArgs e)
{
// 下载选择文件
TreeNode treeNode = treeView1.SelectedNode;
if (treeNode.Name != "files_root")
{
// 选择文件夹
using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog())
{
folderBrowserDialog.Description = "请选择保存路径,如果有重名文件,将会覆盖!";
if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
{
FormFileOperate download = new FormFileOperate(UserClient.Net_File_Client,
new string[] { treeNode.Text },
"Files",
"Personal",
UserClient.UserAccount.UserName,
folderBrowserDialog.SelectedPath + "\\" + treeNode.Text
);
download.ShowDialog();
}
}
}
}
private void userButton2_Click(object sender, EventArgs e)
{
// 删除选中文件
TreeNode treeNode = treeView1.SelectedNode;
if (treeNode.Name != "file_root")
{
using (FormPasswordCheck passwordCheck = new FormPasswordCheck(UserClient.UserAccount.Password))
{
if (passwordCheck.ShowDialog() == DialogResult.OK)
{
OperateResult result = UserClient.Net_File_Client.DeleteFile(
treeNode.Text,
"Files",
"Personal",
UserClient.UserAccount.UserName);
if(result.IsSuccess)
{
// 更新文件列表
DownloadUserFileNames();
}
else
{
MessageBox.Show("删除失败,原因:" + result.Message);
}
}
}
}
}
#endregion
}
}

View File

@@ -2,6 +2,7 @@
using HslCommunication;
using HslCommunication.BasicFramework;
using HslCommunication.Enthernet;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Drawing;
@@ -17,6 +18,7 @@ namespace ClientsLibrary
*
* 时间2017年9月17日 16:09:05
* 用户头像类,负责更换头像,下载头像,以及初始化登录操作
* 说明:类头像类还没有代码重构好,加载部分块还有部分重复代码,也因为.Net3.5这部分的代码异步比较难处理
*
*********************************************************************************/
@@ -82,78 +84,161 @@ namespace ClientsLibrary
{
ffo.ShowDialog();
}
DownloadUserPortraint();
// 上传文件MD5码
string SmallPortraitMD5 = SoftBasic.CalculateFileMD5(path32);
string LargePortraitMD5 = SoftBasic.CalculateFileMD5(path300);
JObject json = new JObject
{
{ UserAccount.UserNameText, new JValue(UserClient.UserAccount.UserName) },
{ UserAccount.SmallPortraitText, new JValue(SmallPortraitMD5) },
{ UserAccount.LargePortraitText, new JValue(LargePortraitMD5) }
};
OperateResultString result = UserClient.Net_simplify_client.ReadFromServer(
CommonHeadCode.SimplifyHeadCode.MD5,
json.ToString());
if(result.IsSuccess)
{
if (result.Content.Substring(0, 2) == "成功")
{
UserClient.UserAccount.SmallPortraitMD5 = SmallPortraitMD5;
UserClient.UserAccount.LargePortraitMD5 = LargePortraitMD5;
// 成功上传MD5码
LoadUserSmallPortraint();
}
else
{
MessageBox.Show("上传头像失败!原因:" + result.Content);
}
}
else
{
MessageBox.Show("上传头像失败!原因:" + result.Message);
}
}
}
}
#endregion
#region Load Portraint
/// <summary>
/// 加载小尺寸的头像操作,可以放到主线程
/// </summary>
public void LoadUserSmallPortraint()
{
// 先获取服务器端的MD5码
string fileMd5 = UserClient.UserAccount.SmallPortraitMD5;
if(string.IsNullOrEmpty(fileMd5))
{
// 服务器端没有文件,加载结束
return;
}
// 获取本地MD5
string fileName = FileSavePath + @"\" + PortraitSupport.SmallPortrait;
if (System.IO.File.Exists(fileName))
{
// 本地存在文件
string currentMd5 = SoftBasic.CalculateFileMD5(fileName);
// 对比验证
if (fileName == currentMd5)
{
// 加载本地文件
LoadPic?.Invoke(fileName);
return;
}
}
// 本地不存在文件或校验失败,需要重新下载
OperateResult result = UserClient.Net_File_Client.DownloadFile(PortraitSupport.SmallPortrait,
"Files",
"Portrait",
UserClient.UserAccount.UserName,
null,
fileName);
if(result.IsSuccess)
{
// 下载成功
LoadPic?.Invoke(fileName);
}
else
{
MessageBox.Show("头像从服务器下载失败,错误原因:" + result.Message);
}
}
/// <summary>
/// 加载大尺寸的头像方法,需要放到线程池中操作
/// </summary>
/// <param name="largeLoadAction"></param>
public void LoadUserLargePortraint(Action<string> largeLoadAction)
{
// 先获取服务器端的MD5码
string fileMd5 = UserClient.UserAccount.LargePortraitMD5;
if (string.IsNullOrEmpty(fileMd5))
{
// 服务器端没有文件,加载结束
return;
}
// 获取本地MD5
string fileName = FileSavePath + @"\" + PortraitSupport.LargePortrait;
if (System.IO.File.Exists(fileName))
{
// 本地存在文件,先进行加载,如果运算不一致,再重新加载
largeLoadAction?.Invoke(fileName);
string currentMd5 = null;
try
{
currentMd5 = SoftBasic.CalculateFileMD5(fileName);
}
catch(Exception ex)
{
MessageBox.Show("计算文件MD5码错误" + ex.Message);
return;
}
// 对比验证
if (fileMd5 == currentMd5)
{
return;
}
}
// 本地不存在文件或校验失败,需要重新下载
OperateResult result = UserClient.Net_File_Client.DownloadFile(PortraitSupport.LargePortrait,
"Files",
"Portrait",
UserClient.UserAccount.UserName,
null,
fileName);
if (result.IsSuccess)
{
// 下载成功
largeLoadAction?.Invoke(fileName);
}
else
{
MessageBox.Show("头像从服务器下载失败,错误原因:" + result.Message);
}
}
#endregion
#region Download Portraint
/// <summary>
/// 加载头像信息,检查本地是否有相应的文件,没有则向服务器请求下载新的头像,然后加载,应放到线程池中执行
/// </summary>
public void DownloadUserPortraint()
{
string path = FileSavePath;
//获取服务器文件名称
OperateResultString result = UserClient.Net_simplify_client.ReadFromServer(CommonHeadCode.SimplifyHeadCode., UserClient.UserAccount.UserName);
if (result.IsSuccess)
{
if (result.Content[0] == 'Y')
{
//服务器存在头像
string fileName = path + @"\" + PortraitSupport.SmallPortrait;
string FileMd5 = result.Content.Substring(1);
if (System.IO.File.Exists(fileName))
{
//文件文件
string currentMd5 = SoftBasic.CalculateFileMD5(fileName);
if (currentMd5 == FileMd5)
{
//加载本地头像
LoadPic?.Invoke(fileName);
}
else
{
//头像已经换了
DownloadUserPortraint(path);
}
}
else
{
//客户端不存在头像
DownloadUserPortraint(path);
}
}
else
{
//服务器不存在头像,本次加载结束
}
}
}
/// <summary>
/// 下载小尺寸的头像并使用委托加载它
/// </summary>
/// <param name="path"></param>
public void DownloadUserPortraint(string path)
{
OperateResultString result = UserClient.Net_simplify_client.ReadFromServer(CommonHeadCode.SimplifyHeadCode., UserClient.UserAccount.UserName);
if (result.IsSuccess)
{
if (result.Content[0] == 'Y')
{
byte[] data = Convert.FromBase64String(result.Content.Substring(1));
string path32 = path + @"\" + PortraitSupport.SmallPortrait;
System.IO.File.WriteAllBytes(path32, data);
LoadPic?.Invoke(path32);
}
}
}
/// <summary>
/// 下载大尺寸的头像并打开它,该方法适合线程池
@@ -163,7 +248,28 @@ namespace ClientsLibrary
string path = FileSavePath;
string path300 = path + @"\" + PortraitSupport.LargePortrait;
// 利用客户端文件引擎去下载文件
if (string.IsNullOrEmpty(UserClient.UserAccount.LargePortraitMD5))
{
// 服务器不存在头像
return;
}
if (System.IO.File.Exists(path300))
{
// 验证文件MD5码是否一致
string currentMd5 = SoftBasic.CalculateFileMD5(path300);
if (UserClient.UserAccount.LargePortraitMD5 == currentMd5)
{
System.Diagnostics.Process.Start(path300);
// 避免屏幕闪烁
Thread.Sleep(1000);
return;
}
}
// 验证不一致时需要利用客户端文件引擎去下载文件
OperateResult operateResult = UserClient.Net_File_Client.DownloadFile(
PortraitSupport.LargePortrait,
"Files",
@@ -179,6 +285,7 @@ namespace ClientsLibrary
System.Diagnostics.Process.Start(path300);
}
// 避免屏幕闪烁
Thread.Sleep(1000);
}

View File

@@ -49,11 +49,11 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AccountSupport\AccountDetails.cs">
<Compile Include="AccountSupport\FormAccountDetails.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="AccountSupport\AccountDetails.Designer.cs">
<DependentUpon>AccountDetails.cs</DependentUpon>
<Compile Include="AccountSupport\FormAccountDetails.Designer.cs">
<DependentUpon>FormAccountDetails.cs</DependentUpon>
</Compile>
<Compile Include="AccountSupport\AccountLogin.cs" />
<Compile Include="BasicSupport\FormDownloading.cs">
@@ -92,6 +92,11 @@
<Compile Include="AccountSupport\FormRegisterAccount.Designer.cs">
<DependentUpon>FormRegisterAccount.cs</DependentUpon>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="SoftUpdateSupport\FormUpdateRemote.cs">
<SubType>Form</SubType>
</Compile>
@@ -103,8 +108,8 @@
<Compile Include="AccountSupport\UserPortrait.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="AccountSupport\AccountDetails.resx">
<DependentUpon>AccountDetails.cs</DependentUpon>
<EmbeddedResource Include="AccountSupport\FormAccountDetails.resx">
<DependentUpon>FormAccountDetails.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BasicSupport\FormDownloading.resx">
<DependentUpon>FormDownloading.cs</DependentUpon>
@@ -124,10 +129,19 @@
<EmbeddedResource Include="AccountSupport\FormRegisterAccount.resx">
<DependentUpon>FormRegisterAccount.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="SoftUpdateSupport\FormUpdateRemote.resx">
<DependentUpon>FormUpdateRemote.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<None Include="img\ExtensionManager_vsix_OSReg_16x.png" />
</ItemGroup>
<ItemGroup>
<None Include="img\Flagthread_7317.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

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

View File

@@ -0,0 +1,127 @@
<?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>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="ExtensionManager_vsix_OSReg_16x" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\img\ExtensionManager_vsix_OSReg_16x.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Flagthread_7317" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\img\Flagthread_7317.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

View File

@@ -30,8 +30,11 @@ namespace CommonLibrary
private List<T> all_list_accounts = new List<T>();
private object lock_list_accounts = new object();
/// <summary>
/// 一个简单的混合锁相比Lock速度更快
/// </summary>
private HslCommunication.SimpleHybirdLock hybirdLock = new HslCommunication.SimpleHybirdLock();
/// <summary>
/// 更新指定账户的密码
@@ -40,20 +43,44 @@ namespace CommonLibrary
/// <param name="password"></param>
public void UpdatePassword(string name, string password)
{
lock (lock_list_accounts)
hybirdLock.Enter();
for (int i = 0; i < all_list_accounts.Count; i++)
{
for (int i = 0; i < all_list_accounts.Count; i++)
if (name == all_list_accounts[i].UserName)
{
if (name == all_list_accounts[i].UserName)
{
all_list_accounts[i].Password = password;
ILogNet?.WriteInfo(Resource.StringResouce.AccountModifyPassword + name);
break;
}
all_list_accounts[i].Password = password;
ILogNet?.WriteInfo(Resource.StringResouce.AccountModifyPassword + name);
break;
}
}
hybirdLock.Leave();
}
/// <summary>
/// 更新指定账户的大小尺寸的头像MD5码
/// </summary>
/// <param name="name"></param>
/// <param name="largePortraitMD5">大尺寸头像的MD5</param>
/// <param name="smallPortraitMD5">小尺寸头像的MD5</param>
public void UpdatePortraitMD5(string name, string smallPortraitMD5, string largePortraitMD5)
{
hybirdLock.Enter();
for (int i = 0; i < all_list_accounts.Count; i++)
{
if (name == all_list_accounts[i].UserName)
{
all_list_accounts[i].SmallPortraitMD5 = smallPortraitMD5;
all_list_accounts[i].LargePortraitMD5 = largePortraitMD5;
ILogNet?.WriteInfo(Resource.StringResouce.AccountModifyPassword + name);
break;
}
}
hybirdLock.Leave();
}
/// <summary>
/// 筛选特定的账户信息
/// </summary>
@@ -91,32 +118,33 @@ namespace CommonLibrary
ForbidMessage = "用户名不存在!",
};
lock (lock_list_accounts)
hybirdLock.Enter();
for (int i = 0; i < all_list_accounts.Count; i++)
{
for (int i = 0; i < all_list_accounts.Count; i++)
T item = all_list_accounts[i];
if (item.UserName == name)
{
T item = all_list_accounts[i];
if (item.UserName == name)
if (item.Password != code)
{
if (item.Password != code)
{
result.ForbidMessage = "密码错误!";
break;
}
else
{
//说明已经登录成功,需要进行进一步操作
item.LoginFrequency++;
result = item.DeepCopy<T>();
//下面两个数据应该是旧的数据
item.LastLoginIpAddress = ipAddress;
item.LastLoginTime = DateTime.Now;
item.LastLoginWay = way;
break;
}
result.ForbidMessage = "密码错误!";
break;
}
else
{
//说明已经登录成功,需要进行进一步操作
item.LoginFrequency++;
result = item.DeepCopy<T>();
//下面两个数据应该是旧的数据
item.LastLoginIpAddress = ipAddress;
item.LastLoginTime = DateTime.Now;
item.LastLoginWay = way;
break;
}
}
}
hybirdLock.Leave();
return result;
}
/// <summary>
@@ -136,19 +164,22 @@ namespace CommonLibrary
/// <returns>成功True失败False</returns>
public bool AddNewAccount(T account)
{
lock (lock_list_accounts)
bool result = true;
hybirdLock.Enter();
for (int i = 0; i < all_list_accounts.Count; i++)
{
for (int i = 0; i < all_list_accounts.Count; i++)
if (all_list_accounts[i].UserName == account.UserName)
{
if (all_list_accounts[i].UserName == account.UserName)
{
return false;
}
result = false;
break;
}
all_list_accounts.Add(account);
ILogNet?.WriteInfo(Resource.StringResouce.AccountAddSuccess + account.UserName);
}
return true;
all_list_accounts.Add(account);
ILogNet?.WriteInfo(Resource.StringResouce.AccountAddSuccess + account.UserName);
hybirdLock.Leave();
return result;
}
/// <summary>
@@ -157,18 +188,18 @@ namespace CommonLibrary
/// <param name="name">需要删除的账户的名称</param>
public void DeleteAccount(string name)
{
lock (lock_list_accounts)
hybirdLock.Enter();
for (int i = 0; i < all_list_accounts.Count; i++)
{
for (int i = 0; i < all_list_accounts.Count; i++)
if (name == all_list_accounts[i].UserName)
{
if (name == all_list_accounts[i].UserName)
{
all_list_accounts.RemoveAt(i);
ILogNet?.WriteInfo(Resource.StringResouce.AccountDeleteSuccess + name);
break;
}
all_list_accounts.RemoveAt(i);
ILogNet?.WriteInfo(Resource.StringResouce.AccountDeleteSuccess + name);
break;
}
}
hybirdLock.Leave();
}
/// <summary>
@@ -191,10 +222,9 @@ namespace CommonLibrary
public string GetAllAccountsJson()
{
string result = string.Empty;
lock (lock_list_accounts)
{
result = JArray.FromObject(all_list_accounts).ToString();
}
hybirdLock.Enter();
result = JArray.FromObject(all_list_accounts).ToString();
hybirdLock.Leave();
return result;
}
@@ -204,17 +234,16 @@ namespace CommonLibrary
/// <param name="json"></param>
public void LoadAllAccountsJson(string json)
{
lock (lock_list_accounts)
hybirdLock.Enter();
try
{
try
{
all_list_accounts = JArray.Parse(json).ToObject<List<T>>();
}
catch (Exception ex)
{
ILogNet?.WriteException(Resource.StringResouce.AccountLoadFailed, ex);
}
all_list_accounts = JArray.Parse(json).ToObject<List<T>>();
}
catch (Exception ex)
{
ILogNet?.WriteException(Resource.StringResouce.AccountLoadFailed, ex);
}
hybirdLock.Leave();
}

View File

@@ -65,6 +65,14 @@ namespace CommonLibrary
/// 上次登录系统的方式有winform版wpf版web版
/// </summary>
public string LastLoginWay { get; set; } = string.Empty;
/// <summary>
/// 小尺寸头像的MD5码
/// </summary>
public string SmallPortraitMD5 { get; set; } = string.Empty;
/// <summary>
/// 大尺寸头像的MD5码
/// </summary>
public string LargePortraitMD5 { get; set; } = string.Empty;
#endregion
@@ -86,6 +94,14 @@ namespace CommonLibrary
/// 登录系统的唯一设备ID
/// </summary>
public static string DeviceUniqueID { get { return "DeviceUniqueID"; } }
/// <summary>
/// 小尺寸头像的MD5传送名称
/// </summary>
public static string SmallPortraitText { get { return "SmallPortrait"; } }
/// <summary>
/// 大尺寸头像的MD5传送名称
/// </summary>
public static string LargePortraitText { get { return "LargePortrait"; } }
#endregion

View File

@@ -40,6 +40,8 @@ namespace CommonLibrary
{
return (customer >= 10000 && customer < 11000);
}
public static int { get; } = 10000;//10000开始的表明是系统相关的
public static int { get; } = 10001;
public static int { get; } = 10002;
@@ -55,12 +57,9 @@ 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;
public static int { get; } = 10019;
public static int { get; } = 10020;
public static int MD5 { get; } = 10015;
public static int { get; } = 10016;
public static int { get; } = 10017;

View File

@@ -24,6 +24,7 @@ namespace CommonLibrary
public const string AccountDeleteSuccess = "账户删除:";
public const string AccountAddSuccess = "账户新增:";
public const string AccountModifyPassword = "账户更改密码:";
public const string AccountUploadPortrait = "账户更改头像:";
}
}
}

Binary file not shown.

View File

@@ -2259,11 +2259,10 @@
<param name="id">第三类</param>
<returns></returns>
</member>
<member name="M:HslCommunication.Enthernet.AdvancedFileClient.DownloadPathFileNames(System.Net.IPEndPoint,System.String[]@,System.String,System.String,System.String)">
<member name="M:HslCommunication.Enthernet.AdvancedFileClient.DownloadPathFileNames(System.String[]@,System.String,System.String,System.String)">
<summary>
获取指定路径下的所有的文档
</summary>
<param name="iPEndPoint"></param>
<param name="fileNames"></param>
<param name="factory"></param>
<param name="group"></param>

View File

@@ -102,7 +102,7 @@
<materialDesign:PackIcon Kind="MessageOutline" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="头像更改" x:Name="MenuItem头像更改" Click="MenuItem头像更改_Click">
<MenuItem Header="我的信息" x:Name="MenuItem头像更改" Click="MenuItem我的信息_Click">
<MenuItem.Icon>
<materialDesign:PackIcon Kind="AccountConvert" />
</MenuItem.Icon>

View File

@@ -133,7 +133,8 @@ namespace 软件系统客户端Wpf
TimeTickInitilization();
//显示头像
SoftUserPortraitInitialization();
SoftUserPortrait.DownloadUserPortraint();
SoftUserPortrait.LoadUserSmallPortraint();
AccountChip.Content = UserClient.UserAccount.UserName;
SetShowRenderControl(UIControl_Home);
@@ -305,9 +306,12 @@ namespace 软件系统客户端Wpf
UIControls_Chat.ScrollToDown();
}
private void MenuItem头像更改_Click(object sender, RoutedEventArgs e)
private void MenuItem我的信息_Click(object sender, RoutedEventArgs e)
{
SoftUserPortrait.ChangePortrait();
using (FormAccountDetails form = new FormAccountDetails(SoftUserPortrait))
{
form.ShowDialog();
}
}

View File

@@ -45,10 +45,10 @@
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();
@@ -79,7 +79,7 @@
this.label10 = new System.Windows.Forms.Label();
this.panel_main = new System.Windows.Forms.Panel();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.statusStrip1.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.panel_right.SuspendLayout();
@@ -227,12 +227,19 @@
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.PickAxe_32xLG;
this.ToolStripMenuItem.Name = "设置ToolStripMenuItem";
this.ToolStripMenuItem.Size = new System.Drawing.Size(80, 31);
@@ -252,13 +259,6 @@
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[] {
@@ -559,12 +559,12 @@
this.pictureBox1.TabStop = false;
this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
//
// 分厂配置ToolStripMenuItem
// 我的信息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.ToolStripMenuItem.Name = "我的信息ToolStripMenuItem";
this.ToolStripMenuItem.Size = new System.Drawing.Size(164, 32);
this.ToolStripMenuItem.Text = "我的信息";
this.ToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click);
//
// FormMainWindow
//
@@ -650,9 +650,9 @@
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;
private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem;
}
}

View File

@@ -125,7 +125,7 @@ namespace 软件系统客户端模版
//启动定时器
TimeTickInitilization();
//显示头像
SoftUserPortrait.DownloadUserPortraint();
SoftUserPortrait.LoadUserSmallPortraint();
}
private void FormMainWindow_FormClosing(object sender, FormClosingEventArgs e)
{
@@ -310,6 +310,14 @@ namespace 软件系统客户端模版
SoftUserPortrait.ChangePortrait();
}
private void ToolStripMenuItem_Click(object sender, EventArgs e)
{
using (FormAccountDetails form = new FormAccountDetails(SoftUserPortrait))
{
form.ShowDialog();
}
}
private void ToolStripMenuItem_Click(object sender, EventArgs e)
{
using (FormInputAndAction fiaa = new FormInputAndAction(
@@ -666,5 +674,6 @@ namespace 软件系统客户端模版
#endregion
}
}

View File

@@ -599,36 +599,23 @@ namespace 软件系统服务端模版
//发送到邮箱
SendUserMail("异常记录", "时间:" + DateTime.Now.ToString("O") + Environment.NewLine + data);
}
else if (customer == CommonHeadCode.SimplifyHeadCode.)
else if (customer == CommonHeadCode.SimplifyHeadCode.MD5)
{
string fileName = Application.StartupPath + @"\Files\Portrait\" + data + @"\" + PortraitSupport.SmallPortrait;
if (string.IsNullOrEmpty(fileName))
try
{
net_simplify_server.SendMessage(state, customer, "N");
// 此处上传两个头像的MD5数据
JObject json = JObject.Parse(data);
string SmallPortraitMD5 = SoftBasic.GetValueFromJsonObject(json, UserAccount.SmallPortraitText, "");
string LargePortraitMD5 = SoftBasic.GetValueFromJsonObject(json, UserAccount.LargePortraitText, "");
string UserName = SoftBasic.GetValueFromJsonObject(json, UserAccount.UserNameText, "");
UserServer.ServerAccounts.UpdatePortraitMD5(UserName, SmallPortraitMD5, LargePortraitMD5);
net_simplify_server.SendMessage(state, customer, "成功");
}
else
catch(Exception ex)
{
try
{
net_simplify_server.SendMessage(state, customer, "Y" + SoftBasic.CalculateFileMD5(fileName));
}
catch (Exception ex)
{
net_simplify_server.SendMessage(state, customer, "N");
RuntimeLogHelper.WriteException(null, ex);
}
}
}
else if (customer == CommonHeadCode.SimplifyHeadCode.)
{
string fileName = Application.StartupPath + @"\Files\Portrait\" + data + @"\" + PortraitSupport.SmallPortrait;
if (string.IsNullOrEmpty(fileName))
{
net_simplify_server.SendMessage(state, customer, "N");
}
else
{
net_simplify_server.SendMessage(state, customer, "Y" + Convert.ToBase64String(System.IO.File.ReadAllBytes(fileName)));
net_simplify_server.SendMessage(state, customer, "失败,原因是:" + ex.Message);
}
}
else if (customer == CommonHeadCode.SimplifyHeadCode.)
@@ -808,7 +795,10 @@ namespace 软件系统服务端模版
*
****************************************************************************************************/
private void DataProcessingWithStartC(AsyncStateOne state, int customer, string data)
{
// 下面随便扩充
}
#endregion
@@ -1345,8 +1335,8 @@ namespace 软件系统服务端模版
/// </summary>
private void SoftMailInitialization()
{
IsSendMailEnable = false;//先进行关闭
SoftMail.MailSystem163.MailSendAddress = "hsl200909@163.com";//作者测试的邮箱地址,实际需要换成你自己的
IsSendMailEnable = false;// 先进行关闭
SoftMail.MailSystem163.MailSendAddress = "hsl200909@163.com";// 作者测试的邮箱地址,实际需要换成你自己的
}