大面积更新,主要文件功能块更改,账号新增BUG修复,新增框架版本验证,v1.5.0

This commit is contained in:
dathlin
2017-10-01 15:59:37 +08:00
parent bf3b9d5712
commit 4288d3313f
146 changed files with 5319 additions and 1361 deletions

View File

@@ -85,10 +85,11 @@ namespace ClientsLibrary
// 包装数据
JObject json = new JObject
{
{ UserAccount.UserNameText, new JValue(userName) },
{ UserAccount.PasswordText, new JValue(password) },
{ UserAccount.LoginWayText, new JValue(clientType) },
{ UserAccount.DeviceUniqueID, new JValue(UserClient.JsonSettings.SystemInfo) }
{ UserAccount.UserNameText, new JValue(userName) }, // 用户名
{ UserAccount.PasswordText, new JValue(password) }, // 密码
{ UserAccount.LoginWayText, new JValue(clientType) }, // 登录方式
{ UserAccount.DeviceUniqueID, new JValue(UserClient.JsonSettings.SystemInfo) }, // 客户端唯一ID
{ UserAccount.FrameworkVersion, new JValue(SoftBasic.FrameworkVersion.ToString()) } // 客户端框架版本
};
result = UserClient.Net_simplify_client.ReadFromServer(CommonHeadCode.SimplifyHeadCode., json.ToString());
if (result.IsSuccess)
@@ -125,7 +126,7 @@ namespace ClientsLibrary
// 延时
Thread.Sleep(200);
result = UserClient.Net_simplify_client.ReadFromServer(CommonLibrary.CommonHeadCode.SimplifyHeadCode.);
result = UserClient.Net_simplify_client.ReadFromServer(CommonHeadCode.SimplifyHeadCode.);
if (result.IsSuccess)
{
// 服务器应该返回服务器的版本号

View File

@@ -55,10 +55,16 @@
this.textBox_UserName = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.userButton2 = new HslCommunication.Controls.UserButton();
this.userButton1 = new HslCommunication.Controls.UserButton();
this.userButton_delete = new HslCommunication.Controls.UserButton();
this.userButton_download = new HslCommunication.Controls.UserButton();
this.userButton_upload = new HslCommunication.Controls.UserButton();
this.treeView1 = new System.Windows.Forms.TreeView();
this.textBox_file_name = new System.Windows.Forms.TextBox();
this.label_fileName = new System.Windows.Forms.Label();
this.textBox_file_size = new System.Windows.Forms.TextBox();
this.label_fileSize = new System.Windows.Forms.Label();
this.textBox_file_uploadTime = new System.Windows.Forms.TextBox();
this.label_uploadTime = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox_UserPortrait)).BeginInit();
this.groupBox2.SuspendLayout();
@@ -322,8 +328,14 @@
//
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.groupBox2.Controls.Add(this.userButton2);
this.groupBox2.Controls.Add(this.userButton1);
this.groupBox2.Controls.Add(this.textBox_file_uploadTime);
this.groupBox2.Controls.Add(this.label_uploadTime);
this.groupBox2.Controls.Add(this.textBox_file_size);
this.groupBox2.Controls.Add(this.label_fileSize);
this.groupBox2.Controls.Add(this.textBox_file_name);
this.groupBox2.Controls.Add(this.label_fileName);
this.groupBox2.Controls.Add(this.userButton_delete);
this.groupBox2.Controls.Add(this.userButton_download);
this.groupBox2.Controls.Add(this.userButton_upload);
this.groupBox2.Controls.Add(this.treeView1);
this.groupBox2.Location = new System.Drawing.Point(322, 12);
@@ -333,35 +345,35 @@
this.groupBox2.TabStop = false;
this.groupBox2.Text = "个人文件,支持拖拽上传,双击下载";
//
// userButton2
// userButton_delete
//
this.userButton2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.userButton2.BackColor = System.Drawing.Color.Transparent;
this.userButton2.CustomerInformation = "";
this.userButton2.EnableColor = System.Drawing.Color.FromArgb(((int)(((byte)(190)))), ((int)(((byte)(190)))), ((int)(((byte)(190)))));
this.userButton2.Font = new System.Drawing.Font("微软雅黑", 9F);
this.userButton2.Location = new System.Drawing.Point(297, 460);
this.userButton2.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.userButton2.Name = "userButton2";
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);
this.userButton_delete.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.userButton_delete.BackColor = System.Drawing.Color.Transparent;
this.userButton_delete.CustomerInformation = "";
this.userButton_delete.EnableColor = System.Drawing.Color.FromArgb(((int)(((byte)(190)))), ((int)(((byte)(190)))), ((int)(((byte)(190)))));
this.userButton_delete.Font = new System.Drawing.Font("微软雅黑", 9F);
this.userButton_delete.Location = new System.Drawing.Point(297, 460);
this.userButton_delete.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.userButton_delete.Name = "userButton_delete";
this.userButton_delete.Size = new System.Drawing.Size(65, 23);
this.userButton_delete.TabIndex = 10;
this.userButton_delete.UIText = "删除";
this.userButton_delete.Click += new System.EventHandler(this.userButton2_Click);
//
// userButton1
// userButton_download
//
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);
this.userButton_download.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.userButton_download.BackColor = System.Drawing.Color.Transparent;
this.userButton_download.CustomerInformation = "";
this.userButton_download.EnableColor = System.Drawing.Color.FromArgb(((int)(((byte)(190)))), ((int)(((byte)(190)))), ((int)(((byte)(190)))));
this.userButton_download.Font = new System.Drawing.Font("微软雅黑", 9F);
this.userButton_download.Location = new System.Drawing.Point(81, 460);
this.userButton_download.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.userButton_download.Name = "userButton_download";
this.userButton_download.Size = new System.Drawing.Size(65, 23);
this.userButton_download.TabIndex = 9;
this.userButton_download.UIText = "下载";
this.userButton_download.Click += new System.EventHandler(this.userButton1_Click);
//
// userButton_upload
//
@@ -390,12 +402,74 @@
this.treeView1.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
treeNode1});
this.treeView1.ShowLines = false;
this.treeView1.Size = new System.Drawing.Size(353, 429);
this.treeView1.Size = new System.Drawing.Size(353, 377);
this.treeView1.TabIndex = 0;
this.treeView1.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterSelect);
this.treeView1.DragDrop += new System.Windows.Forms.DragEventHandler(this.treeView1_DragDrop);
this.treeView1.DragEnter += new System.Windows.Forms.DragEventHandler(this.treeView1_DragEnter);
this.treeView1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.treeView1_MouseDoubleClick);
//
// textBox_file_name
//
this.textBox_file_name.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBox_file_name.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox_file_name.Location = new System.Drawing.Point(66, 405);
this.textBox_file_name.Name = "textBox_file_name";
this.textBox_file_name.ReadOnly = true;
this.textBox_file_name.Size = new System.Drawing.Size(297, 23);
this.textBox_file_name.TabIndex = 12;
//
// label_fileName
//
this.label_fileName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label_fileName.AutoSize = true;
this.label_fileName.Location = new System.Drawing.Point(7, 407);
this.label_fileName.Name = "label_fileName";
this.label_fileName.Size = new System.Drawing.Size(56, 17);
this.label_fileName.TabIndex = 11;
this.label_fileName.Text = "文件名:";
//
// textBox_file_size
//
this.textBox_file_size.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.textBox_file_size.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox_file_size.Location = new System.Drawing.Point(66, 432);
this.textBox_file_size.Name = "textBox_file_size";
this.textBox_file_size.ReadOnly = true;
this.textBox_file_size.Size = new System.Drawing.Size(110, 23);
this.textBox_file_size.TabIndex = 14;
//
// label_fileSize
//
this.label_fileSize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label_fileSize.AutoSize = true;
this.label_fileSize.Location = new System.Drawing.Point(7, 434);
this.label_fileSize.Name = "label_fileSize";
this.label_fileSize.Size = new System.Drawing.Size(44, 17);
this.label_fileSize.TabIndex = 13;
this.label_fileSize.Text = "大小:";
//
// textBox_file_uploadTime
//
this.textBox_file_uploadTime.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.textBox_file_uploadTime.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox_file_uploadTime.Location = new System.Drawing.Point(252, 432);
this.textBox_file_uploadTime.Name = "textBox_file_uploadTime";
this.textBox_file_uploadTime.ReadOnly = true;
this.textBox_file_uploadTime.Size = new System.Drawing.Size(111, 23);
this.textBox_file_uploadTime.TabIndex = 16;
//
// label_uploadTime
//
this.label_uploadTime.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label_uploadTime.AutoSize = true;
this.label_uploadTime.Location = new System.Drawing.Point(182, 434);
this.label_uploadTime.Name = "label_uploadTime";
this.label_uploadTime.Size = new System.Drawing.Size(68, 17);
this.label_uploadTime.TabIndex = 15;
this.label_uploadTime.Text = "上传日期:";
//
// FormAccountDetails
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
@@ -417,6 +491,7 @@
this.groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox_UserPortrait)).EndInit();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.ResumeLayout(false);
}
@@ -448,10 +523,16 @@
private System.Windows.Forms.Label label1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.TreeView treeView1;
private HslCommunication.Controls.UserButton userButton2;
private HslCommunication.Controls.UserButton userButton1;
private HslCommunication.Controls.UserButton userButton_delete;
private HslCommunication.Controls.UserButton userButton_download;
private HslCommunication.Controls.UserButton userButton_upload;
private System.Windows.Forms.PictureBox pictureBox_UserPortrait;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.TextBox textBox_file_uploadTime;
private System.Windows.Forms.Label label_uploadTime;
private System.Windows.Forms.TextBox textBox_file_size;
private System.Windows.Forms.Label label_fileSize;
private System.Windows.Forms.TextBox textBox_file_name;
private System.Windows.Forms.Label label_fileName;
}
}

View File

@@ -12,6 +12,7 @@ using System.Windows.Forms;
using HslCommunication;
using HslCommunication.BasicFramework;
using System.IO;
using ClientsLibrary.FileSupport;
namespace ClientsLibrary
{
@@ -67,12 +68,11 @@ namespace ClientsLibrary
#endregion
#region
#region Load Portrait
public UserPortrait UserPortrait { get; }
private void pictureBox_UserPortrait_Click(object sender, EventArgs e)
{
UserPortrait.ChangePortrait(LoadLargeProtrait,UnloadLargeProtrait);
@@ -115,7 +115,7 @@ namespace ClientsLibrary
#endregion
#region
#region Download FileNames
public void DownloadUserFileNames()
{
@@ -125,16 +125,17 @@ namespace ClientsLibrary
// 向服务器请求自身的文件列表
OperateResult result = UserClient.Net_File_Client.DownloadPathFileNames(
out string[] files, "Files", "Personal", UserClient.UserAccount.UserName
out GroupFileItem[] files, "Files", "Personal", UserClient.UserAccount.UserName
);
if (result.IsSuccess)
{
if (files != null)
{
foreach(var m in files)
foreach(var file in files)
{
TreeNode node = new TreeNode(m, 1, 1);
TreeNode node = new TreeNode(file.FileName, 1, 1);
node.Tag = file;
treeView1.Nodes[0].Nodes.Add(node);
}
@@ -153,6 +154,11 @@ namespace ClientsLibrary
treeView1.ExpandAll();
}
#endregion
#region Upload Support
private void userButton_upload_Click(object sender, EventArgs e)
{
// 上传个人文件
@@ -178,6 +184,11 @@ namespace ClientsLibrary
DownloadUserFileNames();
}
#endregion
#region Download File Support
private void treeView1_MouseDoubleClick(object sender, MouseEventArgs e)
{
// 双击下载
@@ -212,16 +223,22 @@ namespace ClientsLibrary
}
}
#endregion
#region Delete File Support
private void userButton2_Click(object sender, EventArgs e)
{
// 删除选中文件
TreeNode treeNode = treeView1.SelectedNode;
if (treeNode.Name != "files_root")
{
// 删除文件前要先进行密码验证
using (FormPasswordCheck passwordCheck = new FormPasswordCheck(UserClient.UserAccount.Password))
{
if (passwordCheck.ShowDialog() == DialogResult.OK)
{
// 密码验证已经通过
OperateResult result = UserClient.Net_File_Client.DeleteFile(
treeNode.Text,
"Files",
@@ -241,13 +258,9 @@ namespace ClientsLibrary
}
}
#endregion
#region
#region Drag File Upload
private void treeView1_DragDrop(object sender, DragEventArgs e)
{
@@ -308,6 +321,20 @@ namespace ClientsLibrary
}
#endregion
#region Tree File Select
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
if(e.Node.Tag is GroupFileItem file)
{
textBox_file_name.Text = file.FileName;
textBox_file_size.Text = file.GetTextFromFileSize();
textBox_file_uploadTime.Text = file.UploadTime.ToLocalTime().ToShortDateString();
}
}
#endregion
}
}

View File

@@ -1,4 +1,5 @@
using CommonLibrary;
using ClientsLibrary.FileSupport;
using CommonLibrary;
using HslCommunication;
using HslCommunication.BasicFramework;
using HslCommunication.Enthernet;