Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jobily
ClientServerProject
提交
a32b337e
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,发现更多精彩内容 >>
提交
a32b337e
编写于
7月 12, 2017
作者:
Richard__Hu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
根据最新提炼的头像类更改完成。
上级
f5b50de0
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
11 addition
and
116 deletion
+11
-116
软件系统客户端模版/FormMainWindow.cs
软件系统客户端模版/FormMainWindow.cs
+11
-116
未找到文件。
软件系统客户端模版/FormMainWindow.cs
浏览文件 @
a32b337e
...
...
@@ -81,6 +81,8 @@ namespace 软件系统客户端模版
net_socket_client
.
AcceptString
+=
Net_socket_client_AcceptString
;
//启动网络服务
Net_Socket_Client_Initialization
();
//启动头像
SoftUserPortraitInitialization
();
label_Announcement
.
Text
=
UserClient
.
Announcement
;
...
...
@@ -118,7 +120,7 @@ namespace 软件系统客户端模版
//启动定时器
TimeTickInitilization
();
//显示头像
DownloadUserPortraint
();
SoftUserPortrait
.
DownloadUserPortraint
();
}
private
void
FormMainWindow_FormClosing
(
object
sender
,
FormClosingEventArgs
e
)
{
...
...
@@ -300,7 +302,7 @@ namespace 软件系统客户端模版
private
void
更换头像
ToolStripMenuItem_Click
(
object
sender
,
EventArgs
e
)
{
ChangePortrait
();
SoftUserPortrait
.
ChangePortrait
();
}
#
endregion
...
...
@@ -623,133 +625,26 @@ namespace 软件系统客户端模版
#
region
头像图片上传下载块
private
string
GetPortraitPath
()
{
string
path
=
Application
.
StartupPath
+
@"\Portrait\"
+
UserClient
.
UserAccount
.
UserName
;
if
(!
System
.
IO
.
Directory
.
Exists
(
path
))
{
System
.
IO
.
Directory
.
CreateDirectory
(
path
);
}
return
path
;
}
private
void
ChangePortrait
()
{
using
(
FormPortraitSelect
fps
=
new
FormPortraitSelect
())
{
if
(
fps
.
ShowDialog
()
==
DialogResult
.
OK
)
{
string
path
=
GetPortraitPath
();
string
guid
=
Guid
.
NewGuid
().
ToString
(
"N"
);
string
path300
=
path
+
@"\"
+
PortraitSupport
.
LargePortrait
;
string
path32
=
path
+
@"\"
+
PortraitSupport
.
SmallPortrait
;
Bitmap
bitmap300
=
fps
.
GetSpecifiedSizeImage
(
300
);
bitmap300
.
Save
(
path300
);
Bitmap
bitmap32
=
fps
.
GetSpecifiedSizeImage
(
32
);
bitmap32
.
Save
(
path32
);
//传送服务器
bitmap300
.
Dispose
();
bitmap32
.
Dispose
();
using
(
FormFileOperate
ffo
=
new
FormFileOperate
(
CommonHeadCode
.
KeyToken
,
new
System
.
Net
.
IPEndPoint
(
System
.
Net
.
IPAddress
.
Parse
(
UserClient
.
ServerIp
),
CommonLibrary
.
CommonLibrary
.
Port_Portrait_Server
),
new
string
[]
{
path300
,
path32
},
"Files"
,
"Portrait"
,
UserClient
.
UserAccount
.
UserName
))
{
ffo
.
ShowDialog
();
}
DownloadUserPortraint
();
}
}
}
private
UserPortrait
SoftUserPortrait
{
get
;
set
;
}
private
void
DownloadUserPortraint
()
private
void
SoftUserPortraitInitialization
()
{
string
path
=
GetPortraitPath
();
//获取服务器文件名称
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
)
{
//加载本地头像
pictureBox1
.
LoadAsync
(
fileName
);
}
else
{
//头像已经换了
DownloadUserPortraint
(
path
);
}
}
else
{
//客户端不存在头像
DownloadUserPortraint
(
path
);
}
}
else
{
//服务器不存在头像,本次加载结束
}
}
SoftUserPortrait
=
new
UserPortrait
(
Application
.
StartupPath
+
@"\Portrait\"
+
UserClient
.
UserAccount
.
UserName
,
m
=>
pictureBox1
.
LoadAsync
(
m
));
}
private
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
);
pictureBox1
.
LoadAsync
(
path32
);
}
}
}
private
void
pictureBox1_Click
(
object
sender
,
EventArgs
e
)
{
//点击了头像,请求下载高清版本头像
using
(
FormMatterRemind
fmr
=
new
FormMatterRemind
(
"正在下载图片"
,
ThreadPoolDownloadSizeLarge
))
using
(
FormMatterRemind
fmr
=
new
FormMatterRemind
(
"正在下载图片"
,
SoftUserPortrait
.
ThreadPoolDownloadSizeLarge
))
{
fmr
.
ShowDialog
();
}
}
private
void
ThreadPoolDownloadSizeLarge
()
{
string
path
=
GetPortraitPath
();
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
.
LargePortrait
;
System
.
IO
.
File
.
WriteAllBytes
(
path32
,
data
);
System
.
Diagnostics
.
Process
.
Start
(
path32
);
}
}
Thread
.
Sleep
(
1000
);
}
#
endregion
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录