组件更新,修复一个重连异常,修复客户端断线重连后在线情况显示BUG,v1.6.12

This commit is contained in:
dathlin
2017-10-14 13:13:02 +08:00
parent b636d6c4ec
commit d43866b443
7 changed files with 54 additions and 12 deletions

View File

@@ -28,8 +28,17 @@ namespace ClientsLibrary.BasicSupport
MyControls[i].Dispose(); MyControls[i].Dispose();
MyControls.RemoveAt(i); MyControls.RemoveAt(i);
} }
Location_Y = 0;
} }
/// <summary>
/// 清理掉所有的在线信息
/// </summary>
public void ClearOnlineClients()
{
ClearControls();
}
public void ClientOnline(NetAccount account) public void ClientOnline(NetAccount account)
{ {

View File

@@ -36,7 +36,7 @@ namespace ClientsLibrary
/// <summary> /// <summary>
/// 本软件的当前版本,用来验证更新的关键依据 /// 本软件的当前版本,用来验证更新的关键依据
/// </summary> /// </summary>
public static SystemVersion CurrentVersion { get; } = new SystemVersion("1.0.0.171011"); public static SystemVersion CurrentVersion { get; } = new SystemVersion("1.0.0.171013");
/// <summary> /// <summary>

View File

@@ -45,7 +45,7 @@ namespace CommonLibrary
* *
**************************************************************************/ **************************************************************************/
SoftBasic.FrameworkVersion = new SystemVersion("1.6.11"); SoftBasic.FrameworkVersion = new SystemVersion("1.6.12");
} }

Binary file not shown.

View File

@@ -2568,6 +2568,11 @@
服务器的异常,启动,等等一般消息产生的时候,出发此事件 服务器的异常,启动,等等一般消息产生的时候,出发此事件
</summary> </summary>
</member> </member>
<member name="E:HslCommunication.Enthernet.NetComplexClient.BeforReConnected">
<summary>
在客户端断开后并在重连服务器之前触发,用于清理系统资源
</summary>
</member>
<member name="E:HslCommunication.Enthernet.NetComplexClient.AcceptString"> <member name="E:HslCommunication.Enthernet.NetComplexClient.AcceptString">
<summary> <summary>
当接收到文本数据的时候,触发此事件 当接收到文本数据的时候,触发此事件

View File

@@ -23,7 +23,6 @@ using System.Threading;
using Wpf.Views; using Wpf.Views;
using System.Windows.Media.Animation; using System.Windows.Media.Animation;
using MaterialDesignThemes.Wpf; using MaterialDesignThemes.Wpf;
using CommonLibrary;
namespace Wpf namespace Wpf
{ {
@@ -55,7 +54,7 @@ namespace 软件系统客户端Wpf
/***************************************************************************************** /*****************************************************************************************
* *
* 权限说明 在进行特定权限操作的业务逻辑时,应该提炼成一个角色,这样可以动态绑定带有这些功能的账户 * 权限说明 在进行特定权限操作的业务逻辑时,应该提炼成一个角色,这样可以动态绑定带有这些功能的账户
* 示例 if (UserClient.CheckUserAccountRole("审计员")) { dosomething(); }// 获取了审计员的角色,名字此处示例 * 示例 if (UserClient.CheckUserAccountRole("[审计员的GUID码]")) { dosomething(); }// 获取了审计员的角色,名字此处示例
* *
******************************************************************************************/ ******************************************************************************************/
@@ -93,6 +92,7 @@ namespace 软件系统客户端Wpf
// 通知服务器退出网络服务 // 通知服务器退出网络服务
net_socket_client.ClientClose(); net_socket_client.ClientClose();
// 保存当前的颜色选择 // 保存当前的颜色选择
var p = new PaletteHelper().QueryPalette(); 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))
@@ -183,6 +183,7 @@ namespace 软件系统客户端Wpf
net_socket_client.LoginSuccess += Net_socket_client_LoginSuccess; net_socket_client.LoginSuccess += Net_socket_client_LoginSuccess;
net_socket_client.AcceptByte += Net_socket_client_AcceptByte; net_socket_client.AcceptByte += Net_socket_client_AcceptByte;
net_socket_client.AcceptString += Net_socket_client_AcceptString; net_socket_client.AcceptString += Net_socket_client_AcceptString;
net_socket_client.BeforReConnected += Net_socket_client_BeforReConnected;
TextBlock_Announcement.Text = UserClient.Announcement; TextBlock_Announcement.Text = UserClient.Announcement;
@@ -195,6 +196,8 @@ namespace 软件系统客户端Wpf
new PaletteHelper().SetLightDark(UserClient.JsonSettings.IsThemeDark); new PaletteHelper().SetLightDark(UserClient.JsonSettings.IsThemeDark);
} }
private void AddStringRenderShow(string str) private void AddStringRenderShow(string str)
{ {
var messageQueue = SoftSnackbar.MessageQueue; var messageQueue = SoftSnackbar.MessageQueue;
@@ -560,6 +563,8 @@ namespace 软件系统客户端Wpf
})); }));
} }
private void Net_socket_client_LoginSuccess() private void Net_socket_client_LoginSuccess()
{ {
// 登录成功,或重新登录成功的事件,有些数据的初始化可以放在此处 // 登录成功,或重新登录成功的事件,有些数据的初始化可以放在此处
@@ -569,6 +574,15 @@ namespace 软件系统客户端Wpf
})); }));
} }
private void Net_socket_client_BeforReConnected()
{
// 和服务器断开,重新连接之前发生的事件,清理已加载资源使用,比如客户端在线信息
if (IsWindowShow) Dispatcher.Invoke(new Action(() =>
{
ClientsOnline.Children?.Clear();
}));
}
private void Net_socket_client_LoginFailed(int object1) private void Net_socket_client_LoginFailed(int object1)
{ {
// 登录失败的情况,如果连续三次连接失败,请考虑退出系统 // 登录失败的情况,如果连续三次连接失败,请考虑退出系统

View File

@@ -93,6 +93,7 @@ namespace 软件系统客户端模版
net_socket_client.LoginSuccess += Net_socket_client_LoginSuccess; net_socket_client.LoginSuccess += Net_socket_client_LoginSuccess;
net_socket_client.AcceptByte += Net_socket_client_AcceptByte; net_socket_client.AcceptByte += Net_socket_client_AcceptByte;
net_socket_client.AcceptString += Net_socket_client_AcceptString; net_socket_client.AcceptString += Net_socket_client_AcceptString;
net_socket_client.BeforReConnected += Net_socket_client_BeforReConnected;
// 显示公告 // 显示公告
label_Announcement.Text = UserClient.Announcement; label_Announcement.Text = UserClient.Announcement;
@@ -102,6 +103,8 @@ namespace 软件系统客户端模版
//初始化窗口 //初始化窗口
MainRenderInitialization(); MainRenderInitialization();
} }
private void FormMainWindow_Shown(object sender, EventArgs e) private void FormMainWindow_Shown(object sender, EventArgs e)
{ {
// 窗口显示 // 窗口显示
@@ -490,6 +493,17 @@ namespace 软件系统客户端模版
})); }));
} }
private void Net_socket_client_BeforReConnected()
{
// 和服务器断开后,重新连接之前操作,清理在线信息
if (IsHandleCreated && IsWindowShow) Invoke(new Action(() =>
{
netClientOnline1.ClearOnlineClients();
}));
}
private void Net_socket_client_LoginFailed(int object1) private void Net_socket_client_LoginFailed(int object1)
{ {
// 登录失败的情况,如果连续三次连接失败,请考虑退出系统 // 登录失败的情况,如果连续三次连接失败,请考虑退出系统