diff --git a/BPASmart.ConfigurationSoftware/BasicInformation.cs b/BPASmart.ConfigurationSoftware/BasicInformation.cs
deleted file mode 100644
index f1d541d0..00000000
--- a/BPASmart.ConfigurationSoftware/BasicInformation.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-//using System;
-//using System.Collections.Generic;
-//using System.Linq;
-//using System.Text;
-//using System.Threading.Tasks;
-
-//namespace BPASmart.ConfigurationSoftware
-//{
-// public class BasicInformation
-// {
-// ///
-// /// 项目上次保存的目录
-// ///
-// public string ProjectDefaultPath { get; set; } = string.Empty;
-
-
-// }
-//}
diff --git a/BPASmart.ConfigurationSoftware/FileHelper.cs b/BPASmart.ConfigurationSoftware/FileHelper.cs
deleted file mode 100644
index dd44e38f..00000000
--- a/BPASmart.ConfigurationSoftware/FileHelper.cs
+++ /dev/null
@@ -1,89 +0,0 @@
-//using BPA.Helper;
-//using BPASmart.Model;
-//using Microsoft.Win32;
-//using System;
-//using System.Collections.Generic;
-//using System.IO;
-//using System.Linq;
-//using System.Runtime.InteropServices;
-//using System.Text;
-//using System.Threading.Tasks;
-//using System.Windows.Forms;
-
-//namespace BPASmart.ConfigurationSoftware
-//{
-// public class FileHelper
-// {
-
-// private volatile static FileHelper _Instance;
-// public static FileHelper GetInstance => _Instance ?? (_Instance = new FileHelper());
-// private FileHelper() { }
-
-// public void RegisterOpenFileType()
-// {
-// string icoFile = System.Windows.Forms.Application.StartupPath + $"\\Images\\fyf.ico";
-// string DirectoryPath = $"{Json.Data.ProjectPath}\\Images";
-// Directory.CreateDirectory(DirectoryPath);
-// File.Copy(icoFile, $"{DirectoryPath}\\fyf.ico");
-// RegisterFileType(".project", "HBL", ".project", System.Windows.Forms.Application.ExecutablePath, $"{DirectoryPath}\\fyf.ico");
-// }
-
-// private void RegisterFileType(string typeName, string fileType, string fileContent, string app, string ico)
-// {
-// string toolPath = app;//工具启动路径
-// string extension = typeName;//fileType = "自定义文件类型";
-
-// //fileContent = "AAAA";
-// //获取信息
-// RegistryKey registryKey = Registry.ClassesRoot.OpenSubKey(extension);
-// if (registryKey != null)
-// {
-// try
-// {
-// RegistryKey _Regkey = Registry.ClassesRoot.OpenSubKey("", true);
-
-// RegistryKey _VRPkey = _Regkey.OpenSubKey(extension);
-// if (_VRPkey != null) _Regkey.DeleteSubKeyTree(extension, false);
-// if (_VRPkey != null) _Regkey.DeleteSubKeyTree("Exec");
-// }
-// catch (Exception e)
-// {
-
-// }
-// }
-
-// if (registryKey != null && registryKey.OpenSubKey("shell") != null && registryKey.OpenSubKey("shell").OpenSubKey("open") != null &&
-// registryKey.OpenSubKey("shell").OpenSubKey("open").OpenSubKey("command") != null)
-// {
-// var varSub = registryKey.OpenSubKey("shell").OpenSubKey("open").OpenSubKey("command");
-// var varValue = varSub.GetValue("");
-
-// if (Equals(varValue, toolPath + " \"%1\""))
-// {
-// return;
-// }
-// }
-
-// //文件注册
-// registryKey = Registry.ClassesRoot.CreateSubKey(extension);
-// registryKey.SetValue("", fileType);
-// registryKey.SetValue("Content Type", fileContent);
-// //设置默认图标
-// RegistryKey iconKey = registryKey.CreateSubKey("DefaultIcon");
-// //iconKey.SetValue("", Application.StartupPath + $"\\{ico}.ico");
-// iconKey.SetValue("", ico);
-// iconKey.Close();
-// //设置默认打开程序路径
-// registryKey = registryKey.CreateSubKey("shell\\open\\command");
-// registryKey.SetValue("", toolPath + " \"%1\"");
-// //关闭
-// registryKey.Close();
-// SHChangeNotify(0x8000000, 0, IntPtr.Zero, IntPtr.Zero);
-// }
-
-// [DllImport("shell32.dll")]
-// public static extern void SHChangeNotify(uint wEventId, uint uFlags, IntPtr dwItem1, IntPtr dwItem2);
-// }
-
-//}
-
diff --git a/BPASmart.ConfigurationSoftware/Servers/ServiceCenter.cs b/BPASmart.ConfigurationSoftware/Servers/ServiceCenter.cs
index e28f285b..84ff02f8 100644
--- a/BPASmart.ConfigurationSoftware/Servers/ServiceCenter.cs
+++ b/BPASmart.ConfigurationSoftware/Servers/ServiceCenter.cs
@@ -319,6 +319,7 @@ namespace BPASmart.ConfigurationSoftware
///
public async Task ApplicationBaleAsync()
{
+ ProjectSave();
await Task.Factory.StartNew(new Action(() =>
{
if (string.IsNullOrEmpty(FileConfigModel.ConstPath))
@@ -351,6 +352,10 @@ namespace BPASmart.ConfigurationSoftware
string pageFilePath = $"{FileConfigModel.ConstPath}\\{FileConfigModel.PageDirName}";
if (Directory.Exists(pageFilePath)) CopyFolder(pageFilePath, $"{path}\\{FileConfigModel.PageDirName}");
+ //打包图片文件资源
+ string imageFilePath = $"{FileConfigModel.ConstPath}\\{FileConfigModel.ImageDirName}";
+ if (Directory.Exists(imageFilePath)) CopyFolder(imageFilePath, $"{path}\\{FileConfigModel.ImageDirName}");
+
MessageLog.GetInstance.Show("打包完成");
}));
}
diff --git a/BPASmart.ConfigurationSoftware/MainWindowViewModel.cs b/BPASmart.ConfigurationSoftware/ViewModel/MainWindowViewModel.cs
similarity index 100%
rename from BPASmart.ConfigurationSoftware/MainWindowViewModel.cs
rename to BPASmart.ConfigurationSoftware/ViewModel/MainWindowViewModel.cs
diff --git a/BPASmart.Model/Config/FileConfigModel.cs b/BPASmart.Model/Config/FileConfigModel.cs
index e4e4091e..1c076334 100644
--- a/BPASmart.Model/Config/FileConfigModel.cs
+++ b/BPASmart.Model/Config/FileConfigModel.cs
@@ -72,5 +72,10 @@ namespace BPASmart.Model
/// 二进制配置文件名
///
public const string BinConfigFileName = "BinConfigFile.ser";
+
+ ///
+ /// 图片文件夹名称
+ ///
+ public const string ImageDirName = "Images";
}
}
diff --git a/BPASmartClient.SmallBatchingSystem/Services/PlcServer.cs b/BPASmartClient.SmallBatchingSystem/Services/PlcServer.cs
index 8907b1a6..a78bd2ce 100644
--- a/BPASmartClient.SmallBatchingSystem/Services/PlcServer.cs
+++ b/BPASmartClient.SmallBatchingSystem/Services/PlcServer.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
+using System.Threading;
using System.Threading.Tasks;
using BPA.Communication;
using BPA.Helper;
@@ -19,9 +20,17 @@ namespace BPASmartClient.SmallBatchingSystem.Services
public void Connect()
{
+ Communication.IsReconnect = true;
+ Communication.ConnectOk = new Action(() =>
+ {
+ MessageLog.GetInstance.Show("设备连接成功");
+ ThreadManage.GetInstance().StartLong(new Action(() =>
+ {
- Communication.ModbusTcpConnect(Json.Data.Host,Json.Data.Port);
-
+ Thread.Sleep(10);
+ }), "PLC 数据监听");
+ });
+ Communication.ModbusTcpConnect(Json.Data.Host, Json.Data.Port);
}
}