Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jobily
ClientServerProject
提交
f8ca155e
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,发现更多精彩内容 >>
提交
f8ca155e
编写于
7月 18, 2017
作者:
Richard__Hu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加完成文件列表显示,接下载准备实现文件删除和下载。
上级
f44c0dc3
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
300 addition
and
2 deletion
+300
-2
软件系统客户端Wpf/MainWindow.xaml
软件系统客户端Wpf/MainWindow.xaml
+1
-0
软件系统客户端Wpf/MainWindow.xaml.cs
软件系统客户端Wpf/MainWindow.xaml.cs
+5
-2
软件系统客户端Wpf/Views/UserFileRender.xaml
软件系统客户端Wpf/Views/UserFileRender.xaml
+45
-0
软件系统客户端Wpf/Views/UserFileRender.xaml.cs
软件系统客户端Wpf/Views/UserFileRender.xaml.cs
+124
-0
软件系统客户端Wpf/Views/UserFileRenderItem.xaml
软件系统客户端Wpf/Views/UserFileRenderItem.xaml
+37
-0
软件系统客户端Wpf/Views/UserFileRenderItem.xaml.cs
软件系统客户端Wpf/Views/UserFileRenderItem.xaml.cs
+74
-0
软件系统客户端Wpf/软件系统客户端Wpf.csproj
软件系统客户端Wpf/软件系统客户端Wpf.csproj
+14
-0
未找到文件。
软件系统客户端Wpf/MainWindow.xaml
浏览文件 @
f8ca155e
...
...
@@ -163,6 +163,7 @@
</Grid>
</Grid>
<!--左侧的侧边栏预告-->
<Grid Width="180" DockPanel.Dock="Left">
<GroupBox Header="系统信息" Margin="0,0,0,0">
<Grid>
...
...
软件系统客户端Wpf/MainWindow.xaml.cs
浏览文件 @
f8ca155e
...
...
@@ -365,7 +365,7 @@ namespace 软件系统客户端Wpf
private
void
Border_MouseLeftButtonDown
(
object
sender
,
MouseButtonEventArgs
e
)
{
//点击了文件查看
MessageBox
.
Show
(
"点击了文件"
);
SetShowRenderControl
(
UIControl_Files
);
}
...
...
@@ -645,7 +645,8 @@ namespace 软件系统客户端Wpf
private
UserChat
UIControls_Chat
{
get
;
set
;
}
private
UserHome
UIControl_Home
{
get
;
set
;
}
private
UserFileRender
UIControl_Files
{
get
;
set
;
}
private
UserPaletteSelector
UIControl_Palette
{
get
;
set
;
}
...
...
@@ -690,6 +691,8 @@ namespace 软件系统客户端Wpf
UIControl_Palette
=
new
UserPaletteSelector
()
{
DataContext
=
new
PaletteSelectorViewModel
()
};
all_main_render
.
Add
(
UIControl_Palette
);
UIControl_Files
=
new
UserFileRender
();
all_main_render
.
Add
(
UIControl_Files
);
}
...
...
软件系统客户端Wpf/Views/UserFileRender.xaml
0 → 100644
浏览文件 @
f8ca155e
<UserControl x:Class="软件系统客户端Wpf.Views.UserFileRender"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:软件系统客户端Wpf.Views"
mc:Ignorable="d"
d:DesignHeight="400" d:DesignWidth="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"></ColumnDefinition>
<ColumnDefinition Width="auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="auto"></ColumnDefinition>
<ColumnDefinition Width="auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Button Style="{StaticResource MaterialDesignRaisedLightButton}" Margin="0,0, 5 5" Width="100"
x:Name="Button_FileUpload" Click="Button_FileUpload_Click">
上传
</Button>
<Button Grid.Column="1" Style="{StaticResource MaterialDesignRaisedLightButton}" Margin="0,0, 5 5" Width="100"
x:Name="Button_FileRefresh" Click="Button_FileRefresh_Click">
刷新
</Button>
<TextBlock Grid.Column="3" VerticalAlignment="Center" FontSize="15">搜索:</TextBlock>
<TextBox Grid.Column="4" Width="200" x:Name="FileSearchFilter" TextChanged="FileSearchFilter_TextChanged"></TextBox>
</Grid>
<Border Grid.Row="1" BorderThickness="0,1,0,0" Margin="0,5,0,0" BorderBrush="{DynamicResource MaterialDesignDivider}">
<ScrollViewer ScrollViewer.VerticalScrollBarVisibility="Auto">
<StackPanel Margin="0,5,5,0" x:Name="FileListControl" ScrollViewer.VerticalScrollBarVisibility="Auto">
</StackPanel>
</ScrollViewer>
</Border>
</Grid>
</UserControl>
软件系统客户端Wpf/Views/UserFileRender.xaml.cs
0 → 100644
浏览文件 @
f8ca155e
using
ClientsLibrary
;
using
CommonLibrary
;
using
HslCommunication
;
using
HslCommunication.Enthernet
;
using
Newtonsoft.Json.Linq
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows
;
using
System.Windows.Controls
;
using
System.Windows.Data
;
using
System.Windows.Documents
;
using
System.Windows.Input
;
using
System.Windows.Media
;
using
System.Windows.Media.Imaging
;
using
System.Windows.Navigation
;
using
System.Windows.Shapes
;
namespace
软件系统客户端
Wpf.Views
{
/// <summary>
/// UserFileRender.xaml 的交互逻辑
/// </summary>
public
partial
class
UserFileRender
:
UserControl
{
public
UserFileRender
()
{
InitializeComponent
();
}
private
void
FileSearchFilter_TextChanged
(
object
sender
,
TextChangedEventArgs
e
)
{
//搜索时触发的数据
if
(!
string
.
IsNullOrEmpty
(
FileSearchFilter
.
Text
))
{
string
pattern
=
FileSearchFilter
.
Text
;
SetFilesShow
(
Cache_Files
.
Where
(
f
=>
f
.
FileName
.
Contains
(
pattern
)
||
f
.
FileNote
.
Contains
(
pattern
)
||
f
.
UploadName
.
Contains
(
pattern
)).
ToList
());
}
else
{
SetFilesShow
(
Cache_Files
);
}
}
private
void
Button_FileUpload_Click
(
object
sender
,
RoutedEventArgs
e
)
{
//上传数据,先对权限进行验证
if
(
UserClient
.
UserAccount
.
Grade
<
AccountGrade
.
Technology
)
{
MessageBox
.
Show
(
"权限不够!"
);
return
;
}
using
(
FormSimplyFileUpload
upload
=
new
FormSimplyFileUpload
(
UserClient
.
ServerIp
,
CommonLibrary
.
CommonLibrary
.
Port_Share_File
,
UserClient
.
UserAccount
.
UserName
))
{
upload
.
ShowDialog
();
}
}
private
void
Button_FileRefresh_Click
(
object
sender
,
RoutedEventArgs
e
)
{
//向服务器请求数据
OperateResultString
result
=
UserClient
.
Net_simplify_client
.
ReadFromServer
(
CommonLibrary
.
CommonHeadCode
.
SimplifyHeadCode
.
请求文件
);
if
(
result
.
IsSuccess
)
{
Cache_Files
=
JArray
.
Parse
(
result
.
Content
).
ToObject
<
List
<
HslSoftFile
>>();
SetFilesShow
(
Cache_Files
);
}
else
{
MessageBox
.
Show
(
result
.
ToMessageShowString
());
}
}
public
void
UpdateFiles
()
{
Button_FileRefresh_Click
(
null
,
new
RoutedEventArgs
());
}
private
void
ClearControls
()
{
FileListControl
.
Children
.
Clear
();
//while (FilesControls.Count > 0)
//{
// FilesControls.Pop().Dispose();
//}
}
private
void
SetFilesShow
(
List
<
HslSoftFile
>
files
)
{
//清楚缓存
ClearControls
();
if
(
files
?.
Count
>
0
&&
FileListControl
.
ActualWidth
>
20
)
{
//添加子控件
foreach
(
var
m
in
files
)
{
UserFileRenderItem
item
=
new
UserFileRenderItem
();
FileListControl
.
Children
.
Add
(
item
);
item
.
SetFile
(
m
);
}
}
}
/// <summary>
/// 所有文件信息的缓存,以支持直接的搜索
/// </summary>
private
List
<
HslSoftFile
>
Cache_Files
{
get
;
set
;
}
=
new
List
<
HslSoftFile
>();
/// <summary>
/// 文件控件的缓存列表,方便清除垃圾
/// </summary>
private
Stack
<
IDisposable
>
FilesControls
=
new
Stack
<
IDisposable
>();
}
}
软件系统客户端Wpf/Views/UserFileRenderItem.xaml
0 → 100644
浏览文件 @
f8ca155e
<UserControl x:Class="软件系统客户端Wpf.Views.UserFileRenderItem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:软件系统客户端Wpf.Views"
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>
<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="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>
</UserControl>
软件系统客户端Wpf/Views/UserFileRenderItem.xaml.cs
0 → 100644
浏览文件 @
f8ca155e
using
ClientsLibrary
;
using
HslCommunication.Enthernet
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows
;
using
System.Windows.Controls
;
using
System.Windows.Data
;
using
System.Windows.Documents
;
using
System.Windows.Input
;
using
System.Windows.Media
;
using
System.Windows.Media.Imaging
;
using
System.Windows.Navigation
;
using
System.Windows.Shapes
;
namespace
软件系统客户端
Wpf.Views
{
/// <summary>
/// UserFileRenderItem.xaml 的交互逻辑
/// </summary>
public
partial
class
UserFileRenderItem
:
UserControl
{
public
UserFileRenderItem
()
{
InitializeComponent
();
}
private
BitmapImage
BitmapToBitmapImage
(
System
.
Drawing
.
Bitmap
bitmap
)
{
BitmapImage
bitmapImage
=
new
BitmapImage
();
using
(
System
.
IO
.
MemoryStream
ms
=
new
System
.
IO
.
MemoryStream
())
{
bitmap
.
Save
(
ms
,
bitmap
.
RawFormat
);
bitmapImage
.
BeginInit
();
bitmapImage
.
StreamSource
=
ms
;
bitmapImage
.
CacheOption
=
BitmapCacheOption
.
OnLoad
;
bitmapImage
.
EndInit
();
bitmapImage
.
Freeze
();
}
return
bitmapImage
;
}
private
HslSoftFile
Hufile
{
get
;
set
;
}
=
null
;
/// <summary>
/// 设置文件数据
/// </summary>
/// <param name="file">文件的信息对象</param>
/// <param name="deleteEnable">删除控件的使能委托</param>
public
void
SetFile
(
HslSoftFile
file
)
{
Hufile
=
file
;
//获取后缀名
int
dotIndex
=
Hufile
.
FileName
.
LastIndexOf
(
'.'
);
if
(
dotIndex
>=
0
)
{
FileIcon
.
Source
=
BitmapToBitmapImage
(
Hufile
.
GetFileIcon
());
}
FileName
.
Text
=
"文件名称:"
+
file
.
FileName
;
FileSize
.
Text
=
"大小:"
+
file
.
GetTextFromFileSize
();
FileDate
.
Text
=
"日期:"
+
file
.
UploadDate
.
ToString
(
"yyyy-MM-dd"
);
FileDescription
.
Text
=
"文件备注:"
+
file
.
FileNote
;
FilePeople
.
Text
=
"上传人:"
+
file
.
UploadName
;
FileDownloadTimes
.
Text
=
"下载数:"
+
file
.
FileDownloadTimes
;
FileDeleteButton
.
IsEnabled
=
file
.
UploadName
==
UserClient
.
UserAccount
.
UserName
;
FileDownloadButton
.
IsEnabled
=
true
;
}
}
}
软件系统客户端Wpf/软件系统客户端Wpf.csproj
浏览文件 @
f8ca155e
...
...
@@ -81,6 +81,12 @@
<Compile
Include=
"Views\UserChat.xaml.cs"
>
<DependentUpon>
UserChat.xaml
</DependentUpon>
</Compile>
<Compile
Include=
"Views\UserFileRender.xaml.cs"
>
<DependentUpon>
UserFileRender.xaml
</DependentUpon>
</Compile>
<Compile
Include=
"Views\UserFileRenderItem.xaml.cs"
>
<DependentUpon>
UserFileRenderItem.xaml
</DependentUpon>
</Compile>
<Compile
Include=
"Views\UserHome.xaml.cs"
>
<DependentUpon>
UserHome.xaml
</DependentUpon>
</Compile>
...
...
@@ -114,6 +120,14 @@
<SubType>
Designer
</SubType>
<Generator>
MSBuild:Compile
</Generator>
</Page>
<Page
Include=
"Views\UserFileRender.xaml"
>
<SubType>
Designer
</SubType>
<Generator>
MSBuild:Compile
</Generator>
</Page>
<Page
Include=
"Views\UserFileRenderItem.xaml"
>
<SubType>
Designer
</SubType>
<Generator>
MSBuild:Compile
</Generator>
</Page>
<Page
Include=
"Views\UserHome.xaml"
>
<SubType>
Designer
</SubType>
<Generator>
MSBuild:Compile
</Generator>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录