Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jobily
ClientServerProject
提交
4f66cccb
C
ClientServerProject
项目概览
jobily
/
ClientServerProject
2023-09-12 01:32:09同步失败
通知
2
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
ClientServerProject
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4f66cccb
编写于
7月 18, 2017
作者:
Richard__Hu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wpf客户端实现文件上传下载。
上级
f8ca155e
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
148 addition
and
32 deletion
+148
-32
Public/HslCommunication.dll
Public/HslCommunication.dll
+0
-0
Public/HslCommunication.xml
Public/HslCommunication.xml
+33
-0
软件系统客户端Wpf/LoginWindow.xaml.cs
软件系统客户端Wpf/LoginWindow.xaml.cs
+4
-4
软件系统客户端Wpf/MainWindow.xaml
软件系统客户端Wpf/MainWindow.xaml
+1
-1
软件系统客户端Wpf/MainWindow.xaml.cs
软件系统客户端Wpf/MainWindow.xaml.cs
+3
-2
软件系统客户端Wpf/Views/UserFileRender.xaml
软件系统客户端Wpf/Views/UserFileRender.xaml
+1
-1
软件系统客户端Wpf/Views/UserFileRenderItem.xaml
软件系统客户端Wpf/Views/UserFileRenderItem.xaml
+30
-24
软件系统客户端Wpf/Views/UserFileRenderItem.xaml.cs
软件系统客户端Wpf/Views/UserFileRenderItem.xaml.cs
+76
-0
未找到文件。
Public/HslCommunication.dll
浏览文件 @
4f66cccb
无法预览此类型文件
Public/HslCommunication.xml
浏览文件 @
4f66cccb
...
...
@@ -1962,6 +1962,31 @@
刷新客户端的文件信息
</summary>
</member>
<member
name=
"T:HslCommunication.Enthernet.SimpleFileClient"
>
<summary>
文件传送中的客户端类
</summary>
</member>
<member
name=
"M:HslCommunication.Enthernet.SimpleFileClient.DeleteFile(System.String,System.Int32,System.String)"
>
<summary>
删除服务器上的文件
</summary>
<param
name=
"serverIp"
></param>
<param
name=
"serverPort"
></param>
<param
name=
"fileName"
></param>
<returns></returns>
</member>
<member
name=
"M:HslCommunication.Enthernet.SimpleFileClient.DownloadFile(System.String,System.Int32,System.String,System.Action{System.Int32,System.Int32},System.String)"
>
<summary>
下载文件信息
</summary>
<param
name=
"serverIp"
></param>
<param
name=
"serverPort"
></param>
<param
name=
"fileName"
></param>
<param
name=
"processReport"
></param>
<param
name=
"fileSave"
></param>
<returns></returns>
</member>
<member
name=
"T:HslCommunication.Enthernet.Net_File_Server"
>
<summary>
文件传送类服务器,仅仅负责数据传送部分,不负责数据库的存储
...
...
@@ -2990,6 +3015,14 @@
<param
name=
"data"
></param>
<returns></returns>
</member>
<member
name=
"M:HslCommunication.NetSupport.GetBytesFromString(System.Int32,System.String)"
>
<summary>
根据字符串及指令头返回数据信息
</summary>
<param
name=
"code"
></param>
<param
name=
"data"
></param>
<returns></returns>
</member>
<member
name=
"T:HslCommunication.NetBase"
>
<summary>
一个网络通信类的基础类
...
...
软件系统客户端Wpf/LoginWindow.xaml.cs
浏览文件 @
4f66cccb
...
...
@@ -32,7 +32,7 @@ namespace 软件系统客户端Wpf
{
InitializeComponent
();
UserClient
.
JsonSettings
.
FileSavePath
=
AppDomain
.
CurrentDomain
.
BaseDirectory
+
@"
\
JsonSettings.txt"
;
UserClient
.
JsonSettings
.
FileSavePath
=
AppDomain
.
CurrentDomain
.
BaseDirectory
+
@"JsonSettings.txt"
;
UserClient
.
JsonSettings
.
LoadByFile
();
}
...
...
@@ -91,7 +91,7 @@ namespace 软件系统客户端Wpf
Action
start_update
=
delegate
{
//需要该exe支持,否则将无法是实现自动版本控制
string
update_file_name
=
AppDomain
.
CurrentDomain
.
BaseDirectory
+
@"
\
软件自动更新.exe"
;
string
update_file_name
=
AppDomain
.
CurrentDomain
.
BaseDirectory
+
@"软件自动更新.exe"
;
try
{
System
.
Diagnostics
.
Process
.
Start
(
update_file_name
);
...
...
@@ -324,9 +324,9 @@ namespace 软件系统客户端Wpf
if
(
File
.
Exists
(
AppDomain
.
CurrentDomain
.
BaseDirectory
+
@"
\
Palette.txt"
))
if
(
File
.
Exists
(
AppDomain
.
CurrentDomain
.
BaseDirectory
+
@"Palette.txt"
))
{
using
(
StreamReader
sr
=
new
StreamReader
(
AppDomain
.
CurrentDomain
.
BaseDirectory
+
@"
\
Palette.txt"
,
Encoding
.
UTF8
))
using
(
StreamReader
sr
=
new
StreamReader
(
AppDomain
.
CurrentDomain
.
BaseDirectory
+
@"Palette.txt"
,
Encoding
.
UTF8
))
{
string
temp
=
sr
.
ReadToEnd
();
MaterialDesignThemes
.
Wpf
.
Palette
obj
=
JObject
.
Parse
(
temp
).
ToObject
<
MaterialDesignThemes
.
Wpf
.
Palette
>();
...
...
软件系统客户端Wpf/MainWindow.xaml
浏览文件 @
4f66cccb
...
...
@@ -262,7 +262,7 @@
CornerRadius="2" MouseLeftButtonDown="Border_MouseLeftButtonDown" Cursor="Hand"
Background="{DynamicResource PrimaryHueLightBrush}">
<TextBlock HorizontalAlignment="Right" x:Name="TextBlock_FileCount" Margin="0,0,5,0" ScrollViewer.VerticalScrollBarVisibility="Disabled"
>0</TextBlock>
Foreground="{DynamicResource PrimaryHueMidForegroundBrush}"
>0</TextBlock>
</Border>
<TextBlock Grid.Row="1" Grid.Column="0">在线信息:</TextBlock>
<ListBox Grid.Row="2" Grid.ColumnSpan="2" x:Name="ListBox_Onlines" FontSize="10.5"></ListBox>
...
...
软件系统客户端Wpf/MainWindow.xaml.cs
浏览文件 @
4f66cccb
...
...
@@ -86,7 +86,7 @@ namespace 软件系统客户端Wpf
//保存当前的颜色选择
var
p
=
new
PaletteHelper
().
QueryPalette
();
using
(
StreamWriter
sw
=
new
StreamWriter
(
AppDomain
.
CurrentDomain
.
BaseDirectory
+
@"
\
Palette.txt"
,
false
,
Encoding
.
UTF8
))
using
(
StreamWriter
sw
=
new
StreamWriter
(
AppDomain
.
CurrentDomain
.
BaseDirectory
+
@"Palette.txt"
,
false
,
Encoding
.
UTF8
))
{
sw
.
Write
(
JObject
.
FromObject
(
p
).
ToString
());
}
...
...
@@ -366,6 +366,7 @@ namespace 软件系统客户端Wpf
{
//点击了文件查看
SetShowRenderControl
(
UIControl_Files
);
UIControl_Files
.
UpdateFiles
();
}
...
...
@@ -609,7 +610,7 @@ namespace 软件系统客户端Wpf
private
void
SoftUserPortraitInitialization
()
{
SoftUserPortrait
=
new
UserPortrait
(
AppDomain
.
CurrentDomain
.
BaseDirectory
+
@"
\
Portrait\"
+
UserClient
.
UserAccount
.
UserName
,
SoftUserPortrait
=
new
UserPortrait
(
AppDomain
.
CurrentDomain
.
BaseDirectory
+
@"Portrait\"
+
UserClient
.
UserAccount
.
UserName
,
m
=>
{
byte
[]
content
=
System
.
IO
.
File
.
ReadAllBytes
(
m
);
BitmapImage
bi
=
new
BitmapImage
();
...
...
软件系统客户端Wpf/Views/UserFileRender.xaml
浏览文件 @
4f66cccb
...
...
@@ -35,7 +35,7 @@
</Grid>
<Border Grid.Row="1" BorderThickness="0,1,0,0" Margin="0,5,0,0" BorderBrush="{DynamicResource MaterialDesignDivider}">
<ScrollViewer ScrollViewer.VerticalScrollBarVisibility="Auto">
<ScrollViewer ScrollViewer.
HorizontalScrollBarVisibility="Auto" ScrollViewer.
VerticalScrollBarVisibility="Auto">
<StackPanel Margin="0,5,5,0" x:Name="FileListControl" ScrollViewer.VerticalScrollBarVisibility="Auto">
</StackPanel>
...
...
软件系统客户端Wpf/Views/UserFileRenderItem.xaml
浏览文件 @
4f66cccb
...
...
@@ -4,34 +4,40 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:软件系统客户端Wpf.Views"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
d:DesignHeight="100" d:DesignWidth="400" BorderThickness="1" BorderBrush="{DynamicResource PrimaryHueMidBrush}"
Margin="0,0,0,3" MinWidth="400">
<Grid Margin="3">
<Grid.RowDefinitions>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="120"></ColumnDefinition>
<ColumnDefinition Width="130"></ColumnDefinition>
<ColumnDefinition Width="60"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Image x:Name="FileIcon" Grid.RowSpan="2" Width="18" Height="18" VerticalAlignment="Top" Margin="3,6,3,3"></Image>
<StackPanel>
<Grid Margin="3">
<Grid.RowDefinitions>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="120"></ColumnDefinition>
<ColumnDefinition Width="130"></ColumnDefinition>
<ColumnDefinition Width="60"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Image x:Name="FileIcon" Grid.RowSpan="2" Width="16" Height="16" VerticalAlignment="Top" Margin="3,6,3,3"></Image>
<TextBlock x:Name="FileName" Grid.Column="1" VerticalAlignment="Center">文件名称:</TextBlock>
<TextBlock x:Name="FileSize" Grid.Column="2" VerticalAlignment="Center">大小:</TextBlock>
<TextBlock x:Name="FileDate" Grid.Column="3" VerticalAlignment="Center">日期:</TextBlock>
<TextBlock x:Name="FileName" Grid.Column="1" VerticalAlignment="Center">文件名称:</TextBlock>
<TextBlock x:Name="FileSize" Grid.Column="2" VerticalAlignment="Center">大小:</TextBlock>
<TextBlock x:Name="FileDate" Grid.Column="3" VerticalAlignment="Center">日期:</TextBlock>
<TextBlock x:Name="FileDeleteButton" Grid.Column="4" HorizontalAlignment="Center" VerticalAlignment="Center" Cursor="Hand"
Background="{DynamicResource PrimaryHueLightBrush}" Padding="6,3,6,3">删除</TextBlock>
<TextBlock x:Name="FileDeleteButton" Grid.Column="4" HorizontalAlignment="Center" VerticalAlignment="Center" Cursor="Hand"
Background="{DynamicResource PrimaryHueLightBrush}" Padding="12,3,12,3" MouseLeftButtonDown="FileDeleteButton_MouseLeftButtonDown"
Foreground="{DynamicResource PrimaryHueMidForegroundBrush}">删除</TextBlock>
<TextBlock x:Name="FileDescription" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center">文件备注:</TextBlock>
<TextBlock x:Name="FilePeople" Grid.Row="1" Grid.Column="2" VerticalAlignment="Center">上传人:</TextBlock>
<TextBlock x:Name="FileDownloadTimes" Grid.Row="1" Grid.Column="3" VerticalAlignment="Center">下载次数:</TextBlock>
<TextBlock x:Name="FileDownloadButton" Grid.Row="1" Grid.Column="4" HorizontalAlignment="Center" VerticalAlignment="Center" Cursor="Hand"
Background="{DynamicResource PrimaryHueLightBrush}" Padding="6,3,6,3">下载</TextBlock>
</Grid>
<TextBlock x:Name="FileDescription" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center">文件备注:</TextBlock>
<TextBlock x:Name="FilePeople" Grid.Row="1" Grid.Column="2" VerticalAlignment="Center">上传人:</TextBlock>
<TextBlock x:Name="FileDownloadTimes" Grid.Row="1" Grid.Column="3" VerticalAlignment="Center">下载次数:</TextBlock>
<TextBlock x:Name="FileDownloadButton" Grid.Row="1" Grid.Column="4" HorizontalAlignment="Center" VerticalAlignment="Center" Cursor="Hand"
Background="{DynamicResource PrimaryHueLightBrush}" Padding="12,3,12,3" MouseLeftButtonDown="FileDownloadButton_MouseLeftButtonDown"
Foreground="{DynamicResource PrimaryHueMidForegroundBrush}">下载</TextBlock>
</Grid>
<ProgressBar x:Name="FileDownloadProgress" Grid.Row="2" Grid.ColumnSpan="4" Margin="30,-5,63,0" Height="4"></ProgressBar>
</StackPanel>
</UserControl>
软件系统客户端Wpf/Views/UserFileRenderItem.xaml.cs
浏览文件 @
4f66cccb
...
...
@@ -14,6 +14,9 @@ using System.Windows.Media;
using
System.Windows.Media.Imaging
;
using
System.Windows.Navigation
;
using
System.Windows.Shapes
;
using
HslCommunication
;
using
System.Threading
;
using
System.IO
;
namespace
软件系统客户端
Wpf.Views
{
...
...
@@ -66,9 +69,82 @@ namespace 软件系统客户端Wpf.Views
FileDescription
.
Text
=
"文件备注:"
+
file
.
FileNote
;
FilePeople
.
Text
=
"上传人:"
+
file
.
UploadName
;
FileDownloadTimes
.
Text
=
"下载数:"
+
file
.
FileDownloadTimes
;
FileDeleteButton
.
IsEnabled
=
file
.
UploadName
==
UserClient
.
UserAccount
.
UserName
;
FileDownloadButton
.
IsEnabled
=
true
;
}
private
void
FileDeleteButton_MouseLeftButtonDown
(
object
sender
,
MouseButtonEventArgs
e
)
{
//删除文件
if
(
Hufile
.
UploadName
!=
UserClient
.
UserAccount
.
UserName
)
{
MessageBox
.
Show
(
"无法删除不是自己上传的文件。"
);
return
;
}
if
(
MessageBox
.
Show
(
"请确认是否真的删除?"
,
"删除确认"
,
MessageBoxButton
.
YesNo
)
==
MessageBoxResult
.
No
)
{
return
;
}
//确认删除
OperateResultString
result
=
SimpleFileClient
.
DeleteFile
(
UserClient
.
ServerIp
,
CommonLibrary
.
CommonLibrary
.
Port_Share_File
,
Hufile
.
FileName
);
if
(
result
.
IsSuccess
)
{
MessageBox
.
Show
(
"删除成功!"
);
}
else
{
MessageBox
.
Show
(
"删除失败!原因:"
+
result
.
Message
);
}
}
private
void
FileDownloadButton_MouseLeftButtonDown
(
object
sender
,
MouseButtonEventArgs
e
)
{
//下载文件
FileDownloadButton
.
IsEnabled
=
false
;
Thread
thread_down_file
=
new
Thread
(
new
ThreadStart
(
ThreadDownloadFile
));
thread_down_file
.
IsBackground
=
true
;
thread_down_file
.
Start
();
}
private
void
ThreadDownloadFile
()
{
string
save_file_name
=
AppDomain
.
CurrentDomain
.
BaseDirectory
+
"download\\files"
;
if
(!
Directory
.
Exists
(
save_file_name
))
{
Directory
.
CreateDirectory
(
save_file_name
);
}
save_file_name
+=
"\\"
+
Hufile
.
FileName
;
OperateResultString
result
=
SimpleFileClient
.
DownloadFile
(
UserClient
.
ServerIp
,
CommonLibrary
.
CommonLibrary
.
Port_Share_File
,
Hufile
.
FileName
,
(
m
,
n
)
=>
{
Dispatcher
.
Invoke
(
new
Action
(()
=>
{
FileDownloadProgress
.
Value
=
m
*
100d
/
n
;
}));
},
save_file_name
);
Dispatcher
.
Invoke
(
new
Action
(()
=>
{
if
(
result
.
IsSuccess
)
{
if
(
MessageBox
.
Show
(
"下载完成,路径为:"
+
save_file_name
+
Environment
.
NewLine
+
"是否打开文件路径?"
,
"打开确认"
,
MessageBoxButton
.
YesNo
)
==
MessageBoxResult
.
Yes
)
{
System
.
Diagnostics
.
Process
.
Start
(
"explorer.exe"
,
@"/select,"
+
save_file_name
);
}
}
else
{
MessageBox
.
Show
(
"下载失败,错误原因:"
+
result
.
Message
);
}
FileDownloadButton
.
IsEnabled
=
true
;
}));
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录