diff --git a/SlnMesnac.WPF/App.xaml.cs b/SlnMesnac.WPF/App.xaml.cs
index 3eeba18..8009de6 100644
--- a/SlnMesnac.WPF/App.xaml.cs
+++ b/SlnMesnac.WPF/App.xaml.cs
@@ -96,19 +96,16 @@ namespace SlnMesnac.WPF
{
TcpClient tcpClient = new TcpClient();
- var hashcode = tcpClient.GetHashCode();
-
tcpClient.Setup(new TouchSocketConfig()
.SetRemoteIPHost($"{item.equipIp}:{item.equipPort}"));
+ item.session = tcpClient;
+ //tcpClient.Connect();
- tcpClient.Connect();
-
- Result result = tcpClient.TryConnect();
- if (result.IsSuccess())
- {
- item.session = tcpClient;
- }
- var hashcode2 = tcpClient.GetHashCode();
+ //Result result = tcpClient.TryConnect();
+ //if (result.IsSuccess())
+ //{
+ // item.session = tcpClient;
+ //}
}
}
diff --git a/SlnMesnac.WPF/MainWindow.xaml b/SlnMesnac.WPF/MainWindow.xaml
index ea0ada2..d567c7c 100644
--- a/SlnMesnac.WPF/MainWindow.xaml
+++ b/SlnMesnac.WPF/MainWindow.xaml
@@ -25,12 +25,12 @@
-
+
-
+
diff --git a/SlnMesnac.WPF/Page/ProductDetails/ProductDetailsControl.xaml b/SlnMesnac.WPF/Page/ProductDetails/ProductDetailsControl.xaml
index 5ef33ba..52d3457 100644
--- a/SlnMesnac.WPF/Page/ProductDetails/ProductDetailsControl.xaml
+++ b/SlnMesnac.WPF/Page/ProductDetails/ProductDetailsControl.xaml
@@ -265,7 +265,7 @@
-
+
diff --git a/SlnMesnac.WPF/ViewModel/Index/IndexViewModel.cs b/SlnMesnac.WPF/ViewModel/Index/IndexViewModel.cs
index bb54ece..cf66bf2 100644
--- a/SlnMesnac.WPF/ViewModel/Index/IndexViewModel.cs
+++ b/SlnMesnac.WPF/ViewModel/Index/IndexViewModel.cs
@@ -87,25 +87,27 @@ namespace SlnMesnac.WPF.ViewModel.Index
[RelayCommand]
private void ReadEpcCode(string deviceCode)
{
+ string configKey = string.Empty;
+ if (deviceCode == "050-B" || deviceCode == "I68")
+ {
+ configKey = "I68";
+ }
+ else
+ {
+ configKey = deviceCode;
+ }
+ var rfidConfig = _appConfig.rfidConfig.Where(x => x.equipKey == configKey).FirstOrDefault();
try
{
- string configKey = string.Empty;
- if (deviceCode == "050-B" || deviceCode == "I68")
- {
- configKey = "I68";
- }
- else
- {
- configKey = deviceCode;
- }
- var rfidConfig = _appConfig.rfidConfig.Where(x => x.equipKey == configKey).FirstOrDefault();
-
if (rfidConfig != null)
{
var session = rfidConfig.session as TcpClient;
if (session != null)
{
+
+ session.Connect();
+
var waitClinet = session.CreateWaitingClient(new WaitingOptions()
{
FilterFunc = response =>
@@ -172,30 +174,37 @@ namespace SlnMesnac.WPF.ViewModel.Index
NotifiactionType = EnumPromptType.Error
});
}
+ finally
+ {
+ var session = rfidConfig.session as TcpClient;
+
+ session.Close();
+ }
}
[RelayCommand]
private void WriteEpcCode(string deviceCode)
{
+ string configKey = string.Empty;
+ if (deviceCode == "050-B" || deviceCode == "I68")
+ {
+ configKey = "I68";
+ }
+ else
+ {
+ configKey = deviceCode;
+ }
+ var rfidConfig = _appConfig.rfidConfig.Where(x => x.equipKey == configKey).FirstOrDefault();
try
{
- string configKey = string.Empty;
- if (deviceCode == "050-B" || deviceCode == "I68")
- {
- configKey = "I68";
- }
- else
- {
- configKey = deviceCode;
- }
- var rfidConfig = _appConfig.rfidConfig.Where(x => x.equipKey == configKey).FirstOrDefault();
-
if (rfidConfig != null)
{
var session = rfidConfig.session as TcpClient;
if (session != null)
{
+ session.Connect();
+
var waitClinet = session.CreateWaitingClient(new WaitingOptions()
{
FilterFunc = response =>
@@ -304,6 +313,12 @@ namespace SlnMesnac.WPF.ViewModel.Index
NotifiactionType = EnumPromptType.Error
});
}
+ finally
+ {
+ var session = rfidConfig.session as TcpClient;
+
+ session.Close();
+ }
}
[RelayCommand]