Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jobily
ClientServerProject
提交
f5b50de0
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,发现更多精彩内容 >>
提交
f5b50de0
编写于
7月 12, 2017
作者:
Richard__Hu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
头像处理提炼类,客户端界面调整
上级
9d5cb71e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
434 addition
and
27 deletion
+434
-27
ClientsLibrary/ClientsLibrary.csproj
ClientsLibrary/ClientsLibrary.csproj
+1
-0
ClientsLibrary/UserPortrait.cs
ClientsLibrary/UserPortrait.cs
+142
-0
软件系统客户端Wpf/MainWindow.xaml
软件系统客户端Wpf/MainWindow.xaml
+49
-1
软件系统客户端Wpf/MainWindow.xaml.cs
软件系统客户端Wpf/MainWindow.xaml.cs
+242
-26
未找到文件。
ClientsLibrary/ClientsLibrary.csproj
浏览文件 @
f5b50de0
...
...
@@ -75,6 +75,7 @@
</Compile>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
<Compile
Include=
"UserClient.cs"
/>
<Compile
Include=
"UserPortrait.cs"
/>
</ItemGroup>
<ItemGroup>
<EmbeddedResource
Include=
"FormDownloading.resx"
>
...
...
ClientsLibrary/UserPortrait.cs
0 → 100644
浏览文件 @
f5b50de0
using
CommonLibrary
;
using
HslCommunication
;
using
HslCommunication.BasicFramework
;
using
HslCommunication.Enthernet
;
using
System
;
using
System.Collections.Generic
;
using
System.Drawing
;
using
System.Linq
;
using
System.Text
;
using
System.Threading
;
using
System.Windows.Forms
;
namespace
ClientsLibrary
{
/// <summary>
/// 头像管理类
/// </summary>
public
class
UserPortrait
{
public
UserPortrait
(
string
filePath
,
Action
<
string
>
loadPic
)
{
if
(!
System
.
IO
.
Directory
.
Exists
(
filePath
))
{
System
.
IO
.
Directory
.
CreateDirectory
(
filePath
);
}
FileSavePath
=
filePath
;
LoadPic
=
loadPic
;
}
private
string
FileSavePath
{
get
;
set
;
}
private
Action
<
string
>
LoadPic
=
null
;
public
void
ChangePortrait
()
{
using
(
FormPortraitSelect
fps
=
new
FormPortraitSelect
())
{
if
(
fps
.
ShowDialog
()
==
DialogResult
.
OK
)
{
string
path300
=
FileSavePath
+
@"\"
+
PortraitSupport
.
LargePortrait
;
string
path32
=
FileSavePath
+
@"\"
+
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
();
}
}
}
public
void
DownloadUserPortraint
()
{
string
path
=
FileSavePath
;
//获取服务器文件名称
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
)
{
//加载本地头像
LoadPic
?.
Invoke
(
fileName
);
}
else
{
//头像已经换了
DownloadUserPortraint
(
path
);
}
}
else
{
//客户端不存在头像
DownloadUserPortraint
(
path
);
}
}
else
{
//服务器不存在头像,本次加载结束
}
}
}
public
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
);
LoadPic
?.
Invoke
(
path32
);
}
}
}
public
void
ThreadPoolDownloadSizeLarge
()
{
string
path
=
FileSavePath
;
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
);
}
}
}
软件系统客户端Wpf/MainWindow.xaml
浏览文件 @
f5b50de0
...
...
@@ -6,7 +6,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:软件系统客户端Wpf"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525" WindowState="Maximized">
Title="MainWindow" Height="350" Width="525" WindowState="Maximized" Activated="Window_Activated" Closing="Window_Closing" ContentRendered="Window_ContentRendered" Initialized="Window_Initialized"
Loaded="Window_Loaded">
<Window.Resources>
<ResourceDictionary>
...
...
@@ -26,6 +27,7 @@
</Window.Resources>
<Grid>
<DockPanel>
<!--菜单项目-->
<Menu IsMainMenu="True" DockPanel.Dock="Top">
<MenuItem Header="_管理员">
<MenuItem.Icon>
...
...
@@ -116,6 +118,52 @@
</MenuItem>
</MenuItem>
</Menu>
<!--底部状态栏以及公告-->
<Grid DockPanel.Dock="Bottom" Background="WhiteSmoke">
<Grid Margin="2">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal">
<TextBlock x:Name="TextBlock_CopyRight" Foreground="Gray">本软件著作权归某某所有</TextBlock>
<TextBlock Margin="20,0,0,0">版本号:</TextBlock>
<TextBlock x:Name="TextBlock_Version">1.0.0</TextBlock>
<TextBlock Margin="20,0,0,0">客户端状态:</TextBlock>
<TextBlock x:Name="TextBlock_ClientStatus">正在连接服务器...</TextBlock>
<TextBlock Margin="20,0,0,0" Foreground="Blue">温馨提示:</TextBlock>
<TextBlock x:Name="TextBlock_Information" Foreground="Blue"></TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal">
<TextBlock>时间:</TextBlock>
<TextBlock x:Name="TextBlock_ServerTime">0000-00-00 00:00:00</TextBlock>
<TextBlock Margin="20,0,0,0">延迟:</TextBlock>
<TextBlock x:Name="TextBlock_ServerDelay">0</TextBlock>
<TextBlock>ms</TextBlock>
</StackPanel>
</Grid>
</Grid>
</Grid>
<Grid Width="100" DockPanel.Dock="Left">
<Border BorderThickness="0,1,1,1" BorderBrush="LightGray">
</Border>
</Grid>
<Grid DockPanel.Dock="Right">
</Grid>
<Grid>
</Grid>
</DockPanel>
<materialDesign:Snackbar MessageQueue="{materialDesign:MessageQueue}"
x:Name="SoftSnackbar" />
</Grid>
</Window>
软件系统客户端Wpf/MainWindow.xaml.cs
浏览文件 @
f5b50de0
...
...
@@ -18,6 +18,7 @@ using System.Windows.Media.Imaging;
using
System.Windows.Navigation
;
using
System.Windows.Shapes
;
using
ClientsLibrary
;
using
System.Threading
;
namespace
软件系统客户端
Wpf
{
...
...
@@ -61,6 +62,113 @@ namespace 软件系统客户端Wpf
}
#
region
窗口相关方法
/// <summary>
/// 指示窗口是否显示的标志
/// </summary>
private
bool
IsWindowShow
{
get
;
set
;
}
=
false
;
private
void
Window_Activated
(
object
sender
,
EventArgs
e
)
{
//窗口激活就触发,不应把初始代码放这里
}
private
void
Window_Closing
(
object
sender
,
System
.
ComponentModel
.
CancelEventArgs
e
)
{
IsWindowShow
=
false
;
//通知服务器退出网络服务
net_socket_client
.
ClientClose
();
//等待一秒退出
using
(
FormWaitInfomation
fwm
=
new
FormWaitInfomation
(
"正在退出程序..."
,
1000
))
{
fwm
.
ShowDialog
();
}
}
private
void
Window_ContentRendered
(
object
sender
,
EventArgs
e
)
{
//窗口呈现完成触发,已经显示了
//窗口显示
IsWindowShow
=
true
;
//udp测试
//SendServerUdpData(0, "显示了窗体");
//是否显示更新日志,显示前进行判断该版本是否已经显示过了
if
(
UserClient
.
JsonSettings
.
IsNewVersionRunning
)
{
UserClient
.
JsonSettings
.
IsNewVersionRunning
=
false
;
UserClient
.
JsonSettings
.
SaveToFile
();
MenuItem
更新日志
_Click
(
null
,
new
RoutedEventArgs
());
}
//根据权限使能菜单
if
(
UserClient
.
UserAccount
.
Grade
<
AccountGrade
.
SuperAdministrator
)
{
MenuItem
日志查看
.
IsEnabled
=
false
;
MenuItem
账户管理
.
IsEnabled
=
false
;
MenuItem
远程更新
.
IsEnabled
=
false
;
MenuItem
注册账户
.
IsEnabled
=
false
;
MenuItem
消息发送
.
IsEnabled
=
false
;
MenuItem
开发中心
.
IsEnabled
=
false
;
}
//启动网络服务
Net_Socket_Client_Initialization
();
//启动定时器
TimeTickInitilization
();
//显示头像
//DownloadUserPortraint();
}
private
void
Window_Initialized
(
object
sender
,
EventArgs
e
)
{
//在窗口实例化之后触发
}
private
void
Window_Loaded
(
object
sender
,
RoutedEventArgs
e
)
{
//在窗体加载时触发,窗体还不显示任何东西
//窗口载入
//label_userName.Text = UserClient.UserAccount.UserName;
//label_grade.Text = AccountGrade.GetDescription(UserClient.UserAccount.Grade);
//label_factory.Text = UserClient.UserAccount.Factory;
//label_register.Text = UserClient.UserAccount.RegisterTime.ToString();
//label_last.Text = UserClient.UserAccount.LastLoginTime.ToString();
//label_times.Text = UserClient.UserAccount.LoginFrequency.ToString();
//label_address.Text = UserClient.UserAccount.LastLoginIpAddress;
//状态栏设置
TextBlock_CopyRight
.
Text
=
$"本软件著作权归
{
Resource
.
StringResouce
.
SoftCopyRight
}
所有"
;
//绑定事件,仅执行一次,不能放到show方法里
net_socket_client
.
MessageAlerts
+=
Net_socket_client_MessageAlerts
;
net_socket_client
.
LoginFailed
+=
Net_socket_client_LoginFailed
;
net_socket_client
.
LoginSuccess
+=
Net_socket_client_LoginSuccess
;
net_socket_client
.
AcceptByte
+=
Net_socket_client_AcceptByte
;
net_socket_client
.
AcceptString
+=
Net_socket_client_AcceptString
;
//label_Announcement.Text = UserClient.Announcement;
TextBlock_Version
.
Text
=
UserClient
.
CurrentVersion
.
ToString
();
//初始化窗口
//MainRenderInitialization();
}
private
void
AddStringRenderShow
(
string
str
)
{
var
messageQueue
=
SoftSnackbar
.
MessageQueue
;
//the message queue can be called from any thread
Task
.
Factory
.
StartNew
(()
=>
SoftSnackbar
.
MessageQueue
.
Enqueue
(
str
));
}
#
endregion
#
region
菜单逻辑块
...
...
@@ -87,25 +195,28 @@ namespace 软件系统客户端Wpf
private
void
MenuItem
注册账户
_Click
(
object
sender
,
RoutedEventArgs
e
)
{
//
using (FormRegisterAccount fra = new FormRegisterAccount())
//
{
//
fra.ShowDialog();
//
}
using
(
FormRegisterAccount
fra
=
new
FormRegisterAccount
())
{
fra
.
ShowDialog
();
}
}
private
void
MenuItem
日志查看
_Click
(
object
sender
,
RoutedEventArgs
e
)
{
using
(
FormLog
flg
=
new
FormLog
())
{
flg
.
ShowDialog
();
}
}
private
void
MenuItem
远程更新
_Click
(
object
sender
,
RoutedEventArgs
e
)
{
if
(
UserClient
.
UserAccount
.
UserName
==
"admin"
)
{
//
using (FormUpdateRemote fur = new FormUpdateRemote())
//
{
//
fur.ShowDialog();
//
}
using
(
FormUpdateRemote
fur
=
new
FormUpdateRemote
())
{
fur
.
ShowDialog
();
}
}
else
{
...
...
@@ -165,9 +276,14 @@ namespace 软件系统客户端Wpf
}
}
private
int
index
=
1
;
private
void
MenuItem
聊天信息
_Click
(
object
sender
,
RoutedEventArgs
e
)
{
var
messageQueue
=
SoftSnackbar
.
MessageQueue
;
var
message
=
"这是一条测试数据这是一条测试数据这是一条测试数据这是一条测试数据这是一条测试数据"
+
index
++;
//the message queue can be called from any thread
Task
.
Factory
.
StartNew
(()
=>
messageQueue
.
Enqueue
(
message
));
}
private
void
MenuItem
头像更改
_Click
(
object
sender
,
RoutedEventArgs
e
)
...
...
@@ -186,12 +302,24 @@ namespace 软件系统客户端Wpf
private
void
MenuItem
更新日志
_Click
(
object
sender
,
RoutedEventArgs
e
)
{
//更新情况复位
if
(
UserClient
.
JsonSettings
.
IsNewVersionRunning
)
{
UserClient
.
JsonSettings
.
IsNewVersionRunning
=
false
;
UserClient
.
JsonSettings
.
SaveToFile
();
}
using
(
FormUpdateLog
ful
=
new
FormUpdateLog
(
UserClient
.
HistoryVersions
))
{
ful
.
ShowDialog
();
}
}
private
void
MenuItem
版本号说明
_Click
(
object
sender
,
RoutedEventArgs
e
)
{
using
(
FormAboutVersion
fav
=
new
FormAboutVersion
(
UserClient
.
CurrentVersion
))
{
fav
.
ShowDialog
();
}
}
private
void
MenuItem
意见反馈
_Click
(
object
sender
,
RoutedEventArgs
e
)
...
...
@@ -237,7 +365,7 @@ namespace 软件系统客户端Wpf
{
if
(
customer
==
CommonHeadCode
.
MultiNetHeadCode
.
弹窗新消息
)
{
Dispatcher
.
Invoke
(
new
Action
(()
=>
if
(
IsWindowShow
)
Dispatcher
.
Invoke
(
new
Action
(()
=>
{
FormPopup
fpp
=
new
FormPopup
(
data
,
System
.
Drawing
.
Color
.
DodgerBlue
,
10000
);
fpp
.
Show
();
...
...
@@ -245,14 +373,14 @@ namespace 软件系统客户端Wpf
}
else
if
(
customer
==
CommonHeadCode
.
MultiNetHeadCode
.
总在线信息
)
{
Dispatcher
.
Invoke
(
new
Action
(()
=>
if
(
IsWindowShow
)
Dispatcher
.
Invoke
(
new
Action
(()
=>
{
//listBox1.DataSource = data.Split('#');
}));
}
else
if
(
customer
==
CommonHeadCode
.
MultiNetHeadCode
.
关闭客户端
)
{
Dispatcher
.
Invoke
(
new
Action
(()
=>
if
(
IsWindowShow
)
Dispatcher
.
Invoke
(
new
Action
(()
=>
{
Close
();
}));
...
...
@@ -260,7 +388,7 @@ namespace 软件系统客户端Wpf
else
if
(
customer
==
CommonHeadCode
.
SimplifyHeadCode
.
更新公告
)
{
//此处应用到了同步类的指令头
Dispatcher
.
Invoke
(
new
Action
(()
=>
if
(
IsWindowShow
)
Dispatcher
.
Invoke
(
new
Action
(()
=>
{
UserClient
.
Announcement
=
data
;
//label_Announcement.Text = data;
...
...
@@ -276,23 +404,23 @@ namespace 软件系统客户端Wpf
List
<
string
>
chats
=
JArray
.
Parse
(
json
[
"chats"
].
ToString
()).
ToObject
<
List
<
string
>>();
StringBuilder
sb
=
new
StringBuilder
();
chats
.
ForEach
(
m
=>
{
sb
.
Append
(
m
+
Environment
.
NewLine
);
});
Dispatcher
.
Invoke
(
new
Action
(()
=>
if
(
IsWindowShow
)
Dispatcher
.
Invoke
(
new
Action
(()
=>
{
//toolStripStatusLabel_time.Text = UserClient.DateTimeServer.ToString("yyyy-MM-dd HH:mm
");
TextBlock_ServerTime
.
Text
=
UserClient
.
DateTimeServer
.
ToString
(
"yyyy-MM-dd HH:mm:ss
"
);
//label_file_count.Text = json["FileCount"].ToObject<int>().ToString();
//UIControls_Chat.AddChatsHistory(sb.ToString());
}));
}
else
if
(
customer
==
CommonHeadCode
.
MultiNetHeadCode
.
文件总数量
)
{
Dispatcher
.
Invoke
(
new
Action
(()
=>
if
(
IsWindowShow
)
Dispatcher
.
Invoke
(
new
Action
(()
=>
{
//label_file_count.Text = data;
}));
}
else
if
(
customer
==
CommonHeadCode
.
MultiNetHeadCode
.
留言版消息
)
{
Dispatcher
.
Invoke
(
new
Action
(()
=>
if
(
IsWindowShow
)
Dispatcher
.
Invoke
(
new
Action
(()
=>
{
//UIControls_Chat?.DealwithReceive(data);
}));
...
...
@@ -302,7 +430,7 @@ namespace 软件系统客户端Wpf
private
void
Net_socket_client_AcceptByte
(
AsyncStateOne
object1
,
int
customer
,
byte
[]
object2
)
{
//接收到服务器发来的字节数据
Dispatcher
.
Invoke
(
new
Action
(()
=>
if
(
IsWindowShow
)
Dispatcher
.
Invoke
(
new
Action
(()
=>
{
MessageBox
.
Show
(
customer
.
ToString
());
}));
...
...
@@ -311,9 +439,9 @@ namespace 软件系统客户端Wpf
private
void
Net_socket_client_LoginSuccess
()
{
//登录成功,或重新登录成功的事件,有些数据的初始化可以放在此处
Dispatcher
.
Invoke
(
new
Action
(()
=>
if
(
IsWindowShow
)
Dispatcher
.
Invoke
(
new
Action
(()
=>
{
//toolStripStatusLabel_s
tatus.Text = "客户端启动成功";
TextBlock_ClientS
tatus
.
Text
=
"客户端启动成功"
;
}));
}
...
...
@@ -322,7 +450,7 @@ namespace 软件系统客户端Wpf
//登录失败的情况,如果连续三次连接失败,请考虑退出系统
if
(
object1
>
3
)
{
Dispatcher
.
Invoke
(
new
Action
(()
=>
if
(
IsWindowShow
)
Dispatcher
.
Invoke
(
new
Action
(()
=>
{
Close
();
}));
...
...
@@ -332,9 +460,9 @@ namespace 软件系统客户端Wpf
private
void
Net_socket_client_MessageAlerts
(
string
object1
)
{
//信息提示
Dispatcher
.
Invoke
(
new
Action
(()
=>
if
(
IsWindowShow
)
Dispatcher
.
Invoke
(
new
Action
(()
=>
{
//toolStripStatusLabel_s
tatus.Text = object1;
TextBlock_ClientS
tatus
.
Text
=
object1
;
}));
}
...
...
@@ -347,8 +475,96 @@ namespace 软件系统客户端Wpf
#
endregion
#
region
后台计数线程
/*********************************************************************************************
*
* 说明 一个后台线程,用来执行一些周期执行的东西
* 注意 它不仅执行每秒触发的代码,也支持每分钟,每天,每月,每年等等
*
********************************************************************************************/
/// <summary>
/// 初始化后台的计数线程
/// </summary>
public
void
TimeTickInitilization
()
{
Thread
thread
=
new
Thread
(
new
ThreadStart
(
ThreadTimeTick
));
thread
.
IsBackground
=
true
;
thread
.
Start
();
}
public
void
ThreadTimeTick
()
{
Thread
.
Sleep
(
300
);
//加一个微小的延时
int
second
=
DateTime
.
Now
.
Second
-
1
;
int
minute
=
-
1
;
int
hour
=
-
1
;
int
day
=
-
1
;
Action
DTimeShow
=
delegate
{
//显示服务器的时间和当前网络的延时时间,通常为毫秒
TextBlock_ServerTime
.
Text
=
net_socket_client
.
ServerTime
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
);
TextBlock_ServerDelay
.
Text
=
net_socket_client
.
DelayTime
.
ToString
();
};
while
(
IsWindowShow
)
{
while
(
DateTime
.
Now
.
Second
==
second
)
{
Thread
.
Sleep
(
20
);
}
second
=
DateTime
.
Now
.
Second
;
if
(
IsWindowShow
)
Dispatcher
.
Invoke
(
DTimeShow
);
//每秒钟执行的代码
UserClient
.
DateTimeServer
=
net_socket_client
.
ServerTime
;
if
(
second
==
0
)
{
//每个0秒执行的代码
}
if
(
minute
!=
DateTime
.
Now
.
Minute
)
{
minute
=
DateTime
.
Now
.
Minute
;
//每分钟执行的代码
}
if
(
hour
!=
DateTime
.
Now
.
Hour
)
{
hour
=
DateTime
.
Now
.
Hour
;
//每小时执行的代码
}
if
(
day
!=
DateTime
.
Now
.
Day
)
{
day
=
DateTime
.
Now
.
Day
;
//每天执行的代码
}
}
}
#
endregion
#
region
Udp
发送示例
/// <summary>
/// 调用该方法并指定参数即可,最长字符串不得
/// </summary>
/// <param name="data"></param>
private
void
SendServerUdpData
(
int
customer
,
string
data
)
{
//测试发送udp消息
UserClient
.
Net_Udp_Client
.
SendMessage
(
customer
,
data
);
}
#
endregion
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录