暂时调试成功,等待进一步优化【waitting for update later】

This commit is contained in:
dathlin
2017-05-04 15:27:14 +08:00
parent f8c17d882e
commit 9b3114f7ea
6 changed files with 82 additions and 62 deletions

Binary file not shown.

View File

@@ -1,7 +1,9 @@
 
##########################################################################
# /***************************************************************************
# 本文件夹下应放置一些数据库相关的类 *
# 主要用来支持数据访问 * 本文件夹下应放置一些数据库相关的类
# *
############################################################################ * 主要用来支持数据访问,与数据库进行交互
*
****************************************************************************/

View File

@@ -1,4 +1,6 @@
namespace using HslCommunication.Controls;
namespace
{ {
partial class FormLog partial class FormLog
{ {
@@ -29,12 +31,12 @@
private void InitializeComponent() private void InitializeComponent()
{ {
this.textBox1 = new System.Windows.Forms.TextBox(); this.textBox1 = new System.Windows.Forms.TextBox();
this.userButton_login = new BasicFramework.UserButton(); this.userButton_login = new UserButton();
this.userButton1 = new BasicFramework.UserButton(); this.userButton1 = new UserButton();
this.userButton2 = new BasicFramework.UserButton(); this.userButton2 = new UserButton();
this.userButton3 = new BasicFramework.UserButton(); this.userButton3 = new UserButton();
this.userButton4 = new BasicFramework.UserButton(); this.userButton4 = new UserButton();
this.userButton5 = new BasicFramework.UserButton(); this.userButton5 = new UserButton();
this.SuspendLayout(); this.SuspendLayout();
// //
// textBox1 // textBox1
@@ -165,11 +167,11 @@
#endregion #endregion
private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.TextBox textBox1;
private BasicFramework.UserButton userButton_login; private UserButton userButton_login;
private BasicFramework.UserButton userButton1; private UserButton userButton1;
private BasicFramework.UserButton userButton2; private UserButton userButton2;
private BasicFramework.UserButton userButton3; private UserButton userButton3;
private BasicFramework.UserButton userButton4; private UserButton userButton4;
private BasicFramework.UserButton userButton5; private UserButton userButton5;
} }
} }

View File

@@ -6,12 +6,12 @@ using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using BasicFramework;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using CommonLibrary; using CommonLibrary;
using System.Threading; using System.Threading;
using HslCommunication; using HslCommunication;
using HslCommunication.Enthernet; using HslCommunication.Enthernet;
using HslCommunication.BasicFramework;
//============================================================================ //============================================================================
@@ -92,7 +92,7 @@ namespace 软件系统客户端模版
if(UserClient.JsonSettings.IsNewVersionRunning) if(UserClient.JsonSettings.IsNewVersionRunning)
{ {
UserClient.JsonSettings.IsNewVersionRunning = false; UserClient.JsonSettings.IsNewVersionRunning = false;
UserClient.JsonSettings.SaveSettings(); UserClient.JsonSettings.SaveToFile();
ToolStripMenuItem_Click(null, new EventArgs()); ToolStripMenuItem_Click(null, new EventArgs());
} }
@@ -149,7 +149,7 @@ namespace 软件系统客户端模版
if (UserClient.JsonSettings.IsNewVersionRunning) if (UserClient.JsonSettings.IsNewVersionRunning)
{ {
UserClient.JsonSettings.IsNewVersionRunning = false; UserClient.JsonSettings.IsNewVersionRunning = false;
UserClient.JsonSettings.SaveSettings(); UserClient.JsonSettings.SaveToFile();
} }
FormUpdateLog ful = new FormUpdateLog(UserClient.HistoryVersions); FormUpdateLog ful = new FormUpdateLog(UserClient.HistoryVersions);
ful.ShowDialog(); ful.ShowDialog();

View File

@@ -1,4 +1,6 @@
namespace .UIControls using HslCommunication.Controls;
namespace .UIControls
{ {
partial class ShareFilesRender partial class ShareFilesRender
{ {
@@ -31,8 +33,8 @@
this.panel1 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel();
this.textBox1 = new System.Windows.Forms.TextBox(); this.textBox1 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.userButton_refresh = new BasicFramework.UserButton(); this.userButton_refresh = new UserButton();
this.userButton_upload = new BasicFramework.UserButton(); this.userButton_upload = new UserButton();
this.panel2 = new System.Windows.Forms.Panel(); this.panel2 = new System.Windows.Forms.Panel();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
@@ -134,7 +136,7 @@
private System.Windows.Forms.Panel panel2; private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private BasicFramework.UserButton userButton_refresh; private UserButton userButton_refresh;
private BasicFramework.UserButton userButton_upload; private UserButton userButton_upload;
} }
} }

View File

@@ -64,6 +64,11 @@ namespace 软件系统服务端模版
private void Form1_Load(object sender, EventArgs e) private void Form1_Load(object sender, EventArgs e)
{ {
//初始化日志工具
LogHelper = new SoftLogHelper()
{
LogSaveFileName = Application.StartupPath + @"\log.txt",
};
//保存路径初始化 //保存路径初始化
UserServer.ServerSettings.FileSavePath = Application.StartupPath + @"\settings.txt"; UserServer.ServerSettings.FileSavePath = Application.StartupPath + @"\settings.txt";
//加载参数 //加载参数
@@ -73,22 +78,24 @@ namespace 软件系统服务端模版
//加载账户信息 //加载账户信息
UserServer.ServerAccounts.FileSavePath = Application.StartupPath + @"\accounts.txt"; UserServer.ServerAccounts.FileSavePath = Application.StartupPath + @"\accounts.txt";
UserServer.ServerAccounts.LoadByFile(); UserServer.ServerAccounts.LoadByFile();
UserServer.ServerAccounts.LogHelper = LogHelper;
} }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{ {
//密码验证的示例,此处关闭窗口验证 //密码验证的示例,此处关闭窗口验证
FormPasswordCheck fpc = new FormPasswordCheck("123456"); using (FormPasswordCheck fpc = new FormPasswordCheck("123456"))
if (fpc.ShowDialog() == DialogResult.OK)
{ {
IsWindowShow = false; if (fpc.ShowDialog() == DialogResult.OK)
Thread.Sleep(20); {
IsWindowShow = false;
Thread.Sleep(20);
}
else
{
//取消关闭
e.Cancel = true;
}
} }
else
{
//取消关闭
e.Cancel = true;
}
//紧急数据的保存已经放置到dispose方法中即时发生BUG或直接关机也能存储数据 //紧急数据的保存已经放置到dispose方法中即时发生BUG或直接关机也能存储数据
} }
private void Form1_Shown(object sender, EventArgs e) private void Form1_Shown(object sender, EventArgs e)
@@ -122,18 +129,20 @@ namespace 软件系统服务端模版
private void ToolStripMenuItem_Click(object sender, EventArgs e) private void ToolStripMenuItem_Click(object sender, EventArgs e)
{ {
FormVersionControl fvc = new FormVersionControl(UserServer.ServerSettings); using (FormVersionControl fvc = new FormVersionControl(UserServer.ServerSettings))
fvc.ShowDialog(); {
fvc.Dispose(); fvc.ShowDialog();
toolStripStatusLabel_version.Text = UserServer.ServerSettings.SystemVersion.ToString(); toolStripStatusLabel_version.Text = UserServer.ServerSettings.SystemVersion.ToString();
}
} }
private void ToolStripMenuItem_Click(object sender, EventArgs e) private void ToolStripMenuItem_Click(object sender, EventArgs e)
{ {
FormMaintenance fm = new FormMaintenance(UserServer.ServerSettings); using (FormMaintenance fm = new FormMaintenance(UserServer.ServerSettings))
fm.ShowDialog(); {
fm.Dispose(); fm.ShowDialog();
MaintenanceInitialization(); MaintenanceInitialization();
}
} }
@@ -142,12 +151,14 @@ namespace 软件系统服务端模版
//测试发送字节数据 //测试发送字节数据
//net_socket_server.SendAllClients(BitConverter.GetBytes(12345678)); //net_socket_server.SendAllClients(BitConverter.GetBytes(12345678));
//将消息群发给所有的客户端,并使用消息弹窗的方式显示 //将消息群发给所有的客户端,并使用消息弹窗的方式显示
FormInputAndAction fiaa = new FormInputAndAction(m => using (FormInputAndAction fiaa = new FormInputAndAction(
m =>
{
net_socket_server.SendAllClients(CommonHeadCode.MultiNetHeadCode. + m); return true;
}))
{ {
net_socket_server.SendAllClients(CommonHeadCode.MultiNetHeadCode. + m); return true; fiaa.ShowDialog();
}); }
fiaa.ShowDialog();
fiaa.Dispose();
} }
private void ToolStripMenuItem_Click(object sender, EventArgs e) private void ToolStripMenuItem_Click(object sender, EventArgs e)
@@ -158,26 +169,29 @@ namespace 软件系统服务端模版
private void ToolStripMenuItem_Click(object sender, EventArgs e) private void ToolStripMenuItem_Click(object sender, EventArgs e)
{ {
FormAbout fm = new FormAbout( using (FormAbout fm = new FormAbout(
Resource.StringResouce.SoftName, UserServer.ServerSettings.SystemVersion, Resource.StringResouce.SoftName, UserServer.ServerSettings.SystemVersion,
2017, Resource.StringResouce.SoftCopyRight); 2017, Resource.StringResouce.SoftCopyRight))
fm.ShowDialog(); {
fm.Dispose(); fm.ShowDialog();
}
} }
private void ToolStripMenuItem_Click(object sender, EventArgs e) private void ToolStripMenuItem_Click(object sender, EventArgs e)
{ {
//该部分比较复杂,需要对委托,匿名委托概念比较清晰 //该部分比较复杂,需要对委托,匿名委托概念比较清晰
FormAccountManage fam = new FormAccountManage(() => UserServer.ServerAccounts.GetAllAccountsJson(), using (FormAccountManage fam = new FormAccountManage(() => UserServer.ServerAccounts.GetAllAccountsJson(),
m => { UserServer.ServerAccounts.LoadAllAccountsJson(m); return true; }); m => { UserServer.ServerAccounts.LoadAllAccountsJson(m); return true; }))
fam.ShowDialog(); {
fam.Dispose(); fam.ShowDialog();
}
} }
private void ToolStripMenuItem_Click(object sender, EventArgs e) private void ToolStripMenuItem_Click(object sender, EventArgs e)
{ {
FormAboutVersion fav = new FormAboutVersion(UserServer.ServerSettings.SystemVersion); using (FormAboutVersion fav = new FormAboutVersion(UserServer.ServerSettings.SystemVersion))
fav.ShowDialog(); {
fav.Dispose(); fav.ShowDialog();
}
} }
private void MaintenanceInitialization() private void MaintenanceInitialization()
{ {
@@ -227,7 +241,7 @@ namespace 软件系统服务端模版
/// </summary> /// </summary>
private Net_File_Server net_file_update = new Net_File_Server(); private Net_File_Server net_file_update = new Net_File_Server();
/// <summary> /// <summary>
/// 软件异地更新的初始化,如不需要可以不启动,该功能需要稳定性测试 /// 软件异地更新的初始化,如不需要可以不启动,该功能支持发送客户端文件至服务器实现覆盖更新
/// </summary> /// </summary>
private void Net_File_Update_Initialization() private void Net_File_Update_Initialization()
{ {