diff --git a/Model/CommunicationManagementClass.cs b/Model/CommunicationManagementClass.cs
index 8550623..4a5d1ac 100644
--- a/Model/CommunicationManagementClass.cs
+++ b/Model/CommunicationManagementClass.cs
@@ -495,7 +495,7 @@ namespace Model
{
//allDone.Set();
// ConnSocket = (Socket)ar.AsyncState;
- if (ConnSocket.Connected)
+ if (ConnSocket!=null &&ConnSocket.Connected)
{
ConnSocket.EndConnect(ar);//挂起异步连接
@@ -518,7 +518,7 @@ namespace Model
Showmsg.StatusBackground = ColorStr.Red;
Showmsg.StatusForeground = ColorStr.White;
//重连
- ConnSocket.BeginConnect(Endpoint, new AsyncCallback(ConnectCallback), ConnSocket);
+ if (ConnSocket != null ) ConnSocket.BeginConnect(Endpoint, new AsyncCallback(ConnectCallback), ConnSocket);
}
diff --git a/Model/Model.csproj b/Model/Model.csproj
index 4ed5382..496111f 100644
--- a/Model/Model.csproj
+++ b/Model/Model.csproj
@@ -41,9 +41,8 @@
..\packages\ControlzEx.4.3.2\lib\net45\ControlzEx.dll
True
-
- False
- C:\Program Files\MVTec\HALCON-17.12-Progress\bin\dotnet35\halcondotnet.dll
+
+ ..\FeiYu\bin\Debug\halcondotnet.dll
False
diff --git a/ViewModel/MainWindowVM.cs b/ViewModel/MainWindowVM.cs
index 5af9445..9b8f0d5 100644
--- a/ViewModel/MainWindowVM.cs
+++ b/ViewModel/MainWindowVM.cs
@@ -2004,6 +2004,10 @@ namespace ViewModel
{
while (true)
{
+ try
+ {
+
+
if (RunStatu == RunStatuEnum.Normal)
{
if (MyPLC != null && MyPLC.PLC != null && MyPLC.PLC.PlcStatus.StatusBackground == ColorStr.Green)
@@ -2014,7 +2018,7 @@ namespace ViewModel
lockTime = DateTime.Now;
MyPLC.PLC.Write("Y2", true);
Door = "已锁";
- break;
+
}
@@ -2029,7 +2033,7 @@ namespace ViewModel
if (MyPLC.PLC.PlcStatus.StatusBackground != ColorStr.Green)
{
ExcepStop("PLC未连接");
- return;
+
}
if (MyPLC.PLC.ReadBool("X0") == false)
@@ -2048,7 +2052,14 @@ namespace ViewModel
LogicDispatch(LogicDispatchFlow);
-
+
+ }
+ }
+ catch (Exception ex)
+ {
+
+ ExcepStop(ex.Message);
+
}
}
diff --git a/ViewModel/ViewModel.csproj b/ViewModel/ViewModel.csproj
index 25f77e1..da58429 100644
--- a/ViewModel/ViewModel.csproj
+++ b/ViewModel/ViewModel.csproj
@@ -39,7 +39,7 @@
False
- C:\Program Files\MVTec\HALCON-17.12-Progress\bin\dotnet35\halcondotnet.dll
+ ..\FeiYu\bin\Debug\halcondotnet.dll
False
@@ -57,9 +57,6 @@
..\packages\MahApps.Metro.2.2.0\lib\net452\MahApps.Metro.dll
True
-
- ..\FeiYu\bin\Debug\MesService.dll
-
..\packages\Microsoft.Xaml.Behaviors.Wpf.1.1.19\lib\net45\Microsoft.Xaml.Behaviors.dll
True
diff --git a/Views/Views.csproj b/Views/Views.csproj
index fe45552..57b1cfc 100644
--- a/Views/Views.csproj
+++ b/Views/Views.csproj
@@ -40,7 +40,7 @@
True
- C:\Program Files\MVTec\HALCON-17.12-Progress\bin\dotnet35\halcondotnet.dll
+ ..\FeiYu\bin\Debug\halcondotnet.dll
..\packages\LiveCharts.0.9.7\lib\net45\LiveCharts.dll