文件共享功能调试成功,支持了文件列表的搜索,可以根据文件名称,备注及上传人来进行检索。

This commit is contained in:
HSL
2017-04-07 09:08:48 +08:00
parent aa27f219cf
commit e24bfbcee1
4 changed files with 33 additions and 23 deletions

View File

@@ -146,7 +146,7 @@
this.ToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(921, 35);
this.menuStrip1.Size = new System.Drawing.Size(921, 33);
this.menuStrip1.TabIndex = 1;
this.menuStrip1.Text = "menuStrip1";
//
@@ -159,41 +159,41 @@
this.ToolStripMenuItem,
this.ToolStripMenuItem});
this.ToolStripMenuItem.Name = "管理员ToolStripMenuItem";
this.ToolStripMenuItem.Size = new System.Drawing.Size(84, 31);
this.ToolStripMenuItem.Size = new System.Drawing.Size(84, 29);
this.ToolStripMenuItem.Text = "管理员";
//
// 更改公告ToolStripMenuItem
//
this.ToolStripMenuItem.Name = "更改公告ToolStripMenuItem";
this.ToolStripMenuItem.Size = new System.Drawing.Size(164, 32);
this.ToolStripMenuItem.Size = new System.Drawing.Size(164, 30);
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.Size = new System.Drawing.Size(164, 30);
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.Size = new System.Drawing.Size(164, 30);
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.Size = new System.Drawing.Size(164, 30);
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.Size = new System.Drawing.Size(164, 30);
this.ToolStripMenuItem.Text = "注册账号";
this.ToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click);
//
@@ -202,13 +202,13 @@
this.ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.ToolStripMenuItem});
this.ToolStripMenuItem.Name = "设置ToolStripMenuItem";
this.ToolStripMenuItem.Size = new System.Drawing.Size(64, 31);
this.ToolStripMenuItem.Size = new System.Drawing.Size(64, 29);
this.ToolStripMenuItem.Text = "设置";
//
// 修改密码ToolStripMenuItem
//
this.ToolStripMenuItem.Name = "修改密码ToolStripMenuItem";
this.ToolStripMenuItem.Size = new System.Drawing.Size(164, 32);
this.ToolStripMenuItem.Size = new System.Drawing.Size(164, 30);
this.ToolStripMenuItem.Text = "修改密码";
this.ToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click);
//
@@ -219,27 +219,27 @@
this.ToolStripMenuItem,
this.ToolStripMenuItem});
this.ToolStripMenuItem.Name = "关于ToolStripMenuItem";
this.ToolStripMenuItem.Size = new System.Drawing.Size(64, 31);
this.ToolStripMenuItem.Size = new System.Drawing.Size(64, 29);
this.ToolStripMenuItem.Text = "关于";
//
// 关于本软件ToolStripMenuItem
//
this.ToolStripMenuItem.Name = "关于本软件ToolStripMenuItem";
this.ToolStripMenuItem.Size = new System.Drawing.Size(184, 32);
this.ToolStripMenuItem.Size = new System.Drawing.Size(184, 30);
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.Size = new System.Drawing.Size(184, 30);
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.Size = new System.Drawing.Size(184, 30);
this.ToolStripMenuItem.Text = "版本号说明";
this.ToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click);
//
@@ -267,9 +267,9 @@
this.panel1.Controls.Add(this.label1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Right;
this.panel1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.panel1.Location = new System.Drawing.Point(697, 35);
this.panel1.Location = new System.Drawing.Point(697, 33);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(224, 419);
this.panel1.Size = new System.Drawing.Size(224, 421);
this.panel1.TabIndex = 2;
//
// label_file_count

View File

@@ -19,6 +19,7 @@ using System.Threading;
// 版权所有 胡少林
// 授权说明 模版仅授权个人使用如需商用请联系hsl200909@163.com洽谈
// 说明 JSON组件引用自james newton-king遵循MIT授权协议
// 说明 文件的图标来源于http://fileicons.chromefans.org/,感谢作者的无私分享
//============================================================================
@@ -282,10 +283,10 @@ namespace 软件系统客户端模版
//收到服务器的数据
JObject json = JObject.Parse(object2.Substring(4));
UserClient.DateTimeServer = json["Time"].ToObject<DateTime>();
label_file_count.Text = json["FileCount"].ToObject<int>().ToString();
if (IsHandleCreated) Invoke(new Action(() =>
{
toolStripStatusLabel_time.Text = UserClient.DateTimeServer.ToString("yyyy-MM-dd HH:mm");
label_file_count.Text = json["FileCount"].ToObject<int>().ToString();
}));
}
else if(head_code==CommonHeadCode.MultiNetHeadCode.)
@@ -373,9 +374,10 @@ namespace 软件系统客户端模版
UIControls_Files = new UIControls.ShareFilesRender()
{
Parent = this,
Dock = DockStyle.Fill,
Parent = this,//决定了放在哪个界面显示,此处仅仅是测试
Visible = true,
Location = new Point(100, 100),
//Dock = DockStyle.Fill,
};
all_main_render.Add(UIControls_Files);
}

View File

@@ -17,6 +17,8 @@ namespace 软件系统客户端模版.UIControls
public ShareFilesRender()
{
InitializeComponent();
DoubleBuffered = true;
}
private void userButton_upload_Click(object sender, EventArgs e)
@@ -78,11 +80,14 @@ namespace 软件系统客户端模版.UIControls
}
});
panel2.Controls.Add(item);
item.BackColor = Color.White;
item.BorderStyle = BorderStyle.FixedSingle;
item.SetFile(m, () => m.UploadName == UserClient.UserAccount.UserName);
item.Location = new Point(2, location_y);
item.Size = new Size(panel2.Width - 20, item.Size.Height);
item.Size = new Size(panel2.Width - 4, item.Size.Height);
item.Anchor = (AnchorStyles)(AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
location_y += item.Height + 2;
location_y += item.Height + 4;
FilesControls.Push(item);
}
}
@@ -121,10 +126,13 @@ namespace 软件系统客户端模版.UIControls
private void textBox1_TextChanged(object sender, EventArgs e)
{
//搜索时触发的数据
if(string.IsNullOrEmpty(textBox1.Text))
if(!string.IsNullOrEmpty(textBox1.Text))
{
string pattern = textBox1.Text;
SetFilesShow(Cache_Files.Where(f => f.FileName.Contains(pattern) || f.FileNote.Contains(pattern)).ToList());
SetFilesShow(Cache_Files.Where(f =>
f.FileName.Contains(pattern) ||
f.FileNote.Contains(pattern) ||
f.UploadName.Contains(pattern)).ToList());
}
else
{

View File

@@ -19,7 +19,6 @@ using Newtonsoft.Json.Linq;
// 版权所有 胡少林
// 授权说明 模版仅授权个人使用如需商用请联系hsl200909@163.com洽谈
// 说明 JSON组件引用自james newton-king遵循MIT授权协议
// 说明 文件的图标来源于,感谢作者的无私分享
//============================================================================
@@ -546,6 +545,7 @@ namespace 软件系统服务端模版
str => JArray.Parse(str).ToObject<List<File_Save>>());
//文件信息存储路径
net_simple_file_server.FileSavePath = Application.StartupPath + @"\files.txt";
net_simple_file_server.ReadFromFile();
//文件存储路径
net_simple_file_server.File_save_path = Application.StartupPath + @"\Files";
net_simple_file_server.FileChange += Net_simple_file_server_FileChange;