diff --git a/PLCSharpWpf/VVMs/MotionController/Config/EmcIO.xaml b/PLCSharpWpf/VVMs/MotionController/Config/ControllerIO.xaml
similarity index 98%
rename from PLCSharpWpf/VVMs/MotionController/Config/EmcIO.xaml
rename to PLCSharpWpf/VVMs/MotionController/Config/ControllerIO.xaml
index a001d50..2fd53cc 100644
--- a/PLCSharpWpf/VVMs/MotionController/Config/EmcIO.xaml
+++ b/PLCSharpWpf/VVMs/MotionController/Config/ControllerIO.xaml
@@ -1,4 +1,4 @@
-
-
\ No newline at end of file
+
diff --git a/PLCSharpWpf/VVMs/MotionController/Config/EmcIO.xaml.cs b/PLCSharpWpf/VVMs/MotionController/Config/ControllerIO.xaml.cs
similarity index 66%
rename from PLCSharpWpf/VVMs/MotionController/Config/EmcIO.xaml.cs
rename to PLCSharpWpf/VVMs/MotionController/Config/ControllerIO.xaml.cs
index 3667f9d..f3548fb 100644
--- a/PLCSharpWpf/VVMs/MotionController/Config/EmcIO.xaml.cs
+++ b/PLCSharpWpf/VVMs/MotionController/Config/ControllerIO.xaml.cs
@@ -1,17 +1,17 @@
-using System.Windows;
+using System.Windows;
using System.Windows.Controls;
namespace PLCSharp.VVMs.MotionController.Config
{
///
- /// SmcIO.xaml 的交互逻辑
+ /// ControllerIO.xaml 的交互逻辑(通用IO面板,SMC/EMC 板卡通用)
///
- public partial class EmcIO : UserControl
+ public partial class ControllerIO : UserControl
{
///
- /// EmcIO
+ /// ControllerIO
///
- public EmcIO()
+ public ControllerIO()
{
InitializeComponent();
}
@@ -22,4 +22,4 @@ namespace PLCSharp.VVMs.MotionController.Config
dataGrid.CommitEdit(DataGridEditingUnit.Row, true);
}
}
-}
\ No newline at end of file
+}
diff --git a/PLCSharpWpf/VVMs/MotionController/Config/SmcIO.xaml b/PLCSharpWpf/VVMs/MotionController/Config/SmcIO.xaml
deleted file mode 100644
index 673d3ca..0000000
--- a/PLCSharpWpf/VVMs/MotionController/Config/SmcIO.xaml
+++ /dev/null
@@ -1,101 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/PLCSharpWpf/VVMs/MotionController/Config/SmcIO.xaml.cs b/PLCSharpWpf/VVMs/MotionController/Config/SmcIO.xaml.cs
deleted file mode 100644
index e2189ed..0000000
--- a/PLCSharpWpf/VVMs/MotionController/Config/SmcIO.xaml.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-using System.Windows;
-using System.Windows.Controls;
-
-namespace PLCSharp.VVMs.MotionController.Config
-{
- ///
- /// SmcIO.xaml 的交互逻辑
- ///
- public partial class SmcIO : UserControl
- {
- ///
- /// SmcIO
- ///
- public SmcIO()
- {
- InitializeComponent();
- }
-
- private void DataGrid_Unloaded(object sender, RoutedEventArgs e)
- {
- var dataGrid = sender as DataGrid;
- dataGrid.CommitEdit(DataGridEditingUnit.Row, true);
- }
- }
-}
\ No newline at end of file
diff --git a/PLCSharpWpf/VVMs/MotionController/Controller.cs b/PLCSharpWpf/VVMs/MotionController/Controller.cs
index f023970..b83bee6 100644
--- a/PLCSharpWpf/VVMs/MotionController/Controller.cs
+++ b/PLCSharpWpf/VVMs/MotionController/Controller.cs
@@ -162,9 +162,14 @@ namespace PLCSharp.VVMs.MotionController
{
Thread.Sleep(1000);
Online = NetTool.PingIP(IP);
+ if (SDK == null)
+ {
+ continue;
+ }
if (Online)
{
+
Connected = SDK.Init(ControllerNo, IP);
if (Connected)
{
diff --git a/PLCSharpWpf/VVMs/MotionController/Controllers.xaml b/PLCSharpWpf/VVMs/MotionController/Controllers.xaml
index 9678bd7..f515472 100644
--- a/PLCSharpWpf/VVMs/MotionController/Controllers.xaml
+++ b/PLCSharpWpf/VVMs/MotionController/Controllers.xaml
@@ -77,7 +77,7 @@
-
+
diff --git a/PLCSharpWpf/VVMs/MotionController/ControllersModel.cs b/PLCSharpWpf/VVMs/MotionController/ControllersModel.cs
index 1594901..45b15fc 100644
--- a/PLCSharpWpf/VVMs/MotionController/ControllersModel.cs
+++ b/PLCSharpWpf/VVMs/MotionController/ControllersModel.cs
@@ -486,26 +486,16 @@ namespace PLCSharp.VVMs.MotionController
}
_DatasContext.Save();
Controller.Prompt = "";
+ ExecuteControllerManage("config");
break;
case "Config":
ControllerConfig = null;
- switch (_Controller.Type)
+ if (_Controller.Type != ControllerType.Undefined)
{
- case ControllerType.SMC304:
- ControllerConfig = new SmcIO();
- break;
-
- case ControllerType.EMC_E3064_A08:
- ControllerConfig = new EmcIO();
- break;
-
- default:
-
- break;
- }
- if (ControllerConfig != null)
+ ControllerConfig = new ControllerIO();
ControllerConfig.DataContext = this;
+ }
break;
}
}