diff --git a/HKCardIN/HKCardIN.csproj b/HKCardIN/HKCardIN.csproj
index b789c4e..11d37fb 100644
--- a/HKCardIN/HKCardIN.csproj
+++ b/HKCardIN/HKCardIN.csproj
@@ -20,12 +20,19 @@
+
+
+
+
+
+
+
diff --git a/HKCardIN/HKResouces/背景.jpg b/HKCardIN/HKResouces/背景.jpg
new file mode 100644
index 0000000..79dfc04
Binary files /dev/null and b/HKCardIN/HKResouces/背景.jpg differ
diff --git a/HKCardIN/Helper/DataBus.cs b/HKCardIN/Helper/DataBus.cs
new file mode 100644
index 0000000..5870fcb
--- /dev/null
+++ b/HKCardIN/Helper/DataBus.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace HKCardIN.Helper
+{
+ public class DataBus
+ {
+ public static bool NetWordState { get; set; } = false;
+ }
+}
diff --git a/HKCardIN/Helper/HKHelper.cs b/HKCardIN/Helper/HKHelper.cs
new file mode 100644
index 0000000..ceb98bf
--- /dev/null
+++ b/HKCardIN/Helper/HKHelper.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace HKCardIN.Helper
+{
+ public class HKHelper: Singleton
+ {
+ ///
+ /// 判断网络状况的方法,返回值true为连接,false为未连接
+ ///
+ ///
+ ///
+ ///
+ [DllImport("wininet")]
+ public extern static bool InternetGetConnectedState(out int conState, int reder);
+ ///
+ /// 获取当前网络连接状态
+ ///
+ /// 成功连接网络返回 true,未连接返回 false
+ public bool GetNetworkState()
+ {
+ return InternetGetConnectedState(out int i, 0);
+ }
+
+ }
+ }
diff --git a/HKCardIN/Helper/ThreadManage.cs b/HKCardIN/Helper/ThreadManage.cs
new file mode 100644
index 0000000..c389a3f
--- /dev/null
+++ b/HKCardIN/Helper/ThreadManage.cs
@@ -0,0 +1,445 @@
+using System;
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace HKCardIN.Helper
+{
+ public class Singleton where T : new()
+ {
+ private static object _async = new object();
+
+ private static T _instance;
+
+ static readonly Lazy instance = new();
+ ///
+ /// 获取实例
+ ///
+ ///
+ public static T GetInstance()
+ {
+ return instance.Value;
+ }
+ }
+ public class ThreadManage : Singleton
+ {
+ string guid = "871d7e28-c413-4675-8d28-64e4dca4c2d3-";
+ private static readonly object _lock = new object();
+ StringBuilder callbackKey = new StringBuilder();
+ List keys = new List();
+ ConcurrentDictionary Threads = new ConcurrentDictionary();
+ ConcurrentDictionary CancellationTokenSources = new ConcurrentDictionary();
+
+ ///
+ /// 停止指定任务
+ ///
+ /// 任务名
+ /// 任务结束的回调
+ public void StopTask(string key, Action ExitCallback = null)
+ {
+ if (CancellationTokenSources.ContainsKey(guid + key))
+ {
+ CancellationTokenSources[guid + key]?.Cancel();
+ ActionManage.GetInstance.Register(ExitCallback, guid + key);
+ }
+ else
+ {
+ if (ExitCallback != null) ExitCallback();
+ }
+ }
+
+ ///
+ /// 长任务,带 while true 的循环
+ ///
+ ///
+ ///
+ public void StartLong(Action action, string key, bool IsRestart = false, Action RunComplete = null)
+ {
+ CancellationTokenSources.TryAdd(guid + key, new CancellationTokenSource());
+ bool result = Threads.TryAdd(guid + key, Task.Factory.StartNew(new Action(() =>
+ {
+ Thread.CurrentThread.Name = key;
+ ReStart:
+ try
+ {
+ while (!CancellationTokenSources[guid + key].IsCancellationRequested)
+ {
+ if (action != null) action();
+ }
+ }
+ catch (Exception ex)
+ {
+ if (IsRestart)
+ {
+ Thread.Sleep(2000);
+ goto ReStart;
+ }
+ else
+ {
+ CancellationTokenSources.TryRemove(guid + key, out CancellationTokenSource temp);
+ Threads.TryRemove(guid + key, out Task temp1);
+ }
+ }
+ }), CancellationTokenSources[guid + key].Token).ContinueWith(new Action((t, o) =>
+ {
+ ThreadStatus(t, o.ToString());
+ if (RunComplete != null) RunComplete();
+ }), guid + key));
+ }
+
+
+ ///
+ /// 不带 while true 的循环任务
+ ///
+ ///
+ ///
+ public void Start(Action action, string key, bool isRestart = false)
+ {
+ CancellationTokenSources.TryAdd(guid + key, new CancellationTokenSource());
+ bool result = Threads.TryAdd(guid + key, Task.Factory.StartNew(new Action(() =>
+ {
+ Thread.CurrentThread.Name = key;
+ try
+ {
+ if (action != null) action();
+ }
+ catch (Exception ex)
+ {
+ if (isRestart)
+ {
+ CancellationTokenSources.TryRemove(guid + key, out CancellationTokenSource item1);
+ Threads.TryRemove(guid + key, out Task item2);
+ Start(action, key, isRestart);
+ }
+ else
+ {
+ }
+ }
+ }), CancellationTokenSources[guid + key].Token).ContinueWith(new Action((t, o) =>
+ {
+ ThreadStatus(t, o.ToString());
+ }), guid + key));
+ }
+
+ private void ThreadStatus(Task task, string key)
+ {
+ bool IsRemove = false;
+ string name = key.Substring(key.LastIndexOf('-') + 1);
+ switch (task.Status)
+ {
+ case TaskStatus.RanToCompletion:
+ IsRemove = true;
+ break;
+ case TaskStatus.Faulted:
+ IsRemove = true;
+ break;
+ case TaskStatus.Canceled:
+ IsRemove = true;
+ break;
+ default:
+ break;
+ }
+
+ if (IsRemove)
+ {
+ if (Threads.ContainsKey(key))
+ Threads.TryRemove(key, out Task t);
+ if (CancellationTokenSources.ContainsKey(key))
+ CancellationTokenSources.TryRemove(key, out CancellationTokenSource cts);
+ ActionManage.GetInstance.Send(key);
+ }
+ }
+
+ ///
+ /// 释放所有线程资源
+ ///
+ public void Dispose()
+ {
+ for (int i = 0; i < CancellationTokenSources.Count; i++)
+ {
+ CancellationTokenSources.ElementAt(i).Value.Cancel();
+ }
+ }
+
+ ///
+ /// 判断指定线程是否完成
+ ///
+ ///
+ ///
+ public bool IsComplete(string key)
+ {
+ if (Threads.ContainsKey(guid + key)) return Threads[guid + key].IsCompleted;
+ return false;
+ }
+
+ }
+ internal class Delegation
+ {
+ ///
+ /// 带参数的委托
+ ///
+ public Action