网络组件代码重构,文件传输标准重写,完成winform适配。其他待完成

This commit is contained in:
dathlin
2017-09-13 21:08:18 +08:00
parent 38e7700c5b
commit 8e2e3c8562
9 changed files with 653 additions and 194 deletions

View File

@@ -13,6 +13,7 @@ using HslCommunication;
using HslCommunication.Enthernet;
using HslCommunication.BasicFramework;
using ClientsLibrary;
using HslCommunication.LogNet;
/***************************************************************************************
@@ -46,6 +47,9 @@ namespace 软件系统客户端模版
public FormMainWindow()
{
InitializeComponent();
// 处理异常
UserClient.LogNet = new LogNetDateTime(Application.StartupPath + @"\Logs", GenerateMode.ByEveryDay);
}
#region
@@ -661,7 +665,6 @@ namespace 软件系统客户端模版
#endregion
}
}

View File

@@ -20,23 +20,23 @@ namespace 软件系统客户端模版
[STAThread]
static void Main()
{
//捕获未处理的异常
// 捕获未处理的异常
AppDomain.CurrentDomain.UnhandledException += ClientsLibrary.UserClient.CurrentDomain_UnhandledException;
//=====================================================================
//为了强制只启动一个应用程序的实例
// 为了强制只启动一个应用程序的实例
Process process = Process.GetCurrentProcess();
//遍历应用程序的同名进程组
// 遍历应用程序的同名进程组
foreach (Process p in Process.GetProcessesByName(process.ProcessName))
{
//不是同一进程则关闭刚刚创建的进程
// 不是同一进程则关闭刚刚创建的进程
if (p.Id != process.Id)
{
//此处显示原先的窗口需要一定的时间,不然无法显示
// 此处显示原先的窗口需要一定的时间,不然无法显示
ShowWindowAsync(p.MainWindowHandle, 9);
SetForegroundWindow(p.MainWindowHandle);
System.Threading.Thread.Sleep(10);
Application.Exit();//关闭当前的应用程序
Application.Exit();// 关闭当前的应用程序
return;
}
}
@@ -44,7 +44,7 @@ namespace 软件系统客户端模版
Application.SetCompatibleTextRenderingDefault(false);
//===================================================================
//运行主窗口之前先进行账户的验证
// 运行主窗口之前先进行账户的验证
P1:
FormLogin login = new FormLogin();
@@ -55,7 +55,7 @@ namespace 软件系统客户端模版
Application.Run(fmw);
if (QuitCode == 1)
{
//继续显示登录窗口
// 继续显示登录窗口
QuitCode = 0;
goto P1;
}

View File

@@ -33,6 +33,8 @@ namespace 软件系统客户端模版.UIControls
}
using (FormSimplyFileUpload upload = new FormSimplyFileUpload(
CommonHeadCode.KeyToken,
UserClient.LogNet,
UserClient.ServerIp,
CommonLibrary.CommonLibrary.Port_Share_File,
UserClient.UserAccount.UserName))
@@ -67,7 +69,9 @@ namespace 软件系统客户端模版.UIControls
//添加子控件
foreach(var m in files)
{
FileItemShow item = new FileItemShow(UserClient.ServerIp,
FileItemShow item = new FileItemShow(
CommonHeadCode.KeyToken,
UserClient.LogNet, UserClient.ServerIp,
CommonLibrary.CommonLibrary.Port_Share_File,
() =>
{