diff --git a/.gitignore b/.gitignore index 18b37858..6c11cc3a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -################################################################################ +################################################################################ # 此 .gitignore 文件已由 Microsoft(R) Visual Studio 自动创建。 ################################################################################ # 忽略所有bin文件夹及其内容 @@ -1099,3 +1099,4 @@ bin/release/ /Learun.Framework.Module/Learun.Workflow/Learun.Workflow.Engine/bin/Debug/Learun.Util.xml /Learun.Framework.Module/Learun.Util/Learun.Util.Operat/bin/Debug/Learun.Util.xml /Learun.Framework.Module/Learun.Util/Learun.Util/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache +newFront/c#前端/.vs/ diff --git a/.vs/Di-Electrical/v17/.wsuo b/.vs/Di-Electrical/v17/.wsuo new file mode 100644 index 00000000..a22c9836 Binary files /dev/null and b/.vs/Di-Electrical/v17/.wsuo differ diff --git a/.vs/Di-Electrical/v17/DocumentLayout.json b/.vs/Di-Electrical/v17/DocumentLayout.json new file mode 100644 index 00000000..d844d547 --- /dev/null +++ b/.vs/Di-Electrical/v17/DocumentLayout.json @@ -0,0 +1,41 @@ +{ + "Version": 1, + "WorkspaceRootPath": "E:\\Di-Electrical\\", + "Documents": [], + "DocumentGroupContainers": [ + { + "Orientation": 0, + "VerticalTabListWidth": 256, + "DocumentGroups": [ + { + "DockedWidth": 203, + "SelectedChildIndex": -1, + "Children": [ + { + "$type": "Bookmark", + "Name": "ST:0:0:{f2e84780-2af1-11d1-a7fa-00a0c9110051}" + }, + { + "$type": "Bookmark", + "Name": "ST:1787071360:0:{81164725-9a96-4ece-a4cb-440d8fd285e5}" + } + ] + }, + { + "DockedWidth": 197, + "SelectedChildIndex": -1, + "Children": [ + { + "$type": "Bookmark", + "Name": "ST:1:0:{3ae79031-e1bc-11d0-8f78-00a0c9110057}" + }, + { + "$type": "Bookmark", + "Name": "ST:0:0:{3ae79031-e1bc-11d0-8f78-00a0c9110057}" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/newFront/c#前端/.vs/SWS.CAD/CopilotIndices/17.13.444.19527/CodeChunks.db b/newFront/c#前端/.vs/SWS.CAD/CopilotIndices/17.13.444.19527/CodeChunks.db index e9f43711..24cccdbb 100644 Binary files a/newFront/c#前端/.vs/SWS.CAD/CopilotIndices/17.13.444.19527/CodeChunks.db and b/newFront/c#前端/.vs/SWS.CAD/CopilotIndices/17.13.444.19527/CodeChunks.db differ diff --git a/newFront/c#前端/.vs/SWS.CAD/CopilotIndices/17.13.444.19527/CodeChunks.db-shm b/newFront/c#前端/.vs/SWS.CAD/CopilotIndices/17.13.444.19527/CodeChunks.db-shm new file mode 100644 index 00000000..18bff569 Binary files /dev/null and b/newFront/c#前端/.vs/SWS.CAD/CopilotIndices/17.13.444.19527/CodeChunks.db-shm differ diff --git a/newFront/c#前端/.vs/SWS.CAD/CopilotIndices/17.13.444.19527/CodeChunks.db-wal b/newFront/c#前端/.vs/SWS.CAD/CopilotIndices/17.13.444.19527/CodeChunks.db-wal new file mode 100644 index 00000000..4a503767 Binary files /dev/null and b/newFront/c#前端/.vs/SWS.CAD/CopilotIndices/17.13.444.19527/CodeChunks.db-wal differ diff --git a/newFront/c#前端/.vs/SWS.CAD/CopilotIndices/17.13.444.19527/SemanticSymbols.db b/newFront/c#前端/.vs/SWS.CAD/CopilotIndices/17.13.444.19527/SemanticSymbols.db index 37afdc0b..50ab65d0 100644 Binary files a/newFront/c#前端/.vs/SWS.CAD/CopilotIndices/17.13.444.19527/SemanticSymbols.db and b/newFront/c#前端/.vs/SWS.CAD/CopilotIndices/17.13.444.19527/SemanticSymbols.db differ diff --git a/newFront/c#前端/.vs/SWS.CAD/CopilotIndices/17.13.444.19527/SemanticSymbols.db-shm b/newFront/c#前端/.vs/SWS.CAD/CopilotIndices/17.13.444.19527/SemanticSymbols.db-shm new file mode 100644 index 00000000..883254a2 Binary files /dev/null and b/newFront/c#前端/.vs/SWS.CAD/CopilotIndices/17.13.444.19527/SemanticSymbols.db-shm differ diff --git a/newFront/c#前端/.vs/SWS.CAD/CopilotIndices/17.13.444.19527/SemanticSymbols.db-wal b/newFront/c#前端/.vs/SWS.CAD/CopilotIndices/17.13.444.19527/SemanticSymbols.db-wal new file mode 100644 index 00000000..a422960b Binary files /dev/null and b/newFront/c#前端/.vs/SWS.CAD/CopilotIndices/17.13.444.19527/SemanticSymbols.db-wal differ diff --git a/newFront/c#前端/CAD.Extend/obj/Debug/CAD.Extend.csproj.AssemblyReference.cache b/newFront/c#前端/CAD.Extend/obj/Debug/CAD.Extend.csproj.AssemblyReference.cache index 806e2185..b8c9cfc0 100644 Binary files a/newFront/c#前端/CAD.Extend/obj/Debug/CAD.Extend.csproj.AssemblyReference.cache and b/newFront/c#前端/CAD.Extend/obj/Debug/CAD.Extend.csproj.AssemblyReference.cache differ diff --git a/newFront/c#前端/CAD.Extend/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/newFront/c#前端/CAD.Extend/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index ca2aed7d..5158d93a 100644 Binary files a/newFront/c#前端/CAD.Extend/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/newFront/c#前端/CAD.Extend/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/newFront/c#前端/DI-Electrical/App.xaml b/newFront/c#前端/DI-Electrical/App.xaml index 0d30f24b..ba28377c 100644 --- a/newFront/c#前端/DI-Electrical/App.xaml +++ b/newFront/c#前端/DI-Electrical/App.xaml @@ -7,7 +7,7 @@ - + diff --git a/newFront/c#前端/DI-Electrical/App.xaml.cs b/newFront/c#前端/DI-Electrical/App.xaml.cs index be4c6c7c..b0dd7ffe 100644 --- a/newFront/c#前端/DI-Electrical/App.xaml.cs +++ b/newFront/c#前端/DI-Electrical/App.xaml.cs @@ -1,14 +1,14 @@ using System.Windows; -using DI_Electrical.Helper; -using DI_Electrical.Services; using DI_Electrical.ViewModels; using DI_Electrical.Views; -using DI_Electrical.Views.Dialog; -using DI_Electrical.Views.Dialog.DialogSignalManagements; using Prism.Events; using Prism.Ioc; using Prism.Services.Dialogs; using Prism.Unity; +using SWS.Commons; +using SWS.Service; +using SWS.WPF.ViewModels; +using SWS.WPF.Views; using Unity; namespace DI_Electrical @@ -16,23 +16,23 @@ namespace DI_Electrical /// /// App.xaml 的交互逻辑 /// - public partial class App : PrismApplication + public partial class App : Prism.Unity.PrismApplication { protected override Window CreateShell() { - return Container.Resolve(); + return GlobalObject._prismContainer.Resolve(); } protected override void InitializeShell(Window shell) { - var login = Container.Resolve(); + var login = GlobalObject._prismContainer.Resolve(); login.ShowDialog(); if (GlobalObject.userInfo == null) { Application.Current?.Shutdown(); return; } - var project = Container.Resolve(); + var project = GlobalObject._prismContainer.Resolve(); project.ShowDialog(); if (GlobalObject.curProject == null) { @@ -45,26 +45,32 @@ namespace DI_Electrical protected override void RegisterTypes(IContainerRegistry containerRegistry) { - containerRegistry.RegisterForNavigation(); - containerRegistry.RegisterForNavigation(); - containerRegistry.RegisterForNavigation(); - containerRegistry.RegisterForNavigation(); - containerRegistry.RegisterDialog(); - containerRegistry.RegisterDialog(); - containerRegistry.RegisterDialog(); - containerRegistry.RegisterDialog(); - containerRegistry.RegisterDialog(); - containerRegistry.RegisterDialog(); + //GlobalObject._prismContainer = new DryIocContainerExtension(); + GlobalObject._prismContainer = (IContainerExtension)containerRegistry; - containerRegistry.Register(); + GlobalObject._prismContainer.RegisterForNavigation(); + GlobalObject._prismContainer.RegisterForNavigation(); + GlobalObject._prismContainer.RegisterForNavigation(); + GlobalObject._prismContainer.RegisterForNavigation(); + GlobalObject._prismContainer.RegisterDialog(); + GlobalObject._prismContainer.RegisterDialog(); + GlobalObject._prismContainer.RegisterDialog(); + GlobalObject._prismContainer.RegisterDialog(); + GlobalObject._prismContainer.RegisterDialog(); + GlobalObject._prismContainer.RegisterDialog(); + GlobalObject._prismContainer.RegisterDialog(); - containerRegistry.RegisterSingleton(); - containerRegistry.RegisterSingleton(); - containerRegistry.RegisterSingleton(); - containerRegistry.RegisterSingleton(); - containerRegistry.RegisterSingleton(); - containerRegistry.RegisterSingleton(); - containerRegistry.RegisterSingleton(); + GlobalObject._prismContainer.Register(); + + GlobalObject.container = new UnityContainer(); + GlobalObject.container.RegisterSingleton(); + GlobalObject.container.RegisterSingleton(); + GlobalObject.container.RegisterSingleton(); + GlobalObject.container.RegisterSingleton(); + GlobalObject.container.RegisterSingleton(); + GlobalObject.container.RegisterSingleton(); + GlobalObject.container.RegisterSingleton(); + GlobalObject.container.RegisterSingleton(); } } diff --git a/newFront/c#前端/DI-Electrical/DI-Electrical.csproj b/newFront/c#前端/DI-Electrical/DI-Electrical.csproj index 576fa5cc..82ef8f55 100644 --- a/newFront/c#前端/DI-Electrical/DI-Electrical.csproj +++ b/newFront/c#前端/DI-Electrical/DI-Electrical.csproj @@ -37,7 +37,8 @@ - ..\packages\DryIoc.dll.5.4.3\lib\net45\DryIoc.dll + False + ..\packages\DryIoc.dll.4.7.7\lib\net45\DryIoc.dll ..\packages\EasyEncryption.1.0.2\lib\EasyEncryption.dll @@ -140,40 +141,9 @@ Code - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - @@ -182,7 +152,6 @@ customWindowTitleBar.xaml - @@ -195,24 +164,6 @@ - - DialogInput.xaml - - - DialogSignalManagement.xaml - - - DialogSignalNotice.xaml - - - DialogSignalPropertyhisAndLogs.xaml - - - DialogSignalSelect.xaml - - - DialogTest.xaml - Login.xaml @@ -253,7 +204,28 @@ - + + + {9ac724f6-883d-4357-9422-602748f25b69} + SWS.Commons + + + {2dcf996e-063b-4b95-8530-28f6df0da58a} + SWS.CustomControl + + + {1995385b-d1b0-4c55-835e-d3e769972a6a} + SWS.Model + + + {51cb6f5b-16e9-4ee0-baa4-144dd1ec8580} + SWS.Service + + + {7aff9117-78e7-4395-9f23-6dcfe09f9299} + SWS.WPF + + Designer @@ -263,34 +235,6 @@ MSBuild:Compile Designer - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - MSBuild:Compile Designer diff --git a/newFront/c#前端/DI-Electrical/GlobalObj.cs b/newFront/c#前端/DI-Electrical/GlobalObj.cs new file mode 100644 index 00000000..31ef9817 --- /dev/null +++ b/newFront/c#前端/DI-Electrical/GlobalObj.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Net.Http; +using IniParser; +using Prism.Ioc; +using SWS.Model; +using Unity; + +namespace DI_Electrical +{ + public class GlobalObj + { + public static loginRes userInfo; + public static HttpClient client; + public static bool isConfigIniCreateBySys = true; + public static List Users; + public static ec_project curProject; + public static string ConfigPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Config.ini"); + public static IUnityContainer container; + #region 本地文件目录 + static string _LocalFileDirectory; + /// + /// 获取本地目录文件夹 + /// + /// + public static string GetLocalFileDirectory() + { + if (string.IsNullOrEmpty(_LocalFileDirectory)) + { + FileIniDataParser parser = new FileIniDataParser(); + var data = parser.ReadFile(ConfigPath); + _LocalFileDirectory = data["Profile"]["Directory"]; + return _LocalFileDirectory; + } + else + { return _LocalFileDirectory; } + } + /// + /// 设置本地目录文件夹 + /// + /// 文件夹目录 + public static void SetLocalFileDirectory(string dir) + { _LocalFileDirectory = dir; } + #endregion + public enum dialogPar + { + id, + title, + info, + para1, + para2 + } + } +} diff --git a/newFront/c#前端/DI-Electrical/Helper/ConfigService.cs b/newFront/c#前端/DI-Electrical/Helper/ConfigService.cs deleted file mode 100644 index dbfee4b3..00000000 --- a/newFront/c#前端/DI-Electrical/Helper/ConfigService.cs +++ /dev/null @@ -1,107 +0,0 @@ -using System; -using System.IO; -using DI_Electrical.Services; -using IniParser; - -namespace DI_Electrical.Helper -{ - public class ConfigService - { - //public string path = Environment.ExpandEnvironmentVariables(@"%USERPROFILE%\AppData\Roaming\SWS\Config.ini"); - public string path = GlobalObject.ConfigPath;// Path.Combine(AppDomain.CurrentDomain.BaseDirectory,@"\Config.ini"); - public FileIniDataParser parser = new FileIniDataParser(); - public HttpService _httpService; - /// - /// config.ini 给默认值,且创建出来 - /// - void SetDefaultConfigValue() - { - if (!File.Exists(path)) - { - //默认值 - var data = parser.Parser.Parse(""); - data["Profile"]["Address"] = "1.117.161.11"; - data["Profile"]["Port"] = "8080"; - string userProfilePath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); - - data["Profile"]["Directory"] = $"{userProfilePath}\\AppData\\Roaming\\SWS"; - Directory.CreateDirectory(Path.GetDirectoryName(path)); - parser.WriteFile(path, data); - GlobalObject.isConfigIniCreateBySys = true; - } - else - { - GlobalObject.isConfigIniCreateBySys = false; - } - } - public ConfigService(HttpService httpService) - { - _httpService = httpService; - SetDefaultConfigValue(); - string address; - int port; - string locDrawingPath; - Read(out address, out port,out locDrawingPath); - _httpService.Init(address, port); - } - public void Read(out string address, out int port, out string directory) - { - var data = parser.ReadFile(path); - address = data["Profile"]["Address"]; - port = int.Parse(data["Profile"]["Port"]); - directory = data["Profile"]["Directory"]; - } - - /// - /// 查询某个 - /// - /// - /// - public string Read(string keyName) - { - var data = parser.ReadFile(path); - return data["Profile"][keyName]; - } - /// - /// 查询某个 - /// - /// 节点 - /// key名称 - /// - public string Read(string session,string keyName) - { - try - { - var data = parser.ReadFile(path); - return data[session][keyName]; - } - catch - { - return null; - } - } - /// - /// 保存某个 - /// - /// - /// - public void Save(string keyName, string value) - { - var data = parser.ReadFile(path); - data["Profile"][keyName] = value; - parser.WriteFile(path, data); - } - /// - /// 保存某个值 - /// - /// 节点 - /// key名称 - /// 值 - public void Save(string session, string keyName, string value) - { - var data = parser.ReadFile(path); - data[session][keyName] = value; - parser.WriteFile(path, data); - } - } -} diff --git a/newFront/c#前端/DI-Electrical/Helper/Converter/CollectionToStringConverter.cs b/newFront/c#前端/DI-Electrical/Helper/Converter/CollectionToStringConverter.cs deleted file mode 100644 index c3cf061c..00000000 --- a/newFront/c#前端/DI-Electrical/Helper/Converter/CollectionToStringConverter.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.ObjectModel; -using System.Globalization; -using System.Windows.Data; -using DI_Electrical.Models; - -namespace DI_Electrical.Helper.Converter -{ - public class CollectionToStringConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - ObservableCollection WHCPUs = value as ObservableCollection; - if (WHCPUs != null) - { - string sWHCPU = ""; - for (int i = 0; i < WHCPUs.Count; i++) - { - if (i!= WHCPUs.Count-1) - { - if (WHCPUs[i] != null) - { - sWHCPU = sWHCPU + WHCPUs[i].DataItemCode + "|"; - } - } - else - { - if (WHCPUs[i] != null) - { - sWHCPU = sWHCPU + WHCPUs[i].DataItemCode; - } - - } - } - return sWHCPU; - } - return null; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } -} diff --git a/newFront/c#前端/DI-Electrical/Helper/Converter/RadGridViewRowToBoolConverter.cs b/newFront/c#前端/DI-Electrical/Helper/Converter/RadGridViewRowToBoolConverter.cs deleted file mode 100644 index 227021a3..00000000 --- a/newFront/c#前端/DI-Electrical/Helper/Converter/RadGridViewRowToBoolConverter.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using System.Globalization; -using System.Windows.Data; -using DI_Electrical.ViewModels; - -namespace DI_Electrical.Helper.Converter -{ - public class RadGridViewRowToBoolConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - SignalManagementInfo smif = value as SignalManagementInfo; - if (smif != null) - { - if (smif.Status.Equals("deleted") || smif.Status.Equals("Confirmed")) - { - return true; - } - if (smif.type.Equals("信号")) - { - switch (parameter.ToString()) - { - case "关联的电缆信息": - case "关联的通道信息": - return true; - } - } - else - { - switch (parameter.ToString()) - { - case "组别": - case "编码": - case "信号类型": - case "Min": - case "Max": - case "单位": - case "CODE": - case "设备名": - case "关联的电缆信息": - case "关联的通道信息": - return true; - } - } - - } - return false; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } -} diff --git a/newFront/c#前端/DI-Electrical/Helper/Converter/StatusToColourConverter.cs b/newFront/c#前端/DI-Electrical/Helper/Converter/StatusToColourConverter.cs deleted file mode 100644 index 627eb147..00000000 --- a/newFront/c#前端/DI-Electrical/Helper/Converter/StatusToColourConverter.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Globalization; -using System.Windows.Data; -using DI_Electrical.ViewModels; - -namespace DI_Electrical.Helper.Converter -{ - internal class StatusToColourConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - SignalManagementInfo smif = value as SignalManagementInfo; - if (smif != null) - { - return smif.Status; - } - return null; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } -} diff --git a/newFront/c#前端/DI-Electrical/Helper/FileHelper.cs b/newFront/c#前端/DI-Electrical/Helper/FileHelper.cs deleted file mode 100644 index b1c4b224..00000000 --- a/newFront/c#前端/DI-Electrical/Helper/FileHelper.cs +++ /dev/null @@ -1,118 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices; -using System.Security.Cryptography; -using System.Text; -using System.Threading.Tasks; - -namespace Dl_Electrical.Helper -{ - public static class FileHelper - { - /// - /// dwg等文件名是否合法。不带后缀 - /// - /// - /// - public static bool IsValidFileName(string fileName) - { - if (string.IsNullOrEmpty(fileName)) - { - return false; - } - - // 获取 Windows 文件系统中不允许出现在文件名中的字符数组 - char[] invalidChars = Path.GetInvalidFileNameChars(); - - // 检查文件名中是否包含非法字符 - foreach (char c in invalidChars) - { - if (fileName.IndexOf(c) >= 0) - { - return false; - } - } - - // 检查是否为保留文件名 - string[] reservedNames = { "CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9" }; - string trimmedFileName = Path.GetFileNameWithoutExtension(fileName).Trim().ToUpper(); - foreach (string reservedName in reservedNames) - { - if (trimmedFileName == reservedName) - { - return false; - } - } - - // 检查文件名是否以空格或句点结尾 - if (fileName.TrimEnd().Length != fileName.Length || fileName.TrimEnd('.').Length != fileName.Length) - { - return false; - } - - return true; - } - - - public static string GetFileMD5(string filePath) - { - if (string.IsNullOrEmpty(filePath) || !File.Exists(filePath)) - { - throw new ArgumentException("文件路径无效或文件不存在", nameof(filePath)); - } - - using (var md5 = MD5.Create()) // 创建 MD5 哈希算法实例 - using (var stream = File.OpenRead(filePath)) // 打开文件流 - { - // 计算文件的 MD5 值 - byte[] hashBytes = md5.ComputeHash(stream); - - // 将字节数组转换为十六进制字符串 - StringBuilder sb = new StringBuilder(); - foreach (var b in hashBytes) - { - sb.Append(b.ToString("x2")); // x2 格式化为两位小写十六进制数 - } - - return sb.ToString(); // 返回 MD5 值的字符串 - } - } - - #region 检查文件是否被其他进程占用 - /// - /// 检查文件是否被其他进程占用 - /// - public static bool IsFileLocked(string filePath) - { - try - { - // 尝试以独占模式打开文件 - using (FileStream fs = File.Open( - filePath, - FileMode.Open, - FileAccess.ReadWrite, - FileShare.None)) // FileShare.None 表示禁止共享 - { - return false; // 成功打开则未被占用 - } - } - catch (IOException ex) - { - // 检查特定错误码 - int errorCode = Marshal.GetHRForException(ex) & 0xFFFF; - return errorCode == 32 || errorCode == 33; // 32: 共享冲突, 33: 进程锁定 - } - catch (UnauthorizedAccessException) - { - return true; // 无权限访问(可能被占用) - } - catch - { - return false; // 其他异常视为未被占用 - } - } - #endregion - } -} diff --git a/newFront/c#前端/DI-Electrical/Helper/LoggerHelper.cs b/newFront/c#前端/DI-Electrical/Helper/LoggerHelper.cs deleted file mode 100644 index 49673fbc..00000000 --- a/newFront/c#前端/DI-Electrical/Helper/LoggerHelper.cs +++ /dev/null @@ -1,145 +0,0 @@ -using System; -using System.IO; -using System.Reflection; -using Dl_Electrical.Helper; -using Newtonsoft.Json.Linq; - -namespace DI_Electrical.Helper -{ - /// - /// nLog使用帮助类 - /// - public class LoggerHelper - { - private static readonly log4net.ILog loginfo = log4net.LogManager.GetLogger("loginfo"); - private static readonly log4net.ILog logerror = log4net.LogManager.GetLogger("logerror"); - private static readonly log4net.ILog logdebug = log4net.LogManager.GetLogger("logdebug"); - private static readonly log4net.ILog logwarn = log4net.LogManager.GetLogger("logwarn"); - private static readonly log4net.ILog logfatal = log4net.LogManager.GetLogger("logfatal"); - - private static LoggerHelper _obj = null; - private static string logPath = string.Empty; - private LoggerHelper() - { - string codeBase = Assembly.GetExecutingAssembly().CodeBase; - string dllPath = codeBase.Replace("file:///", ""); - dllPath = Path.GetDirectoryName(dllPath); - logPath = Path.Combine(dllPath, "Logs\\"); - var configFile = new FileInfo(Path.Combine(dllPath, "log4net.config")); - log4net.Config.XmlConfigurator.ConfigureAndWatch(configFile); - } - /// - /// 获取当前的日志记录对象。 - /// - public static LoggerHelper Current - { - get => _obj ?? (new LoggerHelper()); - set => _obj = value; - } - - #region Debug,调试 - /// - /// 调试信息输出。 - /// - /// 需要记录的信息。 - public void Debug(string msg) - { - logdebug.Debug(msg); - } - - #endregion - - #region Info,信息 - /// - /// 普通信息输出。 - /// - /// 需要记录的信息。 - public void Info(string msg) - { - loginfo.Info(msg); - } - - #endregion - - #region Warn,警告 - /// - /// 警告级别信息输出。 - /// - /// 需要记录的信息。 - public void Warn(string msg) - { - logwarn.Warn(msg); - } - - #endregion - - #region Error,错误 - /// - /// 错误级别信息输出。 - /// - /// 需要记录的信息。 - public void Error(string msg) - { - logerror.Error("----------------------------Error BEGIN------------------------------"); - logerror.Error(msg); - logerror.Error("-----------------------------Error END-------------------------------"); - } - #endregion - - #region Fatal,致命错误 - /// - /// 致命错误级别信息输出。 - /// - /// 需要记录的信息。 - /// 需要记录的系统异常。 - public void Fatal(string msg) - { - logfatal.Fatal("----------------------------Fatal BEGIN------------------------------"); - logerror.Fatal(msg); - logerror.Fatal("-----------------------------Fatal END-------------------------------"); - } - #endregion - - #region 输出json日志 - - /// - /// 输出json日志 - /// - /// json方法名 - /// json数据 - public void WriteJson(string funName, string json) - { - try - { - //json路径文件名 Environment.ExpandEnvironmentVariables(@"%USERPROFILE%\AppData\Roaming\SWS\Logs\" - string filename = Path.Combine(logPath, funName + ".json"); - //判断文件是否被打开占用 - if (!FileHelper.IsFileLocked(filename)) - { - File.Delete(filename); - string strJson = string.Empty; - if (json.StartsWith("[")) - { - //格式化json数据 当前为组类型 - JArray jobj = JArray.Parse(json); - strJson = jobj.ToString(); - } - else if (json.StartsWith("{")) - { - //格式化json数据 当前为类类型 - JObject jobj = JObject.Parse(json); - strJson = jobj.ToString(); - } - //创建json文件,并输出数据 - FileStream fs = new FileStream(filename, FileMode.Append); - StreamWriter wr = null; - wr = new StreamWriter(fs); - wr.WriteLine(strJson); - wr.Close(); - } - } - catch { } - } - #endregion - } -} diff --git a/newFront/c#前端/DI-Electrical/Model/NoEntity/ConfigIni.cs b/newFront/c#前端/DI-Electrical/Model/NoEntity/ConfigIni.cs deleted file mode 100644 index a060f56c..00000000 --- a/newFront/c#前端/DI-Electrical/Model/NoEntity/ConfigIni.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace DI_Electrical.Model -{ - public class ConfigIni - { - /// - /// 用户名 - /// - public string UserName { get; set; } - /// - /// 用户密码 - /// - public string UserPs { get; set; } - /// - /// 项目id - /// - public string ProjectID { get; set; } - /// - /// 服务器ip - /// - public string Address { get; set; } - /// - /// 端口 - /// - public string Port { get; set; } - } -} diff --git a/newFront/c#前端/DI-Electrical/Model/NoEntity/PageModel.cs b/newFront/c#前端/DI-Electrical/Model/NoEntity/PageModel.cs deleted file mode 100644 index 6867d306..00000000 --- a/newFront/c#前端/DI-Electrical/Model/NoEntity/PageModel.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Collections.Generic; - -namespace DI_Electrical.Model -{ - public class PageModel - { - public List Rows { get; set; } - public int Total { get; set; } - public int Records { get; set; } - } -} diff --git a/newFront/c#前端/DI-Electrical/Model/NoEntity/learunHttpRes.cs b/newFront/c#前端/DI-Electrical/Model/NoEntity/learunHttpRes.cs deleted file mode 100644 index cef59a30..00000000 --- a/newFront/c#前端/DI-Electrical/Model/NoEntity/learunHttpRes.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace DI_Electrical.Model -{ - /// - /// learun mvc标准的http返回结果 - /// - /// - public class learunHttpRes - { - public int code { get; set; } - public string info { get; set; } - public T data { get; set; } - } -} diff --git a/newFront/c#前端/DI-Electrical/Model/NoEntity/loginRes.cs b/newFront/c#前端/DI-Electrical/Model/NoEntity/loginRes.cs deleted file mode 100644 index 1f1741d5..00000000 --- a/newFront/c#前端/DI-Electrical/Model/NoEntity/loginRes.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace DI_Electrical.Model -{ - public class loginRes - { - public string token { get; set; } - public string loginMark { get; set; } - public string account { get; set; } - public string userId { get; set; } - public string RealName { get; set; } - - public string userPs { get; set; } - public string IsIOModuleAdmin { get; set; } - public string isFirstLogin { get; set; } - public string Department { get; set; } - } -} diff --git a/newFront/c#前端/DI-Electrical/Model/ec_Wire_Group.cs b/newFront/c#前端/DI-Electrical/Model/ec_Wire_Group.cs deleted file mode 100644 index 51f82012..00000000 --- a/newFront/c#前端/DI-Electrical/Model/ec_Wire_Group.cs +++ /dev/null @@ -1,438 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace DI_Electrical.Models -{ - public class ec_Wire_Group - { - public ec_Wire_Group() - { - //SoftTags = new List(); - NewSoftTags = new List(); - //Status = WireGroupStatusEnum.New; - } - #region 实体成员 - /// - /// 状态。比如“待删除的”。默认为New - /// 去找lr base dataitem数据字典的be_signalstate - /// - //[JsonConverter(typeof(SignalStatusConverter))] - public WireGroupStatusEnum Status { get; set; } = WireGroupStatusEnum.New; - - /// - /// 某一个输出的信号,可以关联多个输入的信号。关联的是 - /// - public string LinkedID { get; set; } = ""; - - /// - /// ID - /// - /// - - public string Wire_Group_ID { get; set; } - - /// - /// 信号名称(CH. No.)。 - /// 1462,C列。 - /// 8600,A列。 - /// 如果是虚拟点。就是主信号+ - /// - /// - public string Group_Name { get; set; } = ""; - /// - /// ChannelID。ec_panel_channel里。 - /// 如果为空,说明这个信号是关联前的状态(或者说未关联的状态) - /// - /// - public string ChannelID { get; set; } = ""; - /// - /// 英文描述(Description)。 - /// 1462,D列。 - /// 8600,B列。 - /// - /// - public string Group_Desc_EN { get; set; } = ""; - /// - /// 中文描述。 - /// 8600,B列(第二行)。 - /// - /// - public string Group_Desc { get; set; } = ""; - /// - /// (Signal_Type)信号类型,如4-20mA。 - /// 1462,I列。 - /// 8600,E列(模拟量)或F列(开关量)。 - /// - /// - public string IO_Type { get; set; } = ""; - - /// - /// 信号的分组(组成Group Name的第一部分) - /// - /// - public string Signal_Group { get; set; } = ""; - /// - /// 信号的序号(组成Group Name的第二部分) - /// - /// - public string Signal_SeqNo { get; set; } = ""; - /// - /// 信号组模板ID(平台上,savesignal时,不会带出这个)。 - /// 只是公司级上才有意义。 - /// - /// - public string WireGroupTemplateID { get; set; } = ""; - /// - /// 代码。 - /// 1462,H列。 - /// - /// - public string Code { get; set; } = ""; - /// - /// Range_Min。 - /// 1462,J列。 - /// 8600,G列(111~222)。 - /// - /// - public string Range_Min { get; set; } = ""; - /// - /// Range_Max. - /// 1462,k列。 - /// 8600,G列(111~222)。 - /// - /// - public string Range_Max { get; set; } = ""; - /// - /// Range_Min和Range_Max的单位。 - /// 1462,L列。 - /// 8600,H列。 - /// - /// - public string Unit { get; set; } = ""; - /// - /// Alarm_LL。 - /// 1462,m列。 - /// 8600,J列(第一行或第二行不确定)。 - /// - /// - public string Alarm_LL { get; set; } = ""; - /// - /// Alarm_L。 - /// 1462,n列。 - /// 8600,I列(第一行或第二行不确定)。 - /// - /// - public string Alarm_L { get; set; } = ""; - /// - /// Alarm_H。 - /// 1462,o列。 - /// 8600,I列(第一行或第二行不确定)。 - /// - /// - public string Alarm_H { get; set; } = ""; - /// - /// Alarm_HH。 - /// 1462,p列。 - /// 8600,J列(第一行或第二行不确定)。 - /// - /// - public string Alarm_HH { get; set; } = ""; - /// - /// AL_GRP 延申报警组。 - /// 1462,S列。 - /// 8600,U列。 - /// - /// - public string AL_GRP { get; set; } = ""; - /// - /// BL_GRP 抑制报警。 - /// 1462,T列。 - /// 8600,T列。 - /// - /// - public string BL_GRP { get; set; } = ""; - /// - /// 延时。 - /// 1462,U列。 - /// 8600,S列。 - /// - /// - public string Time_Delay { get; set; } = ""; - /// - /// 供应商。 - /// 1463,V列。 - /// 8600,L列。 - /// - /// - public string Supplier { get; set; } = ""; - - /// - /// 设备名 - /// - /// - public string EquipName { get; set; } = ""; - /// - /// 传感器代码。 - /// 1462,W列。 - /// 8600,K列。 - /// - /// - public string SENSOR_CODE { get; set; } = ""; - /// - /// VDR_Record。 - /// 1462,X列。 - /// - /// - public bool VDR_Record { get; set; } = false; - - /// - /// 是否为slow down信号。 - /// 1462,Q列。 - /// - /// - public bool SLD { get; set; } = false; - - /// - /// 是否为shut down信号。 - /// 1462,R列。 - /// - /// - public bool SHD { get; set; } = false; - /// - /// Remarks。 - /// 1462,Y列。 - /// 8600,X列。 - /// - /// - public string Remarks { get; set; } = ""; - - /// - /// 信号归属 - /// true,代表该信号是电气进行最终审核确认; - /// false,代表该信号是轮机进行最终审核确认; - /// - public bool ElecOnly { get; set; } = false; - - /// - /// 是否为通讯点。 - /// 1462,通过里的文字判断 - /// 8600,通过K列里的文字判断 - /// - public bool CommunicationPoint { get; set; } = false; - - - ///// - ///// ECC 。Bool类型数据库要么是int要么是bool - ///// - //public bool ECC { get; set; } = false; - - ///// - ///// WCC - ///// - //public bool WCC { get; set; } = false; - ///// - ///// BCC - ///// - //public bool BCC { get; set; } = false; - /// - /// IO类型,AI AO DI DO - /// - public string InOrOut { get; set; } = ""; - /// - /// 驾驶室(控制台)。 - /// 8600,M列。导入时,如果2行都有值,中间会|分开 - /// - public string WHConsole { get; set; } = ""; - /// - /// 驾驶室(计算机)。 - /// 8600,N列。导入时,如果2行都有值,中间会|分开 - /// - public string WHCPU { get; set; } = ""; - /// - /// 集控室(控制台)。 - /// 8600,O列。导入时,如果2行都有值,中间会|分开 - /// - public string ECRConsole { get; set; } = ""; - /// - /// 集控室(计算机)。 - /// 8600,P列(excel中,两行均有值时,以|分开) - /// - public string ECRCPU { get; set; } = ""; - /// - /// 船舶办公室(控制台)。 - /// 8600,Q列。导入时,如果2行都有值,中间会|分开 - /// - public string ShipOfficeConsole { get; set; } = ""; - /// - /// 船舶办公室(计算机)。 - /// 8600,R列。导入时,如果2行都有值,中间会|分开 - /// - public string ShipOfficeCPU { get; set; } = ""; - /// - /// 安全保护。(和 列有关系) - /// 8600,V列。 - /// - public string SafetyProt { get; set; } = ""; - /// - /// 安全保护延时。 - /// 8600,V列下。 - /// - public string SafetyDelay { get; set; } = ""; - - /// - /// SeriousType - /// 1462,AG列。 - /// - /// - public string SeriousType { get; set; } = ""; - - /// - /// 自动控制。 - /// 8600,W列。 - /// - public string AutoCtrl { get; set; } = ""; - /// - /// 爸爸。如果有值,则代表其为虚拟点的概念 - /// - /// - public string ParentID { get; set; } = ""; - /// - /// 删除标记。因为哪怕是删除了,也要保留数据,以便日后查看。 - /// - public bool DeleteFlg { get; set; } = false; - - /// - /// 电缆位号(某些项目的里,是允许编辑的IO_allowManualAssign) - /// - public string CableName { get; set; } - /// - /// 通讯类信号的母线ID - /// - public string CableId { get; set; } - /// - /// 创建人 - /// - /// - public string CreateUserID { get; set; } - /// - /// 创建时间 - /// - /// - public DateTime? CreateTime { get; set; } - /// - /// 更新人 - /// - /// - public string UpdateUserID { get; set; } - /// - /// 更新时间 - /// - /// - public DateTime? UpdateTime { get; set; } - #endregion - - - #region 扩展字段 - ///// - ///// 虚拟点 集合 - ///// - ////[SugarColumn(IsIgnore = true)] - //[Obsolete] - //[Navigate(NavigateType.OneToMany, nameof(ec_SofttagEntity.Wire_Group_ID))] //配置了导航,方便DeleteNav,ec_softtag表中的wiregroupid - //public List SoftTags { get; set; } - - - - public List NewSoftTags { get; set; } - /// - /// 柜子 - /// - - public string PanelName { get; set; } - /// - /// 通道号 - /// - - public string ChannelName { get; set; } - /// - /// 端子排 - /// - - public string StripName { get; set; } - - /// - /// 电缆对 - /// - - public string CableSetName { get; set; } - - /// - /// status的具体文字描述 - /// - - public string StatusValue { get; set; } - - - /// - /// 操作历史(因为现在插件端的保存是一次性的。哪怕有多个动作,也只是一次提交) - /// - - public List ActionHistorys { get; set; } - - /// - /// 信号属性变更历史 - /// - - public List Propertyhis { get; set; } - - /// - /// 信号日志 - /// - - public List Logs { get; set; } - #endregion - } - public enum WireGroupStatusEnum - { - /// - /// 待删除 - /// - [Description("待删除")] - ToDelete = 01, - /// - /// 新增的 - /// - [Description("新增的")] - New = 02, - /// - /// 已关联 - /// - [Description("已使用(关联)")] - Used = 03, - /// - /// 已审核 - /// - [Description("已确认(审核)")] - Confirmed = 04, - /// - /// 重新打开 - /// - [Description("重新打开")] - Reopen = 05, - /// - /// 彻底删除 - /// - [Description("彻底删除")] - deleted = 06 - } - public class ActionHistory - { - public DateTime? ActionTime { get; set; } - public Action ActionType { get; set; } - public string reason { get; set; } - } -} diff --git a/newFront/c#前端/DI-Electrical/Model/ec_dataitemdetail.cs b/newFront/c#前端/DI-Electrical/Model/ec_dataitemdetail.cs deleted file mode 100644 index b655e641..00000000 --- a/newFront/c#前端/DI-Electrical/Model/ec_dataitemdetail.cs +++ /dev/null @@ -1,81 +0,0 @@ -using DryIoc.ImTools; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace DI_Electrical.Models -{ - public class ec_dataitemdetail - { - #region 实体成员 - /// - /// 字典明细ID - /// - - public string DataItemDetailID { get; set; } - /// - /// 字典分类ID(存的是 - /// - public string DataItemID { get; set; } = ""; - /// - /// 上级字典明细ID。 - /// - public string UpDataItemDetailID { get; set; } = ""; - /// - /// 字典明细名称 - /// - public string DataItemName { get; set; } = ""; - /// - /// 字典明细名称(英文) - /// - public string DataItemNameEN { get; set; } = ""; - /// - /// 字典明细编号 - /// - public string DataItemCode { get; set; } = ""; - /// - /// 排序 - /// - public int? OrderID { get; set; } - /// - /// 是否有效 - /// - public int? IsEnabled { get; set; } - /// - /// 备注 - /// - public string Remark { get; set; } = ""; - /// - /// 创建人 - /// - public string CreateUserID { get; set; } - /// - /// 创建时间 - /// - public DateTime? CreateTime { get; set; } - /// - /// 更新人 - /// - public string UpdateUserID { get; set; } - /// - /// 更新时间 - /// - public DateTime? UpdateTime { get; set; } - #endregion - - #region 扩展字段 - /// - /// 字典编号。如Be_signal_group - /// - - public string ItemCode { get; set; } = ""; - /// - /// 信号 - /// - - public List Signals { get; set; } - #endregion - } -} diff --git a/newFront/c#前端/DI-Electrical/Model/ec_project.cs b/newFront/c#前端/DI-Electrical/Model/ec_project.cs deleted file mode 100644 index 979d1dce..00000000 --- a/newFront/c#前端/DI-Electrical/Model/ec_project.cs +++ /dev/null @@ -1,123 +0,0 @@ -using System; - -namespace DI_Electrical.Model -{ - /// - /// 项目 - /// - public class ec_project - { - #region 实体成员 - /// - /// 项目ID - /// - /// - public string ProjectId { get; set; } - /// - /// 项目名称 - /// - /// - public string ProjectName { get; set; } = ""; - /// - /// 项目代号 - /// - /// - public string ProjectCode { get; set; } = ""; - - ///// - ///// 船检 - ///// - //public string ShipCheck { get; set; } = ""; - /// - /// 船名(中文) - /// - /// - public string ShipNameCN { get; set; } = ""; - /// - /// 船名(英文) - /// - /// - public string ShipNameEN { get; set; } = ""; - /// - /// 船型(中文) - /// - /// - public string ShipTypeCN { get; set; } = ""; - /// - /// 船型(英文) - /// - /// - public string ShipTypeEN { get; set; } = ""; - /// - /// 船级社(id)。和船检的概念有些冲突 - /// - /// - public string ShipSociety { get; set; } = ""; - /// - /// 船东 - /// - /// - public string ShipOwner { get; set; } = ""; - /// - /// 挂旗国(船籍国) - /// - /// - public string FlagState { get; set; } = ""; - /// - /// IMO编号 - /// - /// - public string IMONumber { get; set; } = ""; - /// - /// 项目更多描述一 - /// - /// - public string Describe1 { get; set; } = ""; - /// - /// 项目更多描述二 - /// - /// - public string Describe2 { get; set; } = ""; - /// - /// 项目更多描述三 - /// - /// - public string Describe3 { get; set; } = ""; - /// - /// 项目更多描述四 - /// - /// - public string Describe4 { get; set; } = ""; - /// - /// 项目更多描述五 - /// - /// - public string Describe5 { get; set; } = ""; - /// - /// 项目序号 - /// - /// - public int? ProjectIndex { get; set; } - /// - /// 创建人 - /// - /// - public string CreateUserID { get; set; } - /// - /// 创建时间 - /// - /// - public DateTime? CreateTime { get; set; } - /// - /// 更新人 - /// - /// - public string UpdateUserID { get; set; } - /// - /// 更新时间 - /// - /// - public DateTime? UpdateTime { get; set; } - #endregion - } -} diff --git a/newFront/c#前端/DI-Electrical/Model/ec_wire_group_log.cs b/newFront/c#前端/DI-Electrical/Model/ec_wire_group_log.cs deleted file mode 100644 index a7770640..00000000 --- a/newFront/c#前端/DI-Electrical/Model/ec_wire_group_log.cs +++ /dev/null @@ -1,95 +0,0 @@ -using Newtonsoft.Json.Converters; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace DI_Electrical.Models -{ - public class ec_wire_group_log - { - public ec_wire_group_log() - { - - } - public ec_wire_group_log(Action OperateType, string WireGroupID) - { - this.OperateType = OperateType; - this.WireGroupID = WireGroupID; - - } - /// - /// - /// - /// - /// - /// 因为的关系,所以时间是有值的 - public ec_wire_group_log(Action OperateType, string WireGroupID, DateTime? createtime) - { - this.OperateType = OperateType; - this.WireGroupID = WireGroupID; - - if (createtime != null) - { - this.CreateTime = createtime; - } - - } - #region 实体成员 - /// - /// 操作日志ID - /// - /// - - public string WireGroupLogID { get; set; } - /// - /// 信号ID - /// - /// - public string WireGroupID { get; set; } - /// - /// 操作类型 - /// - /// - [JsonConverter(typeof(StringEnumConverter))] - public Action OperateType { get; set; } - /// - /// 备注 - /// - /// - public string ExtraMsg { get; set; } - /// - /// 创建人 - /// - /// - public string CreateUserID { get; set; } - /// - /// 创建时间 - /// - /// - public DateTime? CreateTime { get; set; } - /// - /// 更新人 - /// - /// - public string UpdateUserID { get; set; } - /// - /// 更新时间 - /// - /// - public DateTime? UpdateTime { get; set; } - #endregion - - - #region 扩展字段 - /// - /// 创建人名称 - /// - /// - - public string CreateUserName { get; set; } - #endregion - } -} diff --git a/newFront/c#前端/DI-Electrical/Model/ec_wire_group_notice.cs b/newFront/c#前端/DI-Electrical/Model/ec_wire_group_notice.cs deleted file mode 100644 index df9893ee..00000000 --- a/newFront/c#前端/DI-Electrical/Model/ec_wire_group_notice.cs +++ /dev/null @@ -1,130 +0,0 @@ -using System; - -namespace DI_Electrical.Models - -{ - /// - /// 动作。和状态是两码事情。 - /// - public enum Action - { - - 新增 = 0, - 修改 = 1, - 准备删除 = 2, - 撤销删除 = 3, - 删除 = 4, - 关联通道 = 5, - 审核 = 6, - 重新打开 = 7, - 关联解除 = 8, - 回收站恢复 = 9 - } - - public enum Department - { - 轮机 = 0, - 电气 = 1 - } - - public class ec_wire_group_notice - { - public ec_wire_group_notice() - { - } - /// - /// - /// - /// - /// 接收方 - /// - public ec_wire_group_notice(Action action, Department departmentRetrieveNotice, string WireGroupID) - { - ActionID = action; - CompanyID = departmentRetrieveNotice; - this.WireGroupID = WireGroupID; - - } - - #region 实体成员 - /// - /// 信号表通知ID - /// - /// - public string WireGroupNoticeID { get; set; } - /// - /// 信号ID - /// - /// - public string WireGroupID { get; set; } = ""; - /// - /// 动作 - /// - /// - public Action ActionID { get; set; } - - /// - /// 额外的消息(如删除时,必须要给一个删除理由) - /// - /// - public string Message { get; set; } = ""; - /// - /// 是否被确认。false未读。true已读。 - /// - public bool CheckFLG { get; set; } = false; - /// - /// 接收者的部门 - /// - public Department CompanyID { get; set; } - /// - /// 创建人(也就是发起通知的人) - /// - /// - public string CreateUserID { get; set; } - /// - /// 创建时间 - /// - /// - public DateTime? CreateTime { get; set; } - /// - /// 更新人(也就是确认这个消息已阅的人) - /// - /// - public string UpdateUserID { get; set; } - /// - /// 更新时间 - /// - /// - public DateTime? UpdateTime { get; set; } - #endregion - - #region 扩展字段 - - /// - /// 动作(描述) - /// - /// - public string Action { get; set; } - - /// - /// 创建人名称 - /// - /// - public string CreateUserName { get; set; } - - /// - /// 批准人名字 - /// - /// - public string UpdateUserName { get; set; } - #region 用于前端UI渲染,对应的信号的内容 - public string Group_Name { get; set; } - public string Group_Desc { get; set; } - public string Group_Desc_EN { get; set; } - public string IO_Type { get; set; } - #endregion - #endregion - - } -} - diff --git a/newFront/c#前端/DI-Electrical/Model/user.cs b/newFront/c#前端/DI-Electrical/Model/user.cs deleted file mode 100644 index abdd6bd1..00000000 --- a/newFront/c#前端/DI-Electrical/Model/user.cs +++ /dev/null @@ -1,199 +0,0 @@ -using System; - -namespace DI_Electrical.Model -{ - public class User - { - #region 实体成员 - /// - /// 用户主键 - /// - public string F_UserId { get; set; } - /// - /// 工号 - /// - public string F_EnCode { get; set; } - /// - /// 账户 - /// - public string F_Account { get; set; } - /// - /// 登录密码 - /// - public string F_Password { get; set; } - /// - /// 密码秘钥 - /// - public string F_Secretkey { get; set; } - /// - /// 真实姓名 - /// - public string F_RealName { get; set; } - /// - /// 呢称 - /// - public string F_NickName { get; set; } - /// - /// 头像 - /// - public string F_HeadIcon { get; set; } - /// - /// 快速查询 - /// - public string F_QuickQuery { get; set; } - /// - /// 简拼 - /// - public string F_SimpleSpelling { get; set; } - /// - /// 性别 - /// - public int? F_Gender { get; set; } - /// - /// 生日 - /// - public DateTime? F_Birthday { get; set; } - /// - /// 手机 - /// - public string F_Mobile { get; set; } - /// - /// 电话 - /// - public string F_Telephone { get; set; } - /// - /// 电子邮件 - /// - public string F_Email { get; set; } - /// - /// QQ号 - /// - public string F_OICQ { get; set; } - /// - /// 微信号 - /// - public string F_WeChat { get; set; } - /// - /// MSN - /// - public string F_MSN { get; set; } - /// - /// 公司或部门的主键 - /// - public string F_CompanyId { get; set; } - /// - /// 部门主键 - /// - public string F_DepartmentId { get; set; } - /// - /// 安全级别 - /// - public int? F_SecurityLevel { get; set; } - /// - /// 单点登录标识 - /// - public int? F_OpenId { get; set; } - /// - /// 密码提示问题 - /// - public string F_Question { get; set; } - /// - /// 密码提示答案 - /// - public string F_AnswerQuestion { get; set; } - /// - /// 允许多用户同时登录 - /// - public int? F_CheckOnLine { get; set; } - /// - /// 允许登录时间开始 - /// - public DateTime? F_AllowStartTime { get; set; } - /// - /// 允许登录时间结束 - /// - public DateTime? F_AllowEndTime { get; set; } - /// - /// 暂停用户开始日期 - /// - public DateTime? F_LockStartDate { get; set; } - /// - /// 暂停用户结束日期 - /// - public DateTime? F_LockEndDate { get; set; } - /// - /// 排序码 - /// - public int? F_SortCode { get; set; } - /// - /// 删除标记 - /// - public int? F_DeleteMark { get; set; } - /// - /// 有效标志 - /// - public int? F_EnabledMark { get; set; } - /// - /// 备注 - /// - public string F_Description { get; set; } - /// - /// 创建日期 - /// - public DateTime? F_CreateDate { get; set; } - /// - /// 创建用户主键 - /// - public string F_CreateUserId { get; set; } - /// - /// 创建用户 - /// - public string F_CreateUserName { get; set; } - /// - /// 修改日期 - /// - public DateTime? F_ModifyDate { get; set; } - /// - /// 修改用户主键 - /// - public string F_ModifyUserId { get; set; } - /// - /// 修改用户 - /// - public string F_ModifyUserName { get; set; } - /// - /// 密码更新时间 - /// - public DateTime? PasswordUpdateTime { get; set; }//add by chenkai 20210322 - /// - /// 微信OpenId - /// - public string WX_OpenId { get; set; } - #endregion - - - #region 扩展属性 - /// - /// 登录信息 - /// - public string LoginMsg { get; set; } - /// - /// 登录状态 - /// - public bool LoginOk { get; set; } - - /// - /// 公司名称 - /// - public string F_FullName { get; set; } - /// - /// 岗位名称 - /// - public string F_PostName { get; set; } - /// - /// 单位名称 - /// - public string F_CompanyName { get { return F_FullName; } } - #endregion - } -} diff --git a/newFront/c#前端/DI-Electrical/Services/DataItemService.cs b/newFront/c#前端/DI-Electrical/Services/DataItemService.cs deleted file mode 100644 index caf4d613..00000000 --- a/newFront/c#前端/DI-Electrical/Services/DataItemService.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using DI_Electrical.Models; - -namespace DI_Electrical.Services -{ - public class DataItemService : HttpService - { - public DataItemService( ) : base() - { - - } - - public async Task> GetDetails(string itemCode) - { - var res = await this.GetAsync>($"DataItemApi/GetDetails?projectId={GlobalObject.curProject.ProjectId}&itemCode={itemCode}"); - //OnRefresh(); - if (res.code == 200) - { - - return res.data; - } - else - { - return null;//ERROR INFO - } - } - - } -} diff --git a/newFront/c#前端/DI-Electrical/Services/HttpService.cs b/newFront/c#前端/DI-Electrical/Services/HttpService.cs deleted file mode 100644 index 2485af1a..00000000 --- a/newFront/c#前端/DI-Electrical/Services/HttpService.cs +++ /dev/null @@ -1,263 +0,0 @@ -using System; -using System.IO; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Text; -using System.Threading.Tasks; -using DI_Electrical.Helper; -using DI_Electrical.Model; -using Newtonsoft.Json; -namespace DI_Electrical.Services -{ - public class HttpService - { - public HttpService() - { - } - public void Init(string address, int port) - { - // 如果 GlobalObject.client 已经是 null,初始化一个新的 HttpClient 实例 - //if (GlobalObject.client == null) - //{ - GlobalObject.client = new HttpClient() - { - BaseAddress = new Uri($"http://{address}:{port}/api/"), - Timeout = TimeSpan.FromSeconds(120) - }; - //} - //else - //{ - // // 如果已经有 client 实例,则更新它的 BaseAddress - // GlobalObject.client.BaseAddress = new Uri($"http://{address}:{port}/api/"); - //} - } - - /// - /// 带入授权码。 - /// - /// - protected virtual void OnInitAuthorizationCode() - { - //httpClient.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows 10.0.22621.1265; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/110.0.835.163 Safari/535.1"); - - //if (AuthorizationCode.IsNullOrEmpty() || httpClient == null) return; - //httpClient.DefaultRequestHeaders.Add("Authorization", "Bearer " + AuthorizationCode); - } - protected virtual void OnInitRequestHeader(HttpClient httpClient, string mediaType) - { - //httpClient.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue(mediaType)); - httpClient.DefaultRequestHeaders.Add("Accept", mediaType); - httpClient.DefaultRequestHeaders.Add("ContentType", mediaType); - } - - private void WriteLog(string requestUri, string strJson) - { - try - { - var uri = new Uri(GlobalObject.client.BaseAddress + requestUri); - var funName = uri.Segments.Last(); - LoggerHelper.Current.WriteJson(funName, strJson); - } - catch { } - } - - public async Task> GetAsync(string requestUri) - { - //httpClient.Timeout = TimeSpan.FromSeconds(3000); - OnInitAuthorizationCode(); - string result = string.Empty; - learunHttpRes resultObj = null; - try - { - var response = await GlobalObject.client.GetAsync(requestUri); - if (response.StatusCode != HttpStatusCode.OK) - { - string errorMsg = $"服务器地址 [{requestUri}] 获取数据失败, 返回HTTP代码:" + response.StatusCode; - LoggerHelper.Current.Error(errorMsg); - throw new HttpRequestException(errorMsg); - } - result = await response.Content.ReadAsStringAsync(); - WriteLog(requestUri, result); - resultObj = JsonConvert.DeserializeObject>(result); - } - catch (JsonException) - { - string errorMsg = $"服务器地址 [{requestUri}] 解析为{typeof(T).Name}失败,原始返回数据为: " + result; - LoggerHelper.Current.Error(errorMsg); - resultObj = new learunHttpRes() { code = -100, info = errorMsg }; - return resultObj; - } - catch (Exception ex) - { - string errorMsg = $"接口:{requestUri}失败,异常:{ex.Message} "; - LoggerHelper.Current.Error(errorMsg); - resultObj = new learunHttpRes() { code = -100, info=errorMsg }; - return resultObj; - } - - if (resultObj.code != 200) - { - switch (resultObj.code) - { - case 400: - case 500: - break; - //业务错误,不是http本质错误 - default: - string errorMsg = $"服务器地址 [{requestUri}] Get失败, 返回自定义代码:" + resultObj.code; - LoggerHelper.Current.Error(errorMsg); - throw new HttpRequestException(errorMsg); - } - - } - LoggerHelper.Current.Info($"Get成功:{requestUri}"); - return resultObj; - - - } - public async Task GetAsyncByOnlyData(string requestUri) - { - //httpClient.Timeout = TimeSpan.FromSeconds(3000); - OnInitAuthorizationCode(); - string result = string.Empty; - T resultObj; - try - { - var response = await GlobalObject.client.GetAsync(requestUri); - if (response.StatusCode != HttpStatusCode.OK) - { - string errorMsg = $"服务器地址 [{requestUri}] 获取数据失败, 返回HTTP代码:" + response.StatusCode; - LoggerHelper.Current.Error(errorMsg); - throw new HttpRequestException(errorMsg); - } - result = await response.Content.ReadAsStringAsync(); - WriteLog(requestUri, result); - resultObj = JsonConvert.DeserializeObject(result); - } - catch (JsonException) - { - string errorMsg = $"服务器地址 [{requestUri}] 解析为{typeof(T).Name}失败,原始返回数据为: " + result; - LoggerHelper.Current.Error(errorMsg); - throw new JsonException(errorMsg); - } - catch (Exception ex) - { - string errorMsg = $"接口:{requestUri}失败,异常:{ex.Message} "; - LoggerHelper.Current.Error(errorMsg); - throw new JsonException(errorMsg); - } - - LoggerHelper.Current.Info($"Get成功:{requestUri}"); - return resultObj; - - - } - /// - /// - /// - /// 响应后的返回数据的类型 - /// POST数据对象的类型 - /// - /// - /// - /// - /// - public async Task> PostBodyAsync(string requestUri, T1 postObj) - { - OnInitAuthorizationCode(); - - string contentType = "application/json"; - string strContent = postObj != null ? JsonConvert.SerializeObject(postObj) : ""; - var content = new StringContent(strContent, Encoding.UTF8, contentType); - OnInitRequestHeader(GlobalObject.client, contentType); - learunHttpRes resultObj = null; - string result = string.Empty; - try - { - var response = await GlobalObject.client.PostAsync(requestUri, content); - if (response.StatusCode != HttpStatusCode.OK) - { - string errorMsg = $"服务器地址 [{requestUri}] Post数据失败, 返回HTTP代码:" + response.StatusCode; - LoggerHelper.Current.Error(errorMsg); - throw new HttpRequestException(errorMsg); - } - result = await response.Content.ReadAsStringAsync(); - WriteLog(requestUri, result); - resultObj = JsonConvert.DeserializeObject>(result); - } - catch (JsonException) - { - string errorMsg = $"服务器地址 [{requestUri}] 解析为{typeof(T).Name}失败,原始返回数据为: " + result; - LoggerHelper.Current.Error(errorMsg); - resultObj = new learunHttpRes() { code = -100, info = errorMsg }; - return resultObj; - } - catch (Exception ex) - { - string errorMsg = $"接口:{requestUri}失败,参数数据为:{strContent},异常:{ex.Message} "; - LoggerHelper.Current.Error(errorMsg); - resultObj = new learunHttpRes() { code = -100, info = errorMsg }; - return resultObj; - } - - if (resultObj.code != 200) - { - switch (resultObj.code) - { - case 400: - case 500: - break; - //业务错误,不是http本质错误 - default: - string errorMsg = $"服务器地址 [{requestUri}] Post失败, 返回自定义代码:" + resultObj.code; - LoggerHelper.Current.Error(errorMsg); - throw new HttpRequestException(errorMsg); - } - - } - LoggerHelper.Current.Info($"Post成功:{requestUri}"); - return resultObj; - - - } - - - - public async Task PostFileAsync(string requestUri, Stream stream, string fileName) - { - OnInitAuthorizationCode(); - - string contentType = "multipart/form-data"; - var streamContent = new StreamContent(stream, (int)stream.Length); - streamContent.Headers.Add("Content-Type", "application/octet-stream"); - var content = new MultipartFormDataContent - { - { streamContent, "file", fileName } - }; - OnInitRequestHeader(GlobalObject.client, contentType); - var response = await GlobalObject.client.PostAsync(requestUri, content); - if (response.StatusCode != HttpStatusCode.OK) - { - string errorMsg = $"服务器地址 [{requestUri}] Post数据失败, 返回HTTP代码:" + response.StatusCode; - LoggerHelper.Current.Error(errorMsg); - throw new HttpRequestException(errorMsg); - } - var result = await response.Content.ReadAsStringAsync(); - T resultObj; - try - { - resultObj = JsonConvert.DeserializeObject(result); - } - catch (JsonException) - { - string errorMsg = $"服务器地址 [{requestUri}] 解析为 string 失败,原始返回数据为: " + result; - LoggerHelper.Current.Error(errorMsg); - throw new JsonException(errorMsg); - } - LoggerHelper.Current.Info($"Post上传文件成功:{requestUri}"); - return resultObj; - } - - } -} diff --git a/newFront/c#前端/DI-Electrical/Services/LoginService.cs b/newFront/c#前端/DI-Electrical/Services/LoginService.cs deleted file mode 100644 index c8e8e21f..00000000 --- a/newFront/c#前端/DI-Electrical/Services/LoginService.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System; -using System.Net.Http; -using System.Threading.Tasks; -using DI_Electrical.Model; -using EasyEncryption; -using Newtonsoft.Json; - -namespace DI_Electrical.Services -{ - public class LoginService : HttpService - { - public LoginService() : base() - { - - } - - public async Task Login(string userName, string passwordOrigin) - { - - var password = MD5.ComputeMD5Hash(passwordOrigin); //B156525AFDB610B9D6830A1E9D0A1024 - try - { - var res = await this.GetAsync($"LoginApi/CheckLogin?username={userName}&password={password}"); - //OnRefresh(); - if (res.code == 200) - { - GlobalObject.userInfo = JsonConvert.DeserializeObject(res.data.ToString());// as loginRes; - GlobalObject.userInfo.userPs = passwordOrigin; - return ""; - } - else - { - return res.info;//ERROR INFO - } - - } - catch (HttpRequestException EX) - { - return "http错误。无法连接上服务器。请检查服务器 和 端口。" + EX.Message; - } - catch (Exception E) - { - return E.Message; - } - - - } - - } -} diff --git a/newFront/c#前端/DI-Electrical/Services/ProjectService.cs b/newFront/c#前端/DI-Electrical/Services/ProjectService.cs deleted file mode 100644 index 5c4e3765..00000000 --- a/newFront/c#前端/DI-Electrical/Services/ProjectService.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System.Threading.Tasks; -using DI_Electrical.Model; -using Newtonsoft.Json.Linq; - -namespace DI_Electrical.Services -{ - public class ProjectService : HttpService - { - public ProjectService() : base() - { - - } - - public async Task> GetProjects(int pageNo, int pageSize) - { - - var res = await this.GetAsync>($"ProjectApi/GetProjectSelectPageList?pageNo={pageNo}&pageSize={pageSize}"); - if (res.code == 200) - { - return res.data; - } - else - { - } - return null; - } - - /// - /// 插件端选择项目后,统一、整合加载左侧面板里的数据 - /// - /// - /// - /// - public async Task InitProjInfo(string projectId, string userName) - { - var res = await this.GetAsync($"ProjectApi/InitProjInfo?ProjId={projectId}&User={userName}"); - if (res.code == 200) - { - var o = res.data as JToken; - - return o; - } - else - { - return null; - } - - } - } -} diff --git a/newFront/c#前端/DI-Electrical/Services/UserService.cs b/newFront/c#前端/DI-Electrical/Services/UserService.cs deleted file mode 100644 index 34a65329..00000000 --- a/newFront/c#前端/DI-Electrical/Services/UserService.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Collections.Generic; -using System.Threading.Tasks; -using DI_Electrical.Model; - -namespace DI_Electrical.Services -{ - public class UserService : HttpService - { - public UserService() : base() - { - - } - public async Task GetList() - { - - var res = await this.GetAsync>($"UserApi/GetList"); - if (res.code == 200) - { - GlobalObject.Users = res.data; - } - else - { - } - } - } -} diff --git a/newFront/c#前端/DI-Electrical/Services/WireGroupService.cs b/newFront/c#前端/DI-Electrical/Services/WireGroupService.cs deleted file mode 100644 index aebc72a6..00000000 --- a/newFront/c#前端/DI-Electrical/Services/WireGroupService.cs +++ /dev/null @@ -1,170 +0,0 @@ -using System.Collections.Generic; -using System.Threading.Tasks; -using DI_Electrical.Models; - -namespace DI_Electrical.Services -{ - public class WireGroupService : HttpService - { - #region 辅助类 - /// - /// SaveSignals 专用 - /// - public class WireGroups - { - public string ID { get; set; } - public List Signals { get; set; } - } - #endregion - public WireGroupService() : base() - { - - } - /// - /// 获取所有的信号 - /// - /// - /// - /// - public async Task> GetSignals(string projId, bool Assigned) - { - - var res = await this.GetAsync>($"WireGroupApi/GetSignals?projId={projId}&Assigned={Assigned}"); - if (res.code == 200) - { - return res.data; - } - else - { - } - return null; - } - /// - /// 获取当前组可用的编码 - /// - /// - /// - public async Task GetNextAvailableSeq(string group) - { - var res = await this.GetAsync($"WireGroupApi/GetNextAvailableSeq?projId={GlobalObject.curProject?.ProjectId}&group={group}"); - if (res.code == 200) - { - return res.info; - } - else - { - } - return null; - } - - /// - /// 验证是否可以保存 - /// - /// - /// - public async Task CanSaveSignals(WireGroups entity ,Models.Action ActionType) - { - var res = await this.PostBodyAsync, WireGroups>($"WireGroupApi/CanSaveSignals?projId={GlobalObject.curProject?.ProjectId}&ActionType={ActionType}", entity); - if (res.code == 200) - { - return "OK"; - } - else - { - return res.info; - } - } - /// - /// 保存 - /// - /// - /// - public async Task> SaveSignals(WireGroups entity) - { - var res = await this.PostBodyAsync, WireGroups>($"WireGroupApi/SaveSignals?projId={GlobalObject.curProject?.ProjectId}&mode=0", entity); - if (res.code == 200) - { - return res.data; - } - else - { - } - return null; - } - - /// - /// 查询信号信息 - /// - /// - /// - public async Task> GetNotification() - { - var res = await this.GetAsync>($"WireGroupApi/GetNotification?projId={GlobalObject.curProject?.ProjectId}"); - if (res.code == 200) - { - return res.data; - } - else - { - } - return null; - } - - /// - /// 查询信号历史 - /// - /// 项目ID - /// 信号ID,多个用都逗号隔开 - /// - public async Task> GetSignalPropertyhis(string wireGroupIds) - { - var res = await this.GetAsync>($"WireGroupApi/GetSignalPropertyhis?projId={GlobalObject.curProject?.ProjectId}&wireGroupIds={wireGroupIds}"); - if (res.code == 200) - { - return res.data; - } - else - { - } - return null; - } - - /// - /// 查询信号日志 - /// - /// 项目ID - /// 信号ID,多个用都逗号隔开 - /// - public async Task> GetSignalLogs(string wireGroupIds) - { - var res = await this.GetAsync>($"WireGroupApi/GetSignalLogs?projId={GlobalObject.curProject?.ProjectId}&wireGroupIds={wireGroupIds}"); - if (res.code == 200) - { - return res.data; - } - else - { - } - return null; - } - - /// - /// 读信号通知 - /// - /// - /// - public async Task> ReadNotification(List NoticeIds) - { - var res = await this.PostBodyAsync,List>($"WireGroupApi/ReadNotification?projId={GlobalObject.curProject?.ProjectId}", NoticeIds); - if (res.code == 200) - { - return res.data; - } - else - { - } - return null; - } - - } -} diff --git a/newFront/c#前端/DI-Electrical/Style/CustomStyles.xaml b/newFront/c#前端/DI-Electrical/Style/CustomStyles.xaml deleted file mode 100644 index b25aeb5e..00000000 --- a/newFront/c#前端/DI-Electrical/Style/CustomStyles.xaml +++ /dev/null @@ -1,552 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #C0C4CC - M998 352c0 -8 -4 -17 -10 -23l-50 -50c-6 -6 -14 -10 -23 -10c-8 0 -17 4 -23 10l-393 393l-393 -393c-6 -6 -15 -10 -23 -10s-17 4 -23 10l-50 50c-6 6 -10 15 -10 23s4 17 10 23l466 466c6 6 15 10 23 10s17 -4 23 -10l466 -466c6 -6 10 -15 10 -23z - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newFront/c#前端/DI-Electrical/Style/StyleSelectors/ConditionalStyleSelector.cs b/newFront/c#前端/DI-Electrical/Style/StyleSelectors/ConditionalStyleSelector.cs deleted file mode 100644 index 6f5ad24a..00000000 --- a/newFront/c#前端/DI-Electrical/Style/StyleSelectors/ConditionalStyleSelector.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System.Collections.Generic; -using System.Windows.Controls; -using System.Windows.Data; - -namespace DI_Electrical.Style -{ - internal class ConditionalStyleSelector:StyleSelector - { - public override System.Windows.Style SelectStyle(object item, System.Windows.DependencyObject container) - { - //获取到转换器返回的值 - object conditionValue = this.ConditionConverter.Convert(item, null, null, null); - foreach (ConditionalStyleRule rule in this.Rules) - { - //值相同则返回当前样式 - if (Equals(rule.Value, conditionValue)) - { - return rule.Style; - } - } - - return base.SelectStyle(item, container); - } - - List _Rules; - public List Rules - { - get - { - if (this._Rules == null) - { - this._Rules = new List(); - } - - return this._Rules; - } - } - - IValueConverter _ConditionConverter; - public IValueConverter ConditionConverter - { - get - { - return this._ConditionConverter; - } - set - { - this._ConditionConverter = value; - } - } - } - - public class ConditionalStyleRule - { - object _Value; - public object Value - { - get - { - return this._Value; - } - set - { - this._Value = value; - } - } - - System.Windows.Style _Style; - public System.Windows.Style Style - { - get - { - return this._Style; - } - set - { - this._Style = value; - } - } - } - -} diff --git a/newFront/c#前端/DI-Electrical/Style/StyleSelectors/SignalNoticeStyleSelector.cs b/newFront/c#前端/DI-Electrical/Style/StyleSelectors/SignalNoticeStyleSelector.cs deleted file mode 100644 index c10434ac..00000000 --- a/newFront/c#前端/DI-Electrical/Style/StyleSelectors/SignalNoticeStyleSelector.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System.Collections.Generic; -using System.Windows; -using System.Windows.Controls; -using DI_Electrical.ViewModels; - -namespace DI_Electrical.Style -{ - internal class SignalNoticeStyleSelector:StyleSelector - { - public override System.Windows.Style SelectStyle(object item, DependencyObject container) - { - SignalNotice conditionValue = item as SignalNotice; - string value = conditionValue.CheckFLG.ToString(); - foreach (ConditionalStyleRule rule in this.Rules) - { - //值相同则返回当前样式 - if (Equals(rule.Value, value)) - { - return rule.Style; - } - } - - - return base.SelectStyle(item, container); - } - - List _Rules; - public List Rules - { - get - { - if (this._Rules == null) - { - this._Rules = new List(); - } - - return this._Rules; - } - } - } -} diff --git a/newFront/c#前端/DI-Electrical/ViewModels/ConfigViewModel.cs b/newFront/c#前端/DI-Electrical/ViewModels/ConfigViewModel.cs index 56a4471d..07afadc1 100644 --- a/newFront/c#前端/DI-Electrical/ViewModels/ConfigViewModel.cs +++ b/newFront/c#前端/DI-Electrical/ViewModels/ConfigViewModel.cs @@ -1,6 +1,6 @@ using System.Windows; -using DI_Electrical.Helper; -using DI_Electrical.Services; +using SWS.Commons; +using SWS.Service; namespace DI_Electrical.ViewModels { diff --git a/newFront/c#前端/DI-Electrical/ViewModels/LoginViewModel.cs b/newFront/c#前端/DI-Electrical/ViewModels/LoginViewModel.cs index 7ccb36da..fe30495a 100644 --- a/newFront/c#前端/DI-Electrical/ViewModels/LoginViewModel.cs +++ b/newFront/c#前端/DI-Electrical/ViewModels/LoginViewModel.cs @@ -1,17 +1,12 @@ - using System.Threading; -using System.Windows; +using System.Windows; using System.Windows.Input; -using DI_Electrical.Helper; -using DI_Electrical.Model; -using DI_Electrical.Services; using DI_Electrical.Views; -using Prism.Events; using Prism.Ioc; -using Prism.Mvvm; -using Prism.Services.Dialogs; +using SWS.Commons; +using SWS.Model; +using SWS.Service; using Telerik.Windows.Controls; using Unity; -using DialogParameters = Prism.Services.Dialogs.DialogParameters; namespace DI_Electrical.ViewModels { @@ -121,7 +116,7 @@ namespace DI_Electrical.ViewModels else { IsBusy = true; BusyContent = "登录中..."; - var res = await _Service.Login(UserName, Userpass); + var res = await _Service.Login(UserName, Userpass); IsBusy = false; if (string.IsNullOrEmpty(res)) { diff --git a/newFront/c#前端/DI-Electrical/ViewModels/MainWindowViewModel.cs b/newFront/c#前端/DI-Electrical/ViewModels/MainWindowViewModel.cs index ee3c208b..85691f4d 100644 --- a/newFront/c#前端/DI-Electrical/ViewModels/MainWindowViewModel.cs +++ b/newFront/c#前端/DI-Electrical/ViewModels/MainWindowViewModel.cs @@ -1,16 +1,12 @@ using System.Windows; using System.Windows.Input; using DI_Electrical.Event; -using DI_Electrical.Views.Dialog; -using DI_Electrical.Views.Dialog.DialogSignalManagements; -using DryIoc; using Newtonsoft.Json.Linq; using Prism.Events; -using Prism.Ioc; -using Prism.Mvvm; using Prism.Services.Dialogs; +using SWS.Commons; +using SWS.WPF.Views; using Telerik.Windows.Controls; -using DialogParameters = Prism.Services.Dialogs.DialogParameters; namespace DI_Electrical.ViewModels { @@ -54,7 +50,7 @@ namespace DI_Electrical.ViewModels } public void onShowDialogTest(object o) { - IDialogParameters par = new DialogParameters(); + IDialogParameters par = new Prism.Services.Dialogs.DialogParameters(); par.Add(GlobalObject.dialogPar.para1.ToString(), "abc你我他"); _dialogService.ShowDialog(nameof(DialogTest), par, (result) => { @@ -72,7 +68,7 @@ namespace DI_Electrical.ViewModels } public void onShowDialogSignalManagement(object o) { - IDialogParameters par = new DialogParameters(); + IDialogParameters par = new Prism.Services.Dialogs.DialogParameters(); _dialogService.ShowDialog(nameof(DialogSignalManagement), par, (result) => { var res = result.Parameters.GetValue(GlobalObject.dialogPar.para1.ToString()); diff --git a/newFront/c#前端/DI-Electrical/ViewModels/ProjectViewModel.cs b/newFront/c#前端/DI-Electrical/ViewModels/ProjectViewModel.cs index b997588e..dd1581eb 100644 --- a/newFront/c#前端/DI-Electrical/ViewModels/ProjectViewModel.cs +++ b/newFront/c#前端/DI-Electrical/ViewModels/ProjectViewModel.cs @@ -1,11 +1,12 @@ using System.Collections.Generic; using System.Windows; using DI_Electrical.Event; -using DI_Electrical.Helper; -using DI_Electrical.Model; -using DI_Electrical.Services; using Prism.Events; using Prism.Ioc; +using SWS.Commons; +using SWS.Model; +using SWS.Service; +using Unity; namespace DI_Electrical.ViewModels { @@ -32,12 +33,13 @@ namespace DI_Electrical.ViewModels ProjectService _Service; ConfigService _configService; IEventAggregator _eventAggregator; - public ProjectViewModel(IContainerProvider container) : base() + public ProjectViewModel() : base() { title = "项目选择"; - _Service = container.Resolve(); - _configService = container.Resolve(); - _eventAggregator= container.Resolve(); + + _Service = GlobalObject.container.Resolve(); + _configService = GlobalObject.container.Resolve(); + _eventAggregator= GlobalObject.container.Resolve(); } public async override void onWindow_loaded(object para) { diff --git a/newFront/c#前端/DI-Electrical/Views/CustomControl/MultiSelectSearchComboBox/CollectionToStringConverter.cs b/newFront/c#前端/DI-Electrical/Views/CustomControl/MultiSelectSearchComboBox/CollectionToStringConverter.cs index a3fda24d..a435bc67 100644 --- a/newFront/c#前端/DI-Electrical/Views/CustomControl/MultiSelectSearchComboBox/CollectionToStringConverter.cs +++ b/newFront/c#前端/DI-Electrical/Views/CustomControl/MultiSelectSearchComboBox/CollectionToStringConverter.cs @@ -2,7 +2,7 @@ using System.Collections.ObjectModel; using System.Globalization; using System.Windows.Data; -using DI_Electrical.Models; +using SWS.Model; namespace DI_Electrical.Views.CustomControl { diff --git a/newFront/c#前端/DI-Electrical/Views/Login.xaml b/newFront/c#前端/DI-Electrical/Views/Login.xaml index ee42ed71..5a1b79b9 100644 --- a/newFront/c#前端/DI-Electrical/Views/Login.xaml +++ b/newFront/c#前端/DI-Electrical/Views/Login.xaml @@ -5,7 +5,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:i="http://schemas.microsoft.com/xaml/behaviors" xmlns:local="clr-namespace:DI_Electrical.Views" - xmlns:local2="clr-namespace:DI_Electrical.Helper" + xmlns:local2="clr-namespace:SWS.Commons;assembly=SWS.Commons" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" Width="300" diff --git a/newFront/c#前端/DI-Electrical/packages.config b/newFront/c#前端/DI-Electrical/packages.config index 4687d6c4..25e3f733 100644 --- a/newFront/c#前端/DI-Electrical/packages.config +++ b/newFront/c#前端/DI-Electrical/packages.config @@ -1,14 +1,12 @@  - + - - - + diff --git a/newFront/c#前端/SWS.CAD.sln b/newFront/c#前端/SWS.CAD.sln index c0471360..87f32b55 100644 --- a/newFront/c#前端/SWS.CAD.sln +++ b/newFront/c#前端/SWS.CAD.sln @@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.7.34221.43 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SWS.CAD", "SWS.CAD\SWS.CAD.csproj", "{6BD9B3FC-7D55-4762-AF68-A50183342537}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CAD.Extend", "CAD.Extend\CAD.Extend.csproj", "{8740B023-B585-4E69-8521-4F62FA754A1B}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SWS.Model", "SWS.Model\SWS.Model.csproj", "{1995385B-D1B0-4C55-835E-D3E769972A6A}" @@ -27,6 +25,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DI-Electrical", "DI-Electri EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SWS.WPF", "SWS.WPF\SWS.WPF.csproj", "{7AFF9117-78E7-4395-9F23-6DCFE09F9299}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SWS.CAD", "SWS.CAD\SWS.CAD.csproj", "{6BD9B3FC-7D55-4762-AF68-A50183342537}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -39,22 +39,6 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {6BD9B3FC-7D55-4762-AF68-A50183342537}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6BD9B3FC-7D55-4762-AF68-A50183342537}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6BD9B3FC-7D55-4762-AF68-A50183342537}.Debug|ARM64.ActiveCfg = Debug|Any CPU - {6BD9B3FC-7D55-4762-AF68-A50183342537}.Debug|ARM64.Build.0 = Debug|Any CPU - {6BD9B3FC-7D55-4762-AF68-A50183342537}.Debug|x64.ActiveCfg = Debug|x64 - {6BD9B3FC-7D55-4762-AF68-A50183342537}.Debug|x64.Build.0 = Debug|x64 - {6BD9B3FC-7D55-4762-AF68-A50183342537}.Debug|x86.ActiveCfg = Debug|x86 - {6BD9B3FC-7D55-4762-AF68-A50183342537}.Debug|x86.Build.0 = Debug|x86 - {6BD9B3FC-7D55-4762-AF68-A50183342537}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6BD9B3FC-7D55-4762-AF68-A50183342537}.Release|Any CPU.Build.0 = Release|Any CPU - {6BD9B3FC-7D55-4762-AF68-A50183342537}.Release|ARM64.ActiveCfg = Release|ARM64 - {6BD9B3FC-7D55-4762-AF68-A50183342537}.Release|ARM64.Build.0 = Release|ARM64 - {6BD9B3FC-7D55-4762-AF68-A50183342537}.Release|x64.ActiveCfg = Release|x64 - {6BD9B3FC-7D55-4762-AF68-A50183342537}.Release|x64.Build.0 = Release|x64 - {6BD9B3FC-7D55-4762-AF68-A50183342537}.Release|x86.ActiveCfg = Release|x86 - {6BD9B3FC-7D55-4762-AF68-A50183342537}.Release|x86.Build.0 = Release|x86 {8740B023-B585-4E69-8521-4F62FA754A1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8740B023-B585-4E69-8521-4F62FA754A1B}.Debug|Any CPU.Build.0 = Debug|Any CPU {8740B023-B585-4E69-8521-4F62FA754A1B}.Debug|ARM64.ActiveCfg = Debug|Any CPU @@ -215,15 +199,31 @@ Global {7AFF9117-78E7-4395-9F23-6DCFE09F9299}.Release|x64.Build.0 = Release|Any CPU {7AFF9117-78E7-4395-9F23-6DCFE09F9299}.Release|x86.ActiveCfg = Release|Any CPU {7AFF9117-78E7-4395-9F23-6DCFE09F9299}.Release|x86.Build.0 = Release|Any CPU + {6BD9B3FC-7D55-4762-AF68-A50183342537}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6BD9B3FC-7D55-4762-AF68-A50183342537}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6BD9B3FC-7D55-4762-AF68-A50183342537}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {6BD9B3FC-7D55-4762-AF68-A50183342537}.Debug|ARM64.Build.0 = Debug|Any CPU + {6BD9B3FC-7D55-4762-AF68-A50183342537}.Debug|x64.ActiveCfg = Debug|Any CPU + {6BD9B3FC-7D55-4762-AF68-A50183342537}.Debug|x64.Build.0 = Debug|Any CPU + {6BD9B3FC-7D55-4762-AF68-A50183342537}.Debug|x86.ActiveCfg = Debug|Any CPU + {6BD9B3FC-7D55-4762-AF68-A50183342537}.Debug|x86.Build.0 = Debug|Any CPU + {6BD9B3FC-7D55-4762-AF68-A50183342537}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6BD9B3FC-7D55-4762-AF68-A50183342537}.Release|Any CPU.Build.0 = Release|Any CPU + {6BD9B3FC-7D55-4762-AF68-A50183342537}.Release|ARM64.ActiveCfg = Release|Any CPU + {6BD9B3FC-7D55-4762-AF68-A50183342537}.Release|ARM64.Build.0 = Release|Any CPU + {6BD9B3FC-7D55-4762-AF68-A50183342537}.Release|x64.ActiveCfg = Release|Any CPU + {6BD9B3FC-7D55-4762-AF68-A50183342537}.Release|x64.Build.0 = Release|Any CPU + {6BD9B3FC-7D55-4762-AF68-A50183342537}.Release|x86.ActiveCfg = Release|Any CPU + {6BD9B3FC-7D55-4762-AF68-A50183342537}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {6BD9B3FC-7D55-4762-AF68-A50183342537} = {00C64D96-E9F1-4525-A542-C7D23206B2E4} {8740B023-B585-4E69-8521-4F62FA754A1B} = {00C64D96-E9F1-4525-A542-C7D23206B2E4} {A399B5A6-0E27-417B-BF2A-6B1FF89EB6A0} = {00C64D96-E9F1-4525-A542-C7D23206B2E4} {924A2824-BE62-42A7-81A8-49BEFCB3801F} = {00C64D96-E9F1-4525-A542-C7D23206B2E4} + {6BD9B3FC-7D55-4762-AF68-A50183342537} = {00C64D96-E9F1-4525-A542-C7D23206B2E4} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {819AA00B-0A09-49DD-AC3A-2AC6041E0524} diff --git a/newFront/c#前端/SWS.CAD/CADFunc/Editor/EditorHelper.cs b/newFront/c#前端/SWS.CAD/CADFunc/Editor/EditorHelper.cs index 655b3f7e..3dab7862 100644 --- a/newFront/c#前端/SWS.CAD/CADFunc/Editor/EditorHelper.cs +++ b/newFront/c#前端/SWS.CAD/CADFunc/Editor/EditorHelper.cs @@ -1,4 +1,5 @@ using Bricscad.ApplicationServices; +using SWS.Commons; using System; using System.Collections.Generic; using System.Linq; diff --git a/newFront/c#前端/SWS.CAD/Commands.cs b/newFront/c#前端/SWS.CAD/Commands.cs index c83b7f0f..86a5ee4d 100644 --- a/newFront/c#前端/SWS.CAD/Commands.cs +++ b/newFront/c#前端/SWS.CAD/Commands.cs @@ -2,34 +2,28 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; -using System.Threading; -using System.Web.UI.WebControls.WebParts; using System.Windows.Forms; -using System.Windows.Interop; -using System.Windows.Threading; -using Aspose.Cells.Charts; using Bricscad.ApplicationServices; using Bricscad.EditorInput; using Bricscad.Ribbon; using Bricscad.Windows; -using Prism.Dialogs; using Prism.Events; using Prism.Ioc; +using Prism.Services.Dialogs; using SWS.CAD; using SWS.CAD.CADFunc; using SWS.CAD.Event; -using SWS.CAD.Models; -using SWS.CAD.Services; using SWS.CAD.Views; -using SWS.CAD.Views.CustomControl; using SWS.CAD.Views.Dialog; -using SWS.CAD.Views.SignalManagementViews; using Teigha.DatabaseServices; using Teigha.Runtime; using Telerik.Windows.Controls; using Unity; using Application = Bricscad.ApplicationServices.Application; using Panel = Bricscad.Windows.Panel; +using GlobalObject = SWS.Commons.GlobalObject; +using SWS.Model; +using SWS.Service; [assembly: CommandClass(typeof(Commands))] @@ -56,7 +50,7 @@ namespace SWS.CAD var drawingView = GlobalObject.container.Resolve(); Panel panel = new Panel(nameof(LeftPanel), dockTemplate, drawingView); panel.Title = "DI_左面板"; - panel.Icon = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.CSharp.ico"); + panel.Icon = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"CSharp.ico"); panel.Visible = true; AddTab(); @@ -69,7 +63,7 @@ namespace SWS.CAD var drawingView2 = GlobalObject.container.Resolve(); panel = new Panel(nameof(RightPanel), dockTemplate2, drawingView2); panel.Title = "DI_右面板"; - panel.Icon = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.CSharp.ico"); + panel.Icon = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"CSharp.ico"); panel.Visible = true; } @@ -116,7 +110,7 @@ namespace SWS.CAD ObservableCollection ReslistPro = new ObservableCollection(); //打开窗体 - Prism.Dialogs.DialogParameters para = new Prism.Dialogs.DialogParameters(); + var para = new Prism.Services.Dialogs.DialogParameters(); para.Add(GlobalObject.dialogPar.title.ToString(), title); para.Add(GlobalObject.dialogPar.para1.ToString(), listPropertys); var _dialogService = GlobalObject._prismContainer.Resolve(); @@ -167,7 +161,7 @@ namespace SWS.CAD } }); - project.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.OpenProject.png"); + project.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"OpenProject.png"); project.Id = "选择项目"; userSource.Items.Add(project); #endregion @@ -180,7 +174,7 @@ namespace SWS.CAD { MessageBox.Show("功能开发中..."); }); - btnRefresh.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.RefreshProject.png"); + btnRefresh.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"RefreshProject.png"); btnRefresh.Id = "刷新项目"; userSource.Items.Add(btnRefresh); #endregion @@ -200,7 +194,7 @@ namespace SWS.CAD //Application.ShowModalDialog(Application.MainWindow,);// 用来显示WinForms对话框 Application.ShowModalWindow(Application.MainWindow.Handle, loginView);//用来显示WPF的对话框,任务栏里可以看到2个Windows }); - login.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.Login.png"); + login.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"Login.png"); login.Id = "用户登录"; //userSource.Items.Add(login); ribbonRowPanel.Items.Add(login); @@ -215,7 +209,7 @@ namespace SWS.CAD { MessageBox.Show("功能开发中..."); }); - btnProperty.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.Message.png"); + btnProperty.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"Message.png"); btnProperty.Id = "属性窗口"; ribbonRowPanel.Items.Add(btnProperty); ribbonRowPanel.Items.Add(new RibbonRowBreak());//换行,这样可以使按钮多行排列 @@ -236,7 +230,7 @@ namespace SWS.CAD { var View = GlobalObject.container.Resolve(); var eventAggregator = GlobalObject.container.Resolve(); - eventAggregator.GetEvent().Publish(new System.Collections.Generic.List()); + eventAggregator.GetEvent().Publish(new List()); Application.ShowModalWindow(Application.MainWindow.Handle, View); } catch (System.Exception ex) @@ -245,7 +239,7 @@ namespace SWS.CAD } }); - UserNotification.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.Message.png"); + UserNotification.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"Message.png"); UserNotification.Id = "项目消息"; //userSource.Items.Add(UserNotification); ribbonRowPanel.Items.Add(UserNotification); @@ -273,7 +267,7 @@ namespace SWS.CAD { MessageBox.Show("功能开发中..."); }); - btnCableDrop.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.CalCable.png"); + btnCableDrop.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"CalCable.png"); btnCableDrop.Id = "电缆压降"; ribbonRowPanel.Items.Add(btnCableDrop); ribbonRowPanel.Items.Add(new RibbonRowBreak());//换行,这样可以使按钮多行排列 @@ -287,7 +281,7 @@ namespace SWS.CAD { MessageBox.Show("功能开发中..."); }); - btnCalBoot.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.CalBoot.png"); + btnCalBoot.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"CalBoot.png"); btnCalBoot.Id = "启动顺序"; ribbonRowPanel.Items.Add(btnCalBoot); #endregion @@ -311,7 +305,7 @@ namespace SWS.CAD { MessageBox.Show("功能开发中..."); }); - btnLightLine.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.lightLine.png"); + btnLightLine.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"lightLine.png"); btnLightLine.Id = "绘照明线路"; designSource.Items.Add(btnLightLine); #endregion @@ -326,7 +320,7 @@ namespace SWS.CAD { MessageBox.Show("功能开发中..."); }); - btnEquipmentjoin.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.Equipmentjoin.png"); + btnEquipmentjoin.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"Equipmentjoin.png"); btnEquipmentjoin.Id = "生成端子图"; ribbonRowPanel.Items.Add(btnEquipmentjoin); ribbonRowPanel.Items.Add(new RibbonRowBreak());//换行,这样可以使按钮多行排列 @@ -340,7 +334,7 @@ namespace SWS.CAD { MessageBox.Show("功能开发中..."); }); - btnJoinSys.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.joinsys.png"); + btnJoinSys.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"joinsys.png"); btnJoinSys.Id = "生成系统图"; ribbonRowPanel.Items.Add(btnJoinSys); ribbonRowPanel.Items.Add(new RibbonRowBreak());//换行,这样可以使按钮多行排列 @@ -354,7 +348,7 @@ namespace SWS.CAD { MessageBox.Show("功能开发中..."); }); - btnOPC.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.OPC.png"); + btnOPC.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"OPC.png"); btnOPC.Id = "生成OPC"; ribbonRowPanel.Items.Add(btnOPC); #endregion @@ -370,7 +364,7 @@ namespace SWS.CAD { MessageBox.Show("功能开发中..."); }); - btnPlaneLayout.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.PlaneLayout.png"); + btnPlaneLayout.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"PlaneLayout.png"); btnPlaneLayout.Id = "生成布置图"; ribbonRowPanel.Items.Add(btnPlaneLayout); ribbonRowPanel.Items.Add(new RibbonRowBreak());//换行,这样可以使按钮多行排列 @@ -384,7 +378,7 @@ namespace SWS.CAD { MessageBox.Show("功能开发中..."); }); - btnEquipmentSys.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.EquipmentSys.png"); + btnEquipmentSys.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"EquipmentSys.png"); btnEquipmentSys.Id = "生成链路系统图"; ribbonRowPanel.Items.Add(btnEquipmentSys); ribbonRowPanel.Items.Add(new RibbonRowBreak());//换行,这样可以使按钮多行排列 @@ -398,7 +392,7 @@ namespace SWS.CAD { MessageBox.Show("功能开发中..."); }); - btnBatchSwitch.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.BatchSwitch.png"); + btnBatchSwitch.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"BatchSwitch.png"); btnBatchSwitch.Id = "照明回路开关"; ribbonRowPanel.Items.Add(btnBatchSwitch); #endregion @@ -423,7 +417,7 @@ namespace SWS.CAD { MessageBox.Show("功能开发中..."); }); - btnSwitchbox.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.Switchbox.png"); + btnSwitchbox.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"Switchbox.png"); btnSwitchbox.Id = "分电箱"; dataSource.Items.Add(btnSwitchbox); #endregion @@ -501,7 +495,7 @@ namespace SWS.CAD }; //打开窗体 - Prism.Dialogs.DialogParameters para = new Prism.Dialogs.DialogParameters(); + var para = new Prism.Services.Dialogs.DialogParameters(); para.Add(GlobalObject.dialogPar.info.ToString(), res[0]); para.Add(GlobalObject.dialogPar.para1.ToString(), model1); para.Add(GlobalObject.dialogPar.para2.ToString(), model2); @@ -517,7 +511,7 @@ namespace SWS.CAD }); #endregion }); - btnParallel.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.Parallel.png"); + btnParallel.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"Parallel.png"); btnParallel.Id = "平行电缆"; ribbonRowPanel.Items.Add(btnParallel); ribbonRowPanel.Items.Add(new RibbonRowBreak());//换行,这样可以使按钮多行排列 @@ -544,7 +538,7 @@ namespace SWS.CAD Database db = doc.Database; Editor ed = doc.Editor; //选择的元素返回的属性信息 - var ResTagInfosByPixels = new ec_objecttype(); + var ResTagInfosByPixels = new Model.ec_objecttype(); var listPropertys = new List(); // 持续选择直到获取有效电缆 bool isValidCable = false; @@ -759,7 +753,7 @@ namespace SWS.CAD IntPtr cadHandle = Bricscad.ApplicationServices.Application.MainWindow.Handle; //打开窗体 - Prism.Dialogs.DialogParameters para = new Prism.Dialogs.DialogParameters(); + var para = new Prism.Services.Dialogs.DialogParameters(); //para.Add(GlobalObject.dialogPar.para1.ToString(), "6e2919e4-28cd-4fb6-9035-10b2ff0e30fb"); para.Add(GlobalObject.dialogPar.info.ToString(), cadHandle); @@ -788,7 +782,7 @@ namespace SWS.CAD #endregion }); - btnCableConnect.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.CableConnect.png"); + btnCableConnect.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"CableConnect.png"); btnCableConnect.Id = "电缆连接"; ribbonRowPanel.Items.Add(btnCableConnect); ribbonRowPanel.Items.Add(new RibbonRowBreak());//换行,这样可以使按钮多行排列 @@ -801,7 +795,7 @@ namespace SWS.CAD btnIO.CommandHandler = new DelegateCommand(x => { //打开窗体 - Prism.Dialogs.DialogParameters para = new Prism.Dialogs.DialogParameters(); + var para = new Prism.Services.Dialogs.DialogParameters(); var _dialogService = GlobalObject._prismContainer.Resolve(); _dialogService.ShowDialog(nameof(DialogIODistribution), para, (RES) => { @@ -813,7 +807,7 @@ namespace SWS.CAD { } }); }); - btnIO.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.IO.png"); + btnIO.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"IO.png"); btnIO.Id = "IO分配"; ribbonRowPanel.Items.Add(btnIO); #endregion @@ -827,10 +821,15 @@ namespace SWS.CAD btnSinalManage.ButtonStyle = RibbonButtonStyle.SmallWithText; btnSinalManage.CommandHandler = new DelegateCommand(x => { + if (GlobalObject.userInfo == null || GlobalObject.curProject == null) + { + MessageBox.Show("请先登录系统并选择项目!"); + return; + } //打开窗体 - Prism.Dialogs.DialogParameters para = new Prism.Dialogs.DialogParameters(); + var para = new Prism.Services.Dialogs.DialogParameters(); var _dialogService = GlobalObject._prismContainer.Resolve(); - _dialogService.ShowDialog(nameof(DialogSignalManagement), para, (RES) => + _dialogService.ShowDialog(nameof(SWS.WPF.Views.DialogSignalManagement), para, (RES) => { if (RES.Result == ButtonResult.Yes) { @@ -840,7 +839,7 @@ namespace SWS.CAD { } }); }); - btnSinalManage.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.SinalManage.png"); + btnSinalManage.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SinalManage.png"); btnSinalManage.Id = "信号管理"; ribbonRowPanel.Items.Add(btnSinalManage); ribbonRowPanel.Items.Add(new RibbonRowBreak());//换行,这样可以使按钮多行排列 @@ -854,7 +853,7 @@ namespace SWS.CAD { MessageBox.Show("功能开发中..."); }); - btnCableSinal.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.CableSinal.png"); + btnCableSinal.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"CableSinal.png"); btnCableSinal.Id = "信号预分配"; ribbonRowPanel.Items.Add(btnCableSinal); ribbonRowPanel.Items.Add(new RibbonRowBreak());//换行,这样可以使按钮多行排列 @@ -868,7 +867,7 @@ namespace SWS.CAD { MessageBox.Show("功能开发中..."); }); - btnRelevancy.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.relevancy.png"); + btnRelevancy.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"relevancy.png"); btnRelevancy.Id = "批量反向关联"; ribbonRowPanel.Items.Add(btnRelevancy); #endregion @@ -884,7 +883,7 @@ namespace SWS.CAD { MessageBox.Show("功能开发中..."); }); - btnGraphRec.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.GraphRec.png"); + btnGraphRec.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"GraphRec.png"); btnGraphRec.Id = "系统图识别"; ribbonRowPanel.Items.Add(btnGraphRec); ribbonRowPanel.Items.Add(new RibbonRowBreak());//换行,这样可以使按钮多行排列 @@ -898,7 +897,7 @@ namespace SWS.CAD { MessageBox.Show("功能开发中..."); }); - btnVerticalRec.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.VerticalRec.png"); + btnVerticalRec.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"VerticalRec.png"); btnVerticalRec.Id = "竖向图识别"; ribbonRowPanel.Items.Add(btnVerticalRec); ribbonRowPanel.Items.Add(new RibbonRowBreak());//换行,这样可以使按钮多行排列 @@ -912,7 +911,7 @@ namespace SWS.CAD { MessageBox.Show("功能开发中..."); }); - btnLightLineRec.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.lightLine.png"); + btnLightLineRec.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"lightLine.png"); btnLightLineRec.Id = "链路图识别"; ribbonRowPanel.Items.Add(btnLightLineRec); #endregion @@ -936,7 +935,7 @@ namespace SWS.CAD { MessageBox.Show("功能开发中..."); }); - btnRefreshText.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.RefreshText.png"); + btnRefreshText.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"RefreshText.png"); btnRefreshText.Id = "刷新标注"; dwgRefreshSource.Items.Add(btnRefreshText); #endregion @@ -951,7 +950,7 @@ namespace SWS.CAD { MessageBox.Show("功能开发中..."); }); - btnRefreshBlock.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.RefreshBlock.png"); + btnRefreshBlock.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"RefreshBlock.png"); btnRefreshBlock.Id = "刷新元件"; ribbonRowPanel.Items.Add(btnRefreshBlock); ribbonRowPanel.Items.Add(new RibbonRowBreak());//换行,这样可以使按钮多行排列 @@ -965,7 +964,7 @@ namespace SWS.CAD { MessageBox.Show("功能开发中..."); }); - btnRefreshFrame.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.RefreshFrame.png"); + btnRefreshFrame.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"RefreshFrame.png"); btnRefreshFrame.Id = "刷新图框"; ribbonRowPanel.Items.Add(btnRefreshFrame); ribbonRowPanel.Items.Add(new RibbonRowBreak());//换行,这样可以使按钮多行排列 @@ -980,7 +979,7 @@ namespace SWS.CAD var configView = GlobalObject.container.Resolve(); Application.ShowModalWindow(Application.MainWindow.Handle, configView); }); - btnRefreshLink.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.RefreshLink.png"); + btnRefreshLink.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"RefreshLink.png"); btnRefreshLink.Id = "刷新连接"; ribbonRowPanel.Items.Add(btnRefreshLink); #endregion @@ -996,7 +995,7 @@ namespace SWS.CAD { MessageBox.Show("功能开发中..."); }); - btnShowLink.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.ShowLink.png"); + btnShowLink.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"ShowLink.png"); btnShowLink.Id = "查看链路"; ribbonRowPanel.Items.Add(btnShowLink); ribbonRowPanel.Items.Add(new RibbonRowBreak());//换行,这样可以使按钮多行排列 @@ -1010,7 +1009,7 @@ namespace SWS.CAD { MessageBox.Show("功能开发中..."); }); - btnUpdatePosition.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.UpdatePosition.png"); + btnUpdatePosition.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"UpdatePosition.png"); btnUpdatePosition.Id = "刷新位置"; ribbonRowPanel.Items.Add(btnUpdatePosition); ribbonRowPanel.Items.Add(new RibbonRowBreak());//换行,这样可以使按钮多行排列 @@ -1024,7 +1023,7 @@ namespace SWS.CAD { MessageBox.Show("功能开发中..."); }); - btnRefreshPosition.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.RefreshPosition.png"); + btnRefreshPosition.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"RefreshPosition.png"); btnRefreshPosition.Id = "刷新坐标"; ribbonRowPanel.Items.Add(btnRefreshPosition); #endregion @@ -1040,7 +1039,7 @@ namespace SWS.CAD { MessageBox.Show("功能开发中..."); }); - btnActiveObject.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.ActiveObject.png"); + btnActiveObject.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"ActiveObject.png"); btnActiveObject.Id = "图元高亮"; ribbonRowPanel.Items.Add(btnActiveObject); ribbonRowPanel.Items.Add(new RibbonRowBreak());//换行,这样可以使按钮多行排列 @@ -1066,7 +1065,7 @@ namespace SWS.CAD { MessageBox.Show("功能开发中..."); }); - btnImput.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.Imput.png"); + btnImput.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"Imput.png"); btnImput.Id = "元件导入"; ribbonRowPanel.Items.Add(btnImput); ribbonRowPanel.Items.Add(new RibbonRowBreak());//换行,这样可以使按钮多行排列 @@ -1080,7 +1079,7 @@ namespace SWS.CAD { MessageBox.Show("功能开发中..."); }); - btnExport.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.Export.png"); + btnExport.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"Export.png"); btnExport.Id = "元件导出"; ribbonRowPanel.Items.Add(btnExport); #endregion @@ -1096,7 +1095,7 @@ namespace SWS.CAD { MessageBox.Show("功能开发中..."); }); - btnCheckCable.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.CheckCable.png"); + btnCheckCable.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"CheckCable.png"); btnCheckCable.Id = "电缆检查"; ribbonRowPanel.Items.Add(btnCheckCable); ribbonRowPanel.Items.Add(new RibbonRowBreak());//换行,这样可以使按钮多行排列 @@ -1110,7 +1109,7 @@ namespace SWS.CAD { MessageBox.Show("功能开发中..."); }); - btnPropertyCheck.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.Property.png"); + btnPropertyCheck.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"Property.png"); btnPropertyCheck.Id = "属性检查"; ribbonRowPanel.Items.Add(btnPropertyCheck); #endregion @@ -1140,7 +1139,7 @@ namespace SWS.CAD { MessageBox.Show("功能开发中..."); }); - btnDwgConfig.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.DConfig.png"); + btnDwgConfig.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"DConfig.png"); btnDwgConfig.Id = "绘图配置"; splitButton.Items.Add(btnDwgConfig); #endregion @@ -1153,7 +1152,7 @@ namespace SWS.CAD { MessageBox.Show("功能开发中..."); }); - btnAaConfig.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.TConfig.png"); + btnAaConfig.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"TConfig.png"); btnAaConfig.Id = "标注配置"; splitButton.Items.Add(btnAaConfig); #endregion @@ -1167,7 +1166,7 @@ namespace SWS.CAD var configView = GlobalObject.container.Resolve(); Application.ShowModalWindow(Application.MainWindow.Handle, configView); }); - btnSystemConfig.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.SConfig.png"); + btnSystemConfig.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SConfig.png"); btnSystemConfig.Id = "系统配置"; splitButton.Items.Add(btnSystemConfig); #endregion diff --git a/newFront/c#前端/SWS.CAD/Event/GetHandsIdEvent.cs b/newFront/c#前端/SWS.CAD/Event/GetHandsIdEvent.cs index 838a819e..95903926 100644 --- a/newFront/c#前端/SWS.CAD/Event/GetHandsIdEvent.cs +++ b/newFront/c#前端/SWS.CAD/Event/GetHandsIdEvent.cs @@ -1,11 +1,5 @@ -using Newtonsoft.Json.Linq; -using Prism.Events; -using SWS.CAD.Models; -using System; +using Prism.Events; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SWS.CAD.Event { diff --git a/newFront/c#前端/SWS.CAD/Event/GetdwgFileIdEvent.cs b/newFront/c#前端/SWS.CAD/Event/GetdwgFileIdEvent.cs index 408c27e1..f03c1b60 100644 --- a/newFront/c#前端/SWS.CAD/Event/GetdwgFileIdEvent.cs +++ b/newFront/c#前端/SWS.CAD/Event/GetdwgFileIdEvent.cs @@ -1,11 +1,4 @@ -using Newtonsoft.Json.Linq; -using Prism.Events; -using SWS.CAD.Models; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using Prism.Events; namespace SWS.CAD.Event { diff --git a/newFront/c#前端/SWS.CAD/Event/IORelationEvent.cs b/newFront/c#前端/SWS.CAD/Event/IORelationEvent.cs index 47ab097e..a408c4c1 100644 --- a/newFront/c#前端/SWS.CAD/Event/IORelationEvent.cs +++ b/newFront/c#前端/SWS.CAD/Event/IORelationEvent.cs @@ -1,11 +1,5 @@ using Newtonsoft.Json.Linq; using Prism.Events; -using SWS.CAD.Models; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SWS.CAD.Event { diff --git a/newFront/c#前端/SWS.CAD/Event/NewComponent_LostFocusEvent.cs b/newFront/c#前端/SWS.CAD/Event/NewComponent_LostFocusEvent.cs index 03c1f203..aaa1806b 100644 --- a/newFront/c#前端/SWS.CAD/Event/NewComponent_LostFocusEvent.cs +++ b/newFront/c#前端/SWS.CAD/Event/NewComponent_LostFocusEvent.cs @@ -1,12 +1,6 @@ using Newtonsoft.Json.Linq; using Prism.Events; -using SWS.CAD.Models; -using SWS.CAD.Views.CustomControl; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using SWS.Model; namespace SWS.CAD.Event { diff --git a/newFront/c#前端/SWS.CAD/Event/NewPositional_SelectChangeEvent.cs b/newFront/c#前端/SWS.CAD/Event/NewPositional_SelectChangeEvent.cs index c6c14acf..dd2b9e53 100644 --- a/newFront/c#前端/SWS.CAD/Event/NewPositional_SelectChangeEvent.cs +++ b/newFront/c#前端/SWS.CAD/Event/NewPositional_SelectChangeEvent.cs @@ -1,12 +1,6 @@ using Newtonsoft.Json.Linq; using Prism.Events; -using SWS.CAD.Models; -using SWS.CAD.Views.CustomControl; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using SWS.Model; namespace SWS.CAD.Event { diff --git a/newFront/c#前端/SWS.CAD/Event/SelectProjectEvent.cs b/newFront/c#前端/SWS.CAD/Event/SelectProjectEvent.cs index cb61df32..24c78454 100644 --- a/newFront/c#前端/SWS.CAD/Event/SelectProjectEvent.cs +++ b/newFront/c#前端/SWS.CAD/Event/SelectProjectEvent.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using Prism.Events; -using SWS.CAD.Models; +using SWS.Model; namespace SWS.CAD.Event { diff --git a/newFront/c#前端/SWS.CAD/Event/SelectionChangeEvent.cs b/newFront/c#前端/SWS.CAD/Event/SelectionChangeEvent.cs index a7d23b3c..12d93fdc 100644 --- a/newFront/c#前端/SWS.CAD/Event/SelectionChangeEvent.cs +++ b/newFront/c#前端/SWS.CAD/Event/SelectionChangeEvent.cs @@ -1,12 +1,6 @@ using Newtonsoft.Json.Linq; using Prism.Events; -using SWS.CAD.Models; -using SWS.CAD.Views.CustomControl; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using SWS.Model; namespace SWS.CAD.Event { diff --git a/newFront/c#前端/SWS.CAD/Event/checkInEvent.cs b/newFront/c#前端/SWS.CAD/Event/checkInEvent.cs index 0f2a455e..2797bc89 100644 --- a/newFront/c#前端/SWS.CAD/Event/checkInEvent.cs +++ b/newFront/c#前端/SWS.CAD/Event/checkInEvent.cs @@ -1,12 +1,5 @@ -using Newtonsoft.Json.Linq; -using Prism.Events; -using SWS.CAD.Models; -using SWS.CAD.Models.NoEntity; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using Prism.Events; +using SWS.Model; namespace SWS.CAD.Event { diff --git a/newFront/c#前端/SWS.CAD/Event/checkInResultEvent.cs b/newFront/c#前端/SWS.CAD/Event/checkInResultEvent.cs index e6918510..297c5906 100644 --- a/newFront/c#前端/SWS.CAD/Event/checkInResultEvent.cs +++ b/newFront/c#前端/SWS.CAD/Event/checkInResultEvent.cs @@ -1,12 +1,4 @@ -using Newtonsoft.Json.Linq; -using Prism.Events; -using SWS.CAD.Models; -using SWS.CAD.Models.NoEntity; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using Prism.Events; namespace SWS.CAD.Event { diff --git a/newFront/c#前端/SWS.CAD/Event/drawingChangeEvent.cs b/newFront/c#前端/SWS.CAD/Event/drawingChangeEvent.cs index c95f10ea..ce7e6e6e 100644 --- a/newFront/c#前端/SWS.CAD/Event/drawingChangeEvent.cs +++ b/newFront/c#前端/SWS.CAD/Event/drawingChangeEvent.cs @@ -1,6 +1,6 @@ using Newtonsoft.Json.Linq; using Prism.Events; -using SWS.CAD.Models; +using SWS.Model; using System; using System.Collections.Generic; using System.Linq; diff --git a/newFront/c#前端/SWS.CAD/Event/getPropertyEvent.cs b/newFront/c#前端/SWS.CAD/Event/getPropertyEvent.cs index cd07c0e3..76d1e83d 100644 --- a/newFront/c#前端/SWS.CAD/Event/getPropertyEvent.cs +++ b/newFront/c#前端/SWS.CAD/Event/getPropertyEvent.cs @@ -1,11 +1,5 @@ -using Newtonsoft.Json.Linq; -using Prism.Events; -using SWS.CAD.Models; -using System; +using Prism.Events; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SWS.CAD.Event { diff --git a/newFront/c#前端/SWS.CAD/Event/propertyChangeEvent.cs b/newFront/c#前端/SWS.CAD/Event/propertyChangeEvent.cs index e682c45b..eba42ae1 100644 --- a/newFront/c#前端/SWS.CAD/Event/propertyChangeEvent.cs +++ b/newFront/c#前端/SWS.CAD/Event/propertyChangeEvent.cs @@ -1,12 +1,6 @@ using Newtonsoft.Json.Linq; using Prism.Events; -using SWS.CAD.Models; -using SWS.CAD.Views.CustomControl; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using SWS.Model; namespace SWS.CAD.Event { diff --git a/newFront/c#前端/SWS.CAD/Event/selectPixelsEvent.cs b/newFront/c#前端/SWS.CAD/Event/selectPixelsEvent.cs index a4f725c4..3e84d44e 100644 --- a/newFront/c#前端/SWS.CAD/Event/selectPixelsEvent.cs +++ b/newFront/c#前端/SWS.CAD/Event/selectPixelsEvent.cs @@ -1,11 +1,5 @@ using Newtonsoft.Json.Linq; using Prism.Events; -using SWS.CAD.Models; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SWS.CAD.Event { diff --git a/newFront/c#前端/SWS.CAD/Event/tagChangeEvent.cs b/newFront/c#前端/SWS.CAD/Event/tagChangeEvent.cs index 988ab74b..fab05a62 100644 --- a/newFront/c#前端/SWS.CAD/Event/tagChangeEvent.cs +++ b/newFront/c#前端/SWS.CAD/Event/tagChangeEvent.cs @@ -1,15 +1,9 @@ using Newtonsoft.Json.Linq; using Prism.Events; -using SWS.CAD.Models; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SWS.CAD.Event { - public class tagChangeEvent : PubSubEvent + public class tagChangeEvent : PubSubEvent { } } diff --git a/newFront/c#前端/SWS.CAD/Event/treeNodeChangeEvent.cs b/newFront/c#前端/SWS.CAD/Event/treeNodeChangeEvent.cs index 3e2861f6..4ae1b3cf 100644 --- a/newFront/c#前端/SWS.CAD/Event/treeNodeChangeEvent.cs +++ b/newFront/c#前端/SWS.CAD/Event/treeNodeChangeEvent.cs @@ -1,15 +1,9 @@ using Newtonsoft.Json.Linq; using Prism.Events; -using SWS.CAD.Models; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SWS.CAD.Event { - public class treeNodeChangeEvent : PubSubEvent + public class treeNodeChangeEvent : PubSubEvent { } } diff --git a/newFront/c#前端/SWS.CAD/GlobalObject.cs b/newFront/c#前端/SWS.CAD/GlobalObje.cs similarity index 88% rename from newFront/c#前端/SWS.CAD/GlobalObject.cs rename to newFront/c#前端/SWS.CAD/GlobalObje.cs index 6955ecae..d235b2e6 100644 --- a/newFront/c#前端/SWS.CAD/GlobalObject.cs +++ b/newFront/c#前端/SWS.CAD/GlobalObje.cs @@ -1,29 +1,23 @@ using IniParser; using Prism.Ioc; -using SWS.CAD.Models; -using SWS.CAD.Models.NoEntity; -using SWS.CAD.Services; +using SWS.Model; +using SWS.Service; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; using System.Linq; -using System.Net; using System.Net.Http; -using System.Runtime.InteropServices; -using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Windows; -using System.Windows.Documents; -using System.Windows.Forms; using System.Windows.Media; using Unity; using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel; namespace SWS.CAD { - public class GlobalObject + public class GlobalObje { public static string templateForDrawing = "普通图框"; public static string editorPre = "DI_Electrical "; @@ -54,18 +48,18 @@ namespace SWS.CAD } #region 图纸类型 - static List _dwgType; + static List _dwgType; /// /// 初始化图纸类型列表 /// /// - public static List DwgType() + public static List DwgType() { var res0 = new ec_dataitem { DataItemName = "图纸类型", DataItemCode = DBConst.Be_DrawingType.ToString() }; if (_dwgType == null) { - var serv = GlobalObject.container.Resolve(); + var serv = GlobalObje.container.Resolve(); var res = Task.Run(() => serv.GetDetails(DBConst.Be_DrawingType.ToString())); var res2 = res.Result; return res2; @@ -78,18 +72,18 @@ namespace SWS.CAD #endregion #region 材料范围 - static List _dwgMaterialRange; + static List _dwgMaterialRange; /// /// 初始化材料材料范围 /// /// - public static List DwgMaterialRange() + public static List DwgMaterialRange() { var res0 = new ec_dataitem { DataItemName = "材料范围", DataItemCode = DBConst.Be_MaterialRange.ToString() }; if (_dwgMaterialRange == null) { - var serv = GlobalObject.container.Resolve(); + var serv = GlobalObje.container.Resolve(); var res = Task.Run(() => serv.GetDetails(DBConst.Be_MaterialRange.ToString())); var res2 = res.Result; return res2; @@ -102,18 +96,18 @@ namespace SWS.CAD #endregion #region 材料统计 - static List _dwgMaterialCensus; + static List _dwgMaterialCensus; /// /// 初始化材料统计列表 /// /// - public static List DwgMaterialCensus() + public static List DwgMaterialCensus() { var res0 = new ec_dataitem { DataItemName = "材料统计", DataItemCode = DBConst.Be_MaterialCensus.ToString() }; if (_dwgMaterialCensus == null) { - var serv = GlobalObject.container.Resolve(); + var serv = GlobalObje.container.Resolve(); var res = Task.Run(() => serv.GetDetails(DBConst.Be_MaterialCensus.ToString())); var res2 = res.Result; return res2; @@ -126,18 +120,18 @@ namespace SWS.CAD #endregion #region 图纸阶段 - static List _dwgStage; + static List _dwgStage; /// /// 初始化图纸阶段列表 /// /// - public static List DwgStage() + public static List DwgStage() { var res0 = new ec_dataitem { DataItemName = "图纸阶段", DataItemCode = DBConst.Be_DrawingStage.ToString() }; if (_dwgStage == null) { - var serv = GlobalObject.container.Resolve(); + var serv = GlobalObje.container.Resolve(); var res = Task.Run(() => serv.GetDetails(DBConst.Be_DrawingStage.ToString())); var res2 = res.Result; return res2; @@ -150,18 +144,18 @@ namespace SWS.CAD #endregion #region 图纸系统 - static ObservableCollection _dwgSystem; + static ObservableCollection _dwgSystem; /// /// 初始化图纸系统列表 /// /// - public static ObservableCollection DwgSystem() + public static ObservableCollection DwgSystem() { var res0 = new ec_dataitem { DataItemName = "图纸系统", DataItemCode = DBConst.Be_DrawingSystem.ToString() }; if (_dwgSystem == null) { - var serv = GlobalObject.container.Resolve(); + var serv = GlobalObje.container.Resolve(); var res = Task.Run(() => serv.GetDetails(DBConst.Be_DrawingSystem.ToString())); var res2 = res.Result; var res3 = DataItemDetailsToTree(res2); @@ -181,10 +175,10 @@ namespace SWS.CAD /// 列表数据 /// 是否子节点遍历添加 /// - public static ObservableCollection DataItemDetailsToTree(List listData, bool isChildres = false) + public static ObservableCollection DataItemDetailsToTree(List listData, bool isChildres = false) { - ObservableCollection result = new ObservableCollection(); - List list = new List(); + ObservableCollection result = new ObservableCollection(); + List list = new List(); if (isChildres) { list = listData; } else @@ -200,7 +194,7 @@ namespace SWS.CAD { //获取子节点 var childrens = DataItemDetailsToTree(details, true); - result.Add(new TreeModel + result.Add(new Model.TreeModel { ID = data.DataItemDetailID, Text = data.DataItemName, @@ -210,7 +204,7 @@ namespace SWS.CAD else { //没有子节点就添加当前节点Node - result.Add(new TreeModel + result.Add(new Model.TreeModel { ID = data.DataItemDetailID, Text = data.DataItemName, @@ -226,14 +220,14 @@ namespace SWS.CAD /// /// 对象类型树 /// - public static List objectTypeTree = new List(); + public static List objectTypeTree = new List(); #endregion #region 设计浏览树 /// /// 设计浏览树 /// - public static List designTree = new List(); + public static List designTree = new List(); #endregion public enum dialogPar diff --git a/newFront/c#前端/SWS.CAD/Helper/ConfigService.cs b/newFront/c#前端/SWS.CAD/Helper/ConfigService.cs index c4ee52fd..d48998d0 100644 --- a/newFront/c#前端/SWS.CAD/Helper/ConfigService.cs +++ b/newFront/c#前端/SWS.CAD/Helper/ConfigService.cs @@ -1,8 +1,8 @@ using IniParser; -using SWS.CAD.Services; +using SWS.Commons; +using SWS.Service; using System; using System.IO; -using System.Windows.Media.Animation; namespace SWS.CAD.Helper { diff --git a/newFront/c#前端/SWS.CAD/Helper/Converter/CollectionToStringConverter.cs b/newFront/c#前端/SWS.CAD/Helper/Converter/CollectionToStringConverter.cs index 700e7833..3c59be95 100644 --- a/newFront/c#前端/SWS.CAD/Helper/Converter/CollectionToStringConverter.cs +++ b/newFront/c#前端/SWS.CAD/Helper/Converter/CollectionToStringConverter.cs @@ -2,7 +2,7 @@ using System.Collections.ObjectModel; using System.Globalization; using System.Windows.Data; -using SWS.CAD.Models; +using SWS.Model; namespace SWS.CAD.Helper.Converter { diff --git a/newFront/c#前端/SWS.CAD/Helper/Converter/ComboBoxFilterConverter.cs b/newFront/c#前端/SWS.CAD/Helper/Converter/ComboBoxFilterConverter.cs index 1ac09208..936316b9 100644 --- a/newFront/c#前端/SWS.CAD/Helper/Converter/ComboBoxFilterConverter.cs +++ b/newFront/c#前端/SWS.CAD/Helper/Converter/ComboBoxFilterConverter.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Globalization; using System.Windows.Data; -using SWS.CAD.Models; using static OfficeOpenXml.ExcelErrorValue; namespace SWS.CAD.Helper.Converter diff --git a/newFront/c#前端/SWS.CAD/Helper/Converter/RadGridViewRowToBoolConverter.cs b/newFront/c#前端/SWS.CAD/Helper/Converter/RadGridViewRowToBoolConverter.cs index 6e99072a..85d172cd 100644 --- a/newFront/c#前端/SWS.CAD/Helper/Converter/RadGridViewRowToBoolConverter.cs +++ b/newFront/c#前端/SWS.CAD/Helper/Converter/RadGridViewRowToBoolConverter.cs @@ -6,6 +6,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Data; using SWS.CAD.ViewModels; +using SWS.Model; namespace SWS.CAD.Helper.Converter { diff --git a/newFront/c#前端/SWS.CAD/Helper/Converter/SelectedItemToBoolConverter.cs b/newFront/c#前端/SWS.CAD/Helper/Converter/SelectedItemToBoolConverter.cs index e8e085ac..b8fe196b 100644 --- a/newFront/c#前端/SWS.CAD/Helper/Converter/SelectedItemToBoolConverter.cs +++ b/newFront/c#前端/SWS.CAD/Helper/Converter/SelectedItemToBoolConverter.cs @@ -1,14 +1,6 @@ using System; -using System.Collections.Generic; using System.Globalization; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; using System.Windows.Data; -using SWS.CAD.Models; -using SWS.CAD.ViewModels; -using Teigha.GraphicsSystem; namespace SWS.CAD.Helper.Converter { @@ -20,7 +12,7 @@ namespace SWS.CAD.Helper.Converter if (values[0] != null) { - TreeModel c = (TreeModel)values[0]; + Model.TreeModel c = (Model.TreeModel)values[0]; dynamic dynamicObj = c.NodeExtData; string PanelIDValue = dynamicObj.PanelID; if (c.NodeType.Equals("0")) diff --git a/newFront/c#前端/SWS.CAD/Helper/Converter/StatusToColourConverter.cs b/newFront/c#前端/SWS.CAD/Helper/Converter/StatusToColourConverter.cs index 495a530b..d44a1348 100644 --- a/newFront/c#前端/SWS.CAD/Helper/Converter/StatusToColourConverter.cs +++ b/newFront/c#前端/SWS.CAD/Helper/Converter/StatusToColourConverter.cs @@ -6,6 +6,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Data; using SWS.CAD.ViewModels; +using SWS.Model; namespace SWS.CAD.Helper.Converter { diff --git a/newFront/c#前端/SWS.CAD/Helper/TreeHelper.cs b/newFront/c#前端/SWS.CAD/Helper/TreeHelper.cs index d3fe31d0..1682d52b 100644 --- a/newFront/c#前端/SWS.CAD/Helper/TreeHelper.cs +++ b/newFront/c#前端/SWS.CAD/Helper/TreeHelper.cs @@ -3,7 +3,8 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using SWS.CAD.Models; +using SWS.Commons; +using SWS.Model; namespace SWS.CAD.Helper { @@ -14,7 +15,7 @@ namespace SWS.CAD.Helper /// /// 获取树节点 /// - public static TreeModel GetTreeModel(TreeModel node, string id) + public static Model.TreeModel GetTreeModel(TreeModel node, string id) { // 如果根节点为空,则返回null if (node == null) return null; @@ -41,9 +42,9 @@ namespace SWS.CAD.Helper /// /// 获取树节点 /// - public static TreeModel GetTreeModel(List nodes, string id) + public static Model.TreeModel GetTreeModel(List nodes, string id) { - TreeModel node = null; + Model.TreeModel node = null; foreach (var dto in GlobalObject.objectTypeTree) { //获取节点下的图纸 @@ -62,7 +63,7 @@ namespace SWS.CAD.Helper /// /// 获取树节点所有图纸名 /// - public static void GetTreeText(TreeModel node) + public static void GetTreeText(Model.TreeModel node) { // 如果根节点为空,则返回null if (node == null) return ; diff --git a/newFront/c#前端/SWS.CAD/Models/NoEntity/Debouncer.cs b/newFront/c#前端/SWS.CAD/Models/NoEntity/Debouncer.cs new file mode 100644 index 00000000..5fef75b5 --- /dev/null +++ b/newFront/c#前端/SWS.CAD/Models/NoEntity/Debouncer.cs @@ -0,0 +1,34 @@ +using System.Threading; +using System.Threading.Tasks; + +namespace SWS.CAD.Models.NoEntity +{ + /// + /// 搜索框防抖类 + /// + public class Debouncer + { + private readonly int _delayMilliseconds; + private CancellationTokenSource _cancellationTokenSource; + + public Debouncer(int delayMilliseconds = 300) + { + _delayMilliseconds = delayMilliseconds; + } + + public void Debounce(System.Action action) + { + _cancellationTokenSource?.Cancel(); + _cancellationTokenSource = new CancellationTokenSource(); + + Task.Delay(_delayMilliseconds, _cancellationTokenSource.Token) + .ContinueWith(t => + { + if (t.IsCompleted && !t.IsCanceled) + { + action?.Invoke(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + } +} diff --git a/newFront/c#前端/SWS.CAD/Models/NoEntity/PropertyObjectModel.cs b/newFront/c#前端/SWS.CAD/Models/NoEntity/PropertyObjectModel.cs index 47f109fe..b221250b 100644 --- a/newFront/c#前端/SWS.CAD/Models/NoEntity/PropertyObjectModel.cs +++ b/newFront/c#前端/SWS.CAD/Models/NoEntity/PropertyObjectModel.cs @@ -92,11 +92,11 @@ namespace SWS.CAD.Models } } } - private ObservableCollection _listProperty = new ObservableCollection(); + private ObservableCollection _listProperty = new ObservableCollection(); /// /// 常用属性列表 /// - public ObservableCollection listBasicTypeP + public ObservableCollection listBasicTypeP { get { return _listProperty; } set @@ -125,6 +125,6 @@ namespace SWS.CAD.Models /// /// 属性数据,修改属性值时进行比对是否有修改 /// - public List listEnginedata = new List(); + public List listEnginedata = new List(); } } diff --git a/newFront/c#前端/SWS.CAD/Models/NoEntity/TreeModel.cs b/newFront/c#前端/SWS.CAD/Models/NoEntity/TreeModel.cs index c2924371..3528d3c3 100644 --- a/newFront/c#前端/SWS.CAD/Models/NoEntity/TreeModel.cs +++ b/newFront/c#前端/SWS.CAD/Models/NoEntity/TreeModel.cs @@ -1,107 +1,107 @@ -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Windows.Media; -using Telerik.Windows.Controls; -using static System.Windows.Forms.VisualStyles.VisualStyleElement.TreeView; +//using System.Collections.Generic; +//using System.Collections.ObjectModel; +//using System.Windows.Media; +//using Telerik.Windows.Controls; +//using static System.Windows.Forms.VisualStyles.VisualStyleElement.TreeView; -namespace SWS.CAD.Models -{ - public class TreeModel : ViewModelBase, System.ICloneable - { - public string ID { get; set; } - private string _Text; - /// - /// 节点显示数据 - /// - public string Text - { - get { return _Text; } - set - { - _Text = value; - if (_Text.ToLower().EndsWith(".dwg")) - { - Glyph = ""; - } - OnPropertyChanged(nameof(Text)); - } - } - /// - /// 父级节点ID。比如某个目录下有什么文件 - /// - public string parentId { get; set; } - private bool _isexpand; - /// - /// 控制展开/折叠状态 - /// - public bool isexpand - { - get { return _isexpand; } - set { _isexpand = value; OnPropertyChanged(nameof(isexpand)); } - } - /// - /// 节点类型 - /// - public string NodeType { get; set; } +//namespace SWS.CAD.Models +//{ +// public class Model.TreeModel : ViewModelBase, System.ICloneable +// { +// public string ID { get; set; } +// private string _Text; +// /// +// /// 节点显示数据 +// /// +// public string Text +// { +// get { return _Text; } +// set +// { +// _Text = value; +// if (_Text.ToLower().EndsWith(".dwg")) +// { +// Glyph = ""; +// } +// OnPropertyChanged(nameof(Text)); +// } +// } +// /// +// /// 父级节点ID。比如某个目录下有什么文件 +// /// +// public string parentId { get; set; } +// private bool _isexpand; +// /// +// /// 控制展开/折叠状态 +// /// +// public bool isexpand +// { +// get { return _isexpand; } +// set { _isexpand = value; OnPropertyChanged(nameof(isexpand)); } +// } +// /// +// /// 节点类型 +// /// +// public string NodeType { get; set; } - string _ToolTipText; - /// - /// 鼠标悬停提示词 - /// - public string ToolTipText - { - get { return _ToolTipText; } - set { _ToolTipText = value; OnPropertyChanged(nameof(ToolTipText)); } - } +// string _ToolTipText; +// /// +// /// 鼠标悬停提示词 +// /// +// public string ToolTipText +// { +// get { return _ToolTipText; } +// set { _ToolTipText = value; OnPropertyChanged(nameof(ToolTipText)); } +// } - Brush _fontColor = new SolidColorBrush(Colors.White); - /// - /// 节点字体颜色 - /// - public Brush FontColor - { - get { return _fontColor; } - set { _fontColor = value; OnPropertyChanged(nameof(FontColor)); } - } - /// - /// 排序 - /// - public int? OrderNo { get; set; } +// Brush _fontColor = new SolidColorBrush(Colors.White); +// /// +// /// 节点字体颜色 +// /// +// public Brush FontColor +// { +// get { return _fontColor; } +// set { _fontColor = value; OnPropertyChanged(nameof(FontColor)); } +// } +// /// +// /// 排序 +// /// +// public int? OrderNo { get; set; } - /// - /// 状态 0:检入, 1:自己检出, 2:别人检出 - /// - public int CheckInOutStatus { get; set; } +// /// +// /// 状态 0:检入, 1:自己检出, 2:别人检出 +// /// +// public int CheckInOutStatus { get; set; } - private ObservableCollection _ChildNodes=new ObservableCollection(); +// private ObservableCollection _ChildNodes=new ObservableCollection(); - public ObservableCollection ChildNodes - { - get { return _ChildNodes; } - set { _ChildNodes = value; RaisePropertyChanged(nameof(ChildNodes)); } - } +// public ObservableCollection ChildNodes +// { +// get { return _ChildNodes; } +// set { _ChildNodes = value; RaisePropertyChanged(nameof(ChildNodes)); } +// } - /// - /// 扩展数据。比如具体对象的实体类信息 - /// - public object NodeExtData { get; set; } +// /// +// /// 扩展数据。比如具体对象的实体类信息 +// /// +// public object NodeExtData { get; set; } - string _Glyph = ""; - /// - /// 节点图标 - /// - public string Glyph - { - get { return _Glyph; } - set { _Glyph = value; OnPropertyChanged(nameof(Glyph)); } - } - /// - /// 克隆实体类 - /// - /// - public object Clone() - { - return this.MemberwiseClone(); - } - } -} +// string _Glyph = ""; +// /// +// /// 节点图标 +// /// +// public string Glyph +// { +// get { return _Glyph; } +// set { _Glyph = value; OnPropertyChanged(nameof(Glyph)); } +// } +// /// +// /// 克隆实体类 +// /// +// /// +// public object Clone() +// { +// return this.MemberwiseClone(); +// } +// } +//} diff --git a/newFront/c#前端/SWS.CAD/Models/ec_Cable.cs b/newFront/c#前端/SWS.CAD/Models/ec_Cable.cs index bbfe5eb8..957acf6e 100644 --- a/newFront/c#前端/SWS.CAD/Models/ec_Cable.cs +++ b/newFront/c#前端/SWS.CAD/Models/ec_Cable.cs @@ -90,7 +90,7 @@ namespace SWS.CAD.Models /// /// 关联的通讯点 /// - public IEnumerable WireGroups { set; get; } + public IEnumerable WireGroups { set; get; } /// /// 对应到 diff --git a/newFront/c#前端/SWS.CAD/Models/ec_PanelChannel.cs b/newFront/c#前端/SWS.CAD/Models/ec_PanelChannel.cs index a6f3c9e7..e0d443e0 100644 --- a/newFront/c#前端/SWS.CAD/Models/ec_PanelChannel.cs +++ b/newFront/c#前端/SWS.CAD/Models/ec_PanelChannel.cs @@ -111,7 +111,7 @@ namespace SWS.CAD.Models /// public List Terms { set; get; } - public ec_Wire_Group Signal { set; get; } + public SWS.Model.ec_Wire_Group Signal { set; get; } /// /// 如果是母线,则直接体现在通道上 /// diff --git a/newFront/c#前端/SWS.CAD/Models/ec_dataitemdetail.cs b/newFront/c#前端/SWS.CAD/Models/ec_dataitemdetail.cs index 360b63c1..f7d7ece8 100644 --- a/newFront/c#前端/SWS.CAD/Models/ec_dataitemdetail.cs +++ b/newFront/c#前端/SWS.CAD/Models/ec_dataitemdetail.cs @@ -1,5 +1,4 @@ -using DryIoc.ImTools; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/newFront/c#前端/SWS.CAD/SWS.CAD.csproj b/newFront/c#前端/SWS.CAD/SWS.CAD.csproj index 01d6bec7..b3d3a3c0 100644 --- a/newFront/c#前端/SWS.CAD/SWS.CAD.csproj +++ b/newFront/c#前端/SWS.CAD/SWS.CAD.csproj @@ -36,10 +36,11 @@ ..\packages\Aspose.Cells.25.3.0\lib\net40\Aspose.Cells.dll - ..\..\..\..\..\..\Program Files\KunHeng\KunHengCAD V21 zh_CN\BrxMgd.dll + D:\Program Files\KunHeng\KunHengCAD V21 zh_CN\BrxMgd.dll - ..\packages\DryIoc.dll.5.4.3\lib\net45\DryIoc.dll + False + ..\packages\DryIoc.dll.4.7.7\lib\net45\DryIoc.dll ..\packages\EasyEncryption.1.0.2\lib\EasyEncryption.dll @@ -71,28 +72,20 @@ - ..\packages\Prism.Core.9.0.537\lib\net47\Prism.dll - - - ..\packages\Prism.Container.Abstractions.9.0.106\lib\net47\Prism.Container.Abstractions.dll - - - ..\packages\Prism.Container.DryIoc.9.0.106\lib\net47\Prism.Container.DryIoc.dll - - - ..\packages\Prism.Container.Unity.9.0.106\lib\net462\Prism.Container.Unity.dll + False + ..\packages\Prism.Core.8.1.97\lib\net47\Prism.dll - ..\packages\Prism.DryIoc.9.0.537\lib\net47\Prism.DryIoc.Wpf.dll - - - ..\packages\Prism.Events.9.0.537\lib\net47\Prism.Events.dll + False + ..\packages\Prism.DryIoc.8.1.97\lib\net47\Prism.DryIoc.Wpf.dll - ..\packages\Prism.Unity.9.0.537\lib\net47\Prism.Unity.Wpf.dll + False + ..\packages\Prism.Unity.8.1.97\lib\net47\Prism.Unity.Wpf.dll - ..\packages\Prism.Wpf.9.0.537\lib\net47\Prism.Wpf.dll + False + ..\packages\Prism.Wpf.8.1.97\lib\net47\Prism.Wpf.dll @@ -119,7 +112,7 @@ - ..\..\..\..\..\..\Program Files\KunHeng\KunHengCAD V21 zh_CN\TD_Mgd.dll + D:\Program Files\KunHeng\KunHengCAD V21 zh_CN\TD_Mgd.dll False @@ -190,75 +183,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - @@ -277,15 +205,10 @@ - - - - - @@ -395,9 +318,6 @@ DialogTagSelect.xaml - - DialogInput.xaml - DialogUnitSelect.xaml @@ -419,21 +339,9 @@ RightPanel.xaml - - DialogSignalManagement.xaml - CheckInApprove.xaml - - DialogSignalNotice.xaml - - - DialogSignalPropertyhisAndLogs.xaml - - - DialogSignalSelect.xaml - UserNotification.xaml @@ -454,9 +362,6 @@ - - - Designer @@ -546,10 +451,6 @@ MSBuild:Compile Designer - - MSBuild:Compile - Designer - MSBuild:Compile Designer @@ -578,26 +479,10 @@ MSBuild:Compile Designer - - Designer - MSBuild:Compile - MSBuild:Compile Designer - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - MSBuild:Compile Designer @@ -620,71 +505,30 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + {d4a15774-1469-45a0-9eff-771271764a00} + SWS.CAD.Base + + + {9ac724f6-883d-4357-9422-602748f25b69} + SWS.Commons + + + {2dcf996e-063b-4b95-8530-28f6df0da58a} + SWS.CustomControl + + + {1995385b-d1b0-4c55-835e-d3e769972a6a} + SWS.Model + + + {51cb6f5b-16e9-4ee0-baa4-144dd1ec8580} + SWS.Service + + + {7aff9117-78e7-4395-9f23-6dcfe09f9299} + SWS.WPF + diff --git a/newFront/c#前端/SWS.CAD/Services/AnnexesService.cs b/newFront/c#前端/SWS.CAD/Services/AnnexesService.cs index bfbce380..63e0b646 100644 --- a/newFront/c#前端/SWS.CAD/Services/AnnexesService.cs +++ b/newFront/c#前端/SWS.CAD/Services/AnnexesService.cs @@ -1,8 +1,8 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using SWS.CAD.Helper; using SWS.CAD.Models; using SWS.CAD.Models.NoEntity; +using SWS.Commons; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/newFront/c#前端/SWS.CAD/Services/DataItemService.cs b/newFront/c#前端/SWS.CAD/Services/DataItemService.cs index 772d94cf..a7c95a1c 100644 --- a/newFront/c#前端/SWS.CAD/Services/DataItemService.cs +++ b/newFront/c#前端/SWS.CAD/Services/DataItemService.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Threading.Tasks; -using System.Windows.Documents; -using SWS.CAD.Models; +using SWS.Commons; +using SWS.Model; using Teigha.DatabaseServices; using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel; diff --git a/newFront/c#前端/SWS.CAD/Services/DrawingCatalogueService.cs b/newFront/c#前端/SWS.CAD/Services/DrawingCatalogueService.cs index 289ef36f..e1ddf1b5 100644 --- a/newFront/c#前端/SWS.CAD/Services/DrawingCatalogueService.cs +++ b/newFront/c#前端/SWS.CAD/Services/DrawingCatalogueService.cs @@ -1,8 +1,8 @@ using System; using System.Security.Policy; using System.Threading.Tasks; -using SWS.CAD.Helper; using SWS.CAD.Models; +using SWS.Commons; namespace SWS.CAD.Services { diff --git a/newFront/c#前端/SWS.CAD/Services/DrawingServce.cs b/newFront/c#前端/SWS.CAD/Services/DrawingServce.cs index f47537e0..60a50fc0 100644 --- a/newFront/c#前端/SWS.CAD/Services/DrawingServce.cs +++ b/newFront/c#前端/SWS.CAD/Services/DrawingServce.cs @@ -2,8 +2,8 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Threading.Tasks; -using SWS.CAD.Helper; using SWS.CAD.Models; +using SWS.Commons; namespace SWS.CAD.Services { @@ -34,9 +34,9 @@ namespace SWS.CAD.Services /// /// 是否只查询文件夹。1代表只查询文件夹 /// - public async Task> GetDrawingCatalogue(string onlyFolderFlag = "0") + public async Task> GetDrawingCatalogue(string onlyFolderFlag = "0") { - var res = await this.GetAsync>($"DrawingFileApi/GetDrawingCatalogue?projectId={GlobalObject.curProject.ProjectId}&onlyFolderFlag={onlyFolderFlag}"); + var res = await this.GetAsync>($"DrawingFileApi/GetDrawingCatalogue?projectId={GlobalObject.curProject.ProjectId}&onlyFolderFlag={onlyFolderFlag}"); //OnRefresh(); if (res.code == 200) { @@ -53,9 +53,9 @@ namespace SWS.CAD.Services /// 查询所属系统树 /// /// - public async Task> GetDrawingSystem() + public async Task> GetDrawingSystem() { - var res = await this.GetAsync>($"DrawingFileApi/GetDrawingCatalogueBySystem?projectId={GlobalObject.curProject.ProjectId}"); + var res = await this.GetAsync>($"DrawingFileApi/GetDrawingCatalogueBySystem?projectId={GlobalObject.curProject.ProjectId}"); //OnRefresh(); if (res.code == 200) { diff --git a/newFront/c#前端/SWS.CAD/Services/EnginedataService.cs b/newFront/c#前端/SWS.CAD/Services/EnginedataService.cs index b8b2447e..cecf809f 100644 --- a/newFront/c#前端/SWS.CAD/Services/EnginedataService.cs +++ b/newFront/c#前端/SWS.CAD/Services/EnginedataService.cs @@ -2,8 +2,9 @@ using EasyEncryption; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using SWS.CAD.Models; using SWS.CAD.Models.NoEntity; +using SWS.Commons; +using SWS.Model; using System; using System.Collections.Generic; using System.Linq; diff --git a/newFront/c#前端/SWS.CAD/Services/HttpService.cs b/newFront/c#前端/SWS.CAD/Services/HttpService.cs index f4672df6..8aac1b42 100644 --- a/newFront/c#前端/SWS.CAD/Services/HttpService.cs +++ b/newFront/c#前端/SWS.CAD/Services/HttpService.cs @@ -6,8 +6,8 @@ using System.Net.Http; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; -using SWS.CAD.Helper; using SWS.CAD.Models; +using SWS.Commons; namespace SWS.CAD.Services { public class HttpService diff --git a/newFront/c#前端/SWS.CAD/Services/IOModuleService.cs b/newFront/c#前端/SWS.CAD/Services/IOModuleService.cs index 24794d6e..bd195ba3 100644 --- a/newFront/c#前端/SWS.CAD/Services/IOModuleService.cs +++ b/newFront/c#前端/SWS.CAD/Services/IOModuleService.cs @@ -4,6 +4,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using SWS.CAD.Models; using SWS.CAD.Models.NoEntity; +using SWS.Commons; using System; using System.Collections.Generic; using System.Linq; @@ -24,10 +25,10 @@ namespace SWS.CAD.Services /// /// /// - public async Task> GetPanelTree() + public async Task> GetPanelTree() { - var res = await this.GetAsync>($"IOModuleApi/GetPanelTree?projectId={GlobalObject.curProject?.ProjectId}"); + var res = await this.GetAsync>($"IOModuleApi/GetPanelTree?projectId={GlobalObject.curProject?.ProjectId}"); if (res.code == 200) { return res.data; diff --git a/newFront/c#前端/SWS.CAD/Services/LoginService.cs b/newFront/c#前端/SWS.CAD/Services/LoginService.cs index c86d139b..5000e50c 100644 --- a/newFront/c#前端/SWS.CAD/Services/LoginService.cs +++ b/newFront/c#前端/SWS.CAD/Services/LoginService.cs @@ -1,9 +1,8 @@  using EasyEncryption; using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using SWS.CAD.Models; -using SWS.CAD.Models.NoEntity; +using SWS.Commons; +using SWS.Model; using System; using System.Net.Http; using System.Threading.Tasks; diff --git a/newFront/c#前端/SWS.CAD/Services/NotificationService.cs b/newFront/c#前端/SWS.CAD/Services/NotificationService.cs index 3aba9b1d..19e67e24 100644 --- a/newFront/c#前端/SWS.CAD/Services/NotificationService.cs +++ b/newFront/c#前端/SWS.CAD/Services/NotificationService.cs @@ -1,10 +1,8 @@  -using EasyEncryption; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using SWS.CAD.Helper; + using SWS.CAD.Models; using SWS.CAD.Models.NoEntity; +using SWS.Commons; using System; using System.Collections.Generic; using System.Linq; diff --git a/newFront/c#前端/SWS.CAD/Services/ObjectTypeService.cs b/newFront/c#前端/SWS.CAD/Services/ObjectTypeService.cs index c3d6e2ff..f509db03 100644 --- a/newFront/c#前端/SWS.CAD/Services/ObjectTypeService.cs +++ b/newFront/c#前端/SWS.CAD/Services/ObjectTypeService.cs @@ -2,8 +2,9 @@ using EasyEncryption; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using SWS.CAD.Models; using SWS.CAD.Models.NoEntity; +using SWS.Commons; +using SWS.Model; using System; using System.Collections.Generic; using System.Linq; @@ -58,16 +59,16 @@ namespace SWS.CAD.Services } /// - /// 获取对象类型。根据datatype,有3种方式。返回TreeModel。 + /// 获取对象类型。根据datatype,有3种方式。返回Model.TreeModel。 /// 插件端里的设计浏览会用 /// /// 节点类型 0:对象类型、1:位号、2:图纸 /// 关键字。同时搜索类型、位号 /// - public async Task> GetObjectTypeData(string dataType = "0", string KeyWord = "") + public async Task> GetObjectTypeData(string dataType = "0", string KeyWord = "") { - var res = await this.GetAsync>($"ObjectTypeApi/GetObjectTypeData?projectId={GlobalObject.curProject.ProjectId}&dataType={dataType}&KeyWord={KeyWord}"); + var res = await this.GetAsync>($"ObjectTypeApi/GetObjectTypeData?projectId={GlobalObject.curProject.ProjectId}&dataType={dataType}&KeyWord={KeyWord}"); if (res.code == 200) { return res.data; @@ -85,10 +86,10 @@ namespace SWS.CAD.Services /// 对象类型ID /// 关键字 /// - public async Task> GetTagNumberById_Brief(string objectTypeID, string KeyWord = "", string system = "") + public async Task> GetTagNumberById_Brief(string objectTypeID, string KeyWord = "", string system = "") { - var res = await this.GetAsync>($"ObjectTypeApi/GetTagNumberById_Brief?projectId={GlobalObject.curProject.ProjectId}&objectTypeID={objectTypeID}&KeyWord={KeyWord}&system={system}"); + var res = await this.GetAsync>($"ObjectTypeApi/GetTagNumberById_Brief?projectId={GlobalObject.curProject.ProjectId}&objectTypeID={objectTypeID}&KeyWord={KeyWord}&system={system}"); if (res.code == 200) { return res.data; @@ -104,10 +105,10 @@ namespace SWS.CAD.Services /// 项目ID /// Tag Number的集合(用,连接) /// - public async Task> GetTagInfosByTags(string Tags, string caseID = "") + public async Task> GetTagInfosByTags(string Tags, string caseID = "") { - var res = await this.GetAsync>($"ObjectTypeApi/GetTagInfosByTags?projectId={GlobalObject.curProject.ProjectId}&Tags={Tags}&caseID={caseID}"); + var res = await this.GetAsync>($"ObjectTypeApi/GetTagInfosByTags?projectId={GlobalObject.curProject.ProjectId}&Tags={Tags}&caseID={caseID}"); if (res.code == 200) { return res.data; @@ -141,10 +142,10 @@ namespace SWS.CAD.Services /// 图元属性批量修改 /// /// - public async Task UpdatePixelAndPropBatch(List entitys) + public async Task UpdatePixelAndPropBatch(List entitys) { string url = $"ObjectTypeApi/UpdatePixelAndPropBatch?projectId={GlobalObject.curProject?.ProjectId}"; - var res = await this.PostBodyAsync>(url, entitys); + var res = await this.PostBodyAsync>(url, entitys); if (res.code==200) { return ""; diff --git a/newFront/c#前端/SWS.CAD/Services/SettingsService.cs b/newFront/c#前端/SWS.CAD/Services/SettingsService.cs index 56ecea12..54a4144b 100644 --- a/newFront/c#前端/SWS.CAD/Services/SettingsService.cs +++ b/newFront/c#前端/SWS.CAD/Services/SettingsService.cs @@ -4,6 +4,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using SWS.CAD.Models; using SWS.CAD.Models.NoEntity; +using SWS.Commons; using System; using System.Collections.Generic; using System.Linq; diff --git a/newFront/c#前端/SWS.CAD/Services/TemplateFileService.cs b/newFront/c#前端/SWS.CAD/Services/TemplateFileService.cs index a7f9cef1..acee8533 100644 --- a/newFront/c#前端/SWS.CAD/Services/TemplateFileService.cs +++ b/newFront/c#前端/SWS.CAD/Services/TemplateFileService.cs @@ -2,6 +2,7 @@ using Newtonsoft.Json.Linq; using SWS.CAD.Models; using SWS.CAD.Models.NoEntity; +using SWS.Commons; using System; using System.Collections.Generic; using System.IO; @@ -25,9 +26,9 @@ namespace SWS.CAD.Services /// 查询模板文件目录树 /// /// - public async Task> GetTemplateCatalogue() + public async Task> GetTemplateCatalogue() { - var res = await this.GetAsync>($"TemplateFileApi/GetTemplateCatalogue?projectId={GlobalObject.curProject.ProjectId}"); + var res = await this.GetAsync>($"TemplateFileApi/GetTemplateCatalogue?projectId={GlobalObject.curProject.ProjectId}"); //OnRefresh(); if (res.code == 200) { diff --git a/newFront/c#前端/SWS.CAD/Services/UserService.cs b/newFront/c#前端/SWS.CAD/Services/UserService.cs index dd8a7d52..b54341f7 100644 --- a/newFront/c#前端/SWS.CAD/Services/UserService.cs +++ b/newFront/c#前端/SWS.CAD/Services/UserService.cs @@ -1,9 +1,6 @@  -using EasyEncryption; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using SWS.CAD.Models; -using SWS.CAD.Models.NoEntity; +using SWS.Commons; +using SWS.Model; using System; using System.Collections.Generic; using System.Linq; diff --git a/newFront/c#前端/SWS.CAD/Services/WireGroupService.cs b/newFront/c#前端/SWS.CAD/Services/WireGroupService.cs index 997deabd..9fae4fa8 100644 --- a/newFront/c#前端/SWS.CAD/Services/WireGroupService.cs +++ b/newFront/c#前端/SWS.CAD/Services/WireGroupService.cs @@ -1,9 +1,6 @@  -using EasyEncryption; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using SWS.CAD.Models; -using SWS.CAD.Models.NoEntity; +using SWS.Commons; +using SWS.Model; using System; using System.Collections.Generic; using System.Linq; @@ -87,9 +84,9 @@ namespace SWS.CAD.Services /// /// /// - public async Task> SaveSignals(WireGroups entity) + public async Task> SaveSignals(SWS.Model.WireGroups entity) { - var res = await this.PostBodyAsync, WireGroups>($"WireGroupApi/SaveSignals?projId={GlobalObject.curProject?.ProjectId}&mode=0", entity); + var res = await this.PostBodyAsync, Model.WireGroups>($"WireGroupApi/SaveSignals?projId={GlobalObject.curProject?.ProjectId}&mode=0", entity); if (res.code == 200) { return res.data; diff --git a/newFront/c#前端/SWS.CAD/Start.cs b/newFront/c#前端/SWS.CAD/Start.cs index e08ec9ec..16335dff 100644 --- a/newFront/c#前端/SWS.CAD/Start.cs +++ b/newFront/c#前端/SWS.CAD/Start.cs @@ -1,22 +1,15 @@ -using Prism.Container.DryIoc; -using Prism.Dialogs; +using Prism.DryIoc; using Prism.Events; using Prism.Ioc; -using SWS.CAD.Helper; -using SWS.CAD.Models.NoEntity; -using SWS.CAD.Services; +using Prism.Services.Dialogs; using SWS.CAD.ViewModels; using SWS.CAD.Views; using SWS.CAD.Views.Dialog; -using SWS.CAD.Views.SignalManagementViews; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net.Http; -using System.Text; -using System.Threading.Tasks; +using SWS.Commons; +using SWS.Service; +using SWS.WPF.ViewModels; +using SWS.WPF.Views; using Unity; - namespace SWS.CAD { public class Start @@ -40,14 +33,14 @@ namespace SWS.CAD GlobalObject.container.RegisterSingleton(); GlobalObject.container.RegisterSingleton(); GlobalObject.container.RegisterSingleton(); - GlobalObject.container.RegisterSingleton(); + //GlobalObject.container.RegisterSingleton(); GlobalObject.container.RegisterSingleton(); GlobalObject.container.RegisterSingleton(); GlobalObject.container.RegisterSingleton(); GlobalObject._prismContainer = new DryIocContainerExtension(); GlobalObject._prismContainer.Register(); - GlobalObject._prismContainer.Register(); + GlobalObject._prismContainer.Register(); //后者类似于一个容器。给所有需要的dialog所用 GlobalObject._prismContainer.RegisterDialog(); GlobalObject._prismContainer.RegisterDialog(); @@ -60,7 +53,8 @@ namespace SWS.CAD GlobalObject._prismContainer.RegisterDialog(); GlobalObject._prismContainer.RegisterDialog(); GlobalObject._prismContainer.RegisterDialog(); - GlobalObject._prismContainer.RegisterDialog(); + GlobalObject._prismContainer.RegisterDialog(); + GlobalObject._prismContainer.RegisterDialog(); GlobalObject._prismContainer.RegisterDialog(); GlobalObject._prismContainer.RegisterDialog(); GlobalObject._prismContainer.RegisterDialog(); diff --git a/newFront/c#前端/SWS.CAD/ViewModels/CheckInApproveViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/CheckInApproveViewModel.cs index 9ace0f5d..d3172354 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/CheckInApproveViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/CheckInApproveViewModel.cs @@ -1,18 +1,16 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.IO; using System.Linq; using System.Windows; -using System.Windows.Forms; using System.Windows.Input; using Prism.Commands; -using Prism.Dialogs; -using SWS.CAD.Models; -using SWS.CAD.Services; +using Prism.Services.Dialogs; using SWS.CAD.ViewModels.myViewModelBase; +using SWS.Commons; +using SWS.Model; +using SWS.Service; using Unity; -using DialogResult = System.Windows.Forms.DialogResult; using MessageBox = System.Windows.Forms.MessageBox; namespace SWS.CAD.ViewModels @@ -97,7 +95,9 @@ namespace SWS.CAD.ViewModels Commad_ClearChecked = new DelegateCommand(onClearChecked); } - public DialogCloseListener RequestClose { get; } + public string Title => ""; + + public event Action RequestClose; public override void onWindow_loaded(object para) { GetAllData(); diff --git a/newFront/c#前端/SWS.CAD/ViewModels/ConfigViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/ConfigViewModel.cs index 56c2a614..184e0c69 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/ConfigViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/ConfigViewModel.cs @@ -1,14 +1,7 @@ using Bricscad.ApplicationServices; -using Bricscad.Windows; -using SWS.CAD.Helper; -using SWS.CAD.Services; using SWS.CAD.ViewModels.myViewModelBase; -using System.IO; -using System.Runtime.CompilerServices; -using System.Threading.Tasks; -using System.Windows.Input; -using Telerik.Windows.Controls; -using Unity; +using SWS.Commons; +using SWS.Service; namespace SWS.CAD.ViewModels { diff --git a/newFront/c#前端/SWS.CAD/ViewModels/Dialog2SelectViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/Dialog2SelectViewModel.cs index c25b1fb5..808cc7d6 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/Dialog2SelectViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/Dialog2SelectViewModel.cs @@ -1,15 +1,7 @@ -using Prism.Dialogs; -using SWS.CAD.Models; -using SWS.CAD.Services; +using Prism.Services.Dialogs; using SWS.CAD.ViewModels.myViewModelBase; -using SWS.CAD.Views; +using SWS.Commons; using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Unity; namespace SWS.CAD.ViewModels { @@ -21,7 +13,9 @@ namespace SWS.CAD.ViewModels title = "选择对话框"; } - public DialogCloseListener RequestClose { get; } + public string Title => ""; + + public event Action RequestClose; public bool CanCloseDialog() { @@ -38,21 +32,24 @@ namespace SWS.CAD.ViewModels title = parameters.GetValue(GlobalObject.dialogPar.title.ToString()); textYes = parameters.GetValue(GlobalObject.dialogPar.textYes.ToString()); textNo = parameters.GetValue(GlobalObject.dialogPar.textNo.ToString()); - + } public override void ExecuteOKCommandAsync(object para) { - RequestClose.Invoke(ButtonResult.Yes); + DialogResult res = new DialogResult(ButtonResult.Yes); + RequestClose.Invoke(res); } public override void ExecuteCloseCommand(object parameter) { if (parameter as string == "ClickNo") { - RequestClose.Invoke(ButtonResult.No); + DialogResult res = new DialogResult(ButtonResult.No); + RequestClose.Invoke(res); } else { - RequestClose.Invoke(ButtonResult.Cancel); + DialogResult res = new DialogResult(ButtonResult.Cancel); + RequestClose.Invoke(res); } this.Dispose(); } diff --git a/newFront/c#前端/SWS.CAD/ViewModels/DialogCableConnectionVM/DialogCableConnectionViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/DialogCableConnectionVM/DialogCableConnectionViewModel.cs index ec97625b..83f8228d 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/DialogCableConnectionVM/DialogCableConnectionViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/DialogCableConnectionVM/DialogCableConnectionViewModel.cs @@ -2,26 +2,19 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Web.UI.WebControls; using System.Windows; using System.Windows.Input; using System.Windows.Interop; -using System.Windows.Media; -using Bricscad.Ifc; -using Prism.Dialogs; using Prism.Ioc; -using SWS.CAD.Models; -using SWS.CAD.Services; +using Prism.Services.Dialogs; using SWS.CAD.ViewModels.myViewModelBase; using SWS.CAD.Views.CustomControl; using SWS.CAD.Views.Dialog; -using Teigha.Geometry; +using SWS.Commons; +using SWS.Model; +using SWS.Service; using Telerik.Windows.Controls; -using Telerik.Windows.Controls.VirtualKeyboard; using Unity; -using static SWS.CAD.Services.IOModuleService; namespace SWS.CAD.ViewModels { @@ -31,11 +24,11 @@ namespace SWS.CAD.ViewModels public class DialogCableConnectionViewModel : DialogBase, IDialogAware { #region 页面渲染字段 - private ObservableCollection _AllTagPixels = new ObservableCollection(); + private ObservableCollection _AllTagPixels = new ObservableCollection(); /// /// 图纸所有的电缆 /// - public ObservableCollection AllTagPixels + public ObservableCollection AllTagPixels { get { return _AllTagPixels; } set @@ -44,11 +37,11 @@ namespace SWS.CAD.ViewModels RaisePropertyChanged(nameof(AllTagPixels)); } } - private ec_enginedata_pixel _SelectedTagPixels; + private Model.ec_enginedata_pixel _SelectedTagPixels; /// /// 选择的电缆位号 /// - public ec_enginedata_pixel SelectedTagPixels + public Model.ec_enginedata_pixel SelectedTagPixels { get { return _SelectedTagPixels; } set @@ -100,7 +93,9 @@ namespace SWS.CAD.ViewModels _iOModuleService = GlobalObject.container.Resolve(); _objectTypeService = GlobalObject.container.Resolve(); } - public DialogCloseListener RequestClose { get; } + public string Title => ""; + + public event Action RequestClose; public bool CanCloseDialog() { @@ -138,9 +133,9 @@ namespace SWS.CAD.ViewModels } public override void ExecuteOKCommandAsync(object para) { - Prism.Dialogs.DialogParameters res = new Prism.Dialogs.DialogParameters(); + IDialogParameters res = new Prism.Services.Dialogs.DialogParameters(); //res.Add(GlobalObject.dialogPar.info.ToString(), $"{TextInfo}"); - RequestClose.Invoke(res, ButtonResult.Yes); + RequestClose.Invoke(new DialogResult(ButtonResult.Yes, res)); } public override void ExecuteCloseCommand(object parameter) { @@ -154,11 +149,12 @@ namespace SWS.CAD.ViewModels //} if (parameter as string == "ClickNo") { - RequestClose.Invoke(ButtonResult.No); + DialogResult res = new DialogResult(ButtonResult.No); + RequestClose.Invoke(res); } else { - RequestClose.Invoke(ButtonResult.Cancel); + RequestClose.Invoke(new DialogResult(ButtonResult.Cancel)); } this.Dispose(); } @@ -173,7 +169,7 @@ namespace SWS.CAD.ViewModels ObservableCollection ReslistPro = new ObservableCollection(); //打开窗体 - Prism.Dialogs.DialogParameters para = new Prism.Dialogs.DialogParameters(); + IDialogParameters para = new Prism.Services.Dialogs.DialogParameters(); para.Add(GlobalObject.dialogPar.title.ToString(), title); para.Add(GlobalObject.dialogPar.para1.ToString(), listPropertys); var _dialogService = GlobalObject._prismContainer.Resolve(); @@ -193,7 +189,7 @@ namespace SWS.CAD.ViewModels #region 图中电缆下拉改变 private ec_Cable ResCableEngID; - public async void UpdaTagPixels(ec_enginedata_pixel ec_Enginedata_Pixel) + public async void UpdaTagPixels(Model.ec_enginedata_pixel ec_Enginedata_Pixel) { IsBusy = true; try @@ -212,20 +208,20 @@ namespace SWS.CAD.ViewModels listPropertys = new List(); Dictionary pulldownlist; - listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "电缆对数", GroupName = "基本参数", PropertyValue = "1", ControlTypeName = PROPERTYType.TextBox, }); - listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "每电缆对芯数", GroupName = "基本参数", PropertyValue = "2", ControlTypeName = PROPERTYType.TextBox, }); - listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "电缆对编号前缀", GroupName = "基本参数", PropertyValue = "Set", ControlTypeName = PROPERTYType.TextBox, }); + listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "电缆对数", GroupName = "基本参数", PropertyValue = "1", ControlTypeName = Model.PROPERTYType.TextBox, }); + listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "每电缆对芯数", GroupName = "基本参数", PropertyValue = "2", ControlTypeName = Model.PROPERTYType.TextBox, }); + listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "电缆对编号前缀", GroupName = "基本参数", PropertyValue = "Set", ControlTypeName = Model.PROPERTYType.TextBox, }); pulldownlist = new Dictionary(); pulldownlist.Add("数字", "数字"); pulldownlist.Add("字母", "字母"); pulldownlist.Add("电缆对序号", "电缆对序号"); - listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "编号类型", GroupName = "电芯参数", PropertyValue = "数字", ControlTypeName = PROPERTYType.ComboBox, Item = pulldownlist, }); + listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "编号类型", GroupName = "电芯参数", PropertyValue = "数字", ControlTypeName = Model.PROPERTYType.ComboBox, Item = pulldownlist, }); pulldownlist = new Dictionary(); pulldownlist.Add("按电缆编号", "按电缆编号"); pulldownlist.Add("按电缆对编号", "按电缆对编号"); - listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "编号规则", GroupName = "电芯参数", PropertyValue = "按电缆对编号", ControlTypeName = PROPERTYType.ComboBox, Item = pulldownlist, }); - listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "电芯编号前缀", GroupName = "电芯参数", PropertyValue = "C", ControlTypeName = PROPERTYType.TextBox, }); - listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "极性", GroupName = "电芯参数", PropertyValue = "+,-,s", ControlTypeName = PROPERTYType.TextBox, }); + listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "编号规则", GroupName = "电芯参数", PropertyValue = "按电缆对编号", ControlTypeName = Model.PROPERTYType.ComboBox, Item = pulldownlist, }); + listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "电芯编号前缀", GroupName = "电芯参数", PropertyValue = "C", ControlTypeName = Model.PROPERTYType.TextBox, }); + listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "极性", GroupName = "电芯参数", PropertyValue = "+,-,s", ControlTypeName = Model.PROPERTYType.TextBox, }); //显示属性弹窗 var ReslistPro = ShowPropertyMessage("新建" + ec_Enginedata_Pixel.TagNumber + "电缆配置", listPropertys); if (ReslistPro == null || ReslistPro.Count() == 0) return; @@ -282,20 +278,20 @@ namespace SWS.CAD.ViewModels listPropertys = new List(); Dictionary pulldownlist; - listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "电缆对数", GroupName = "基本参数", PropertyValue = "10", ControlTypeName = PROPERTYType.TextBox, }); - listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "每电缆对芯数", GroupName = "基本参数", PropertyValue = "2", ControlTypeName = PROPERTYType.TextBox, }); - listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "电缆对编号前缀", GroupName = "基本参数", PropertyValue = "Set", ControlTypeName = PROPERTYType.TextBox, }); + listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "电缆对数", GroupName = "基本参数", PropertyValue = "10", ControlTypeName = Model.PROPERTYType.TextBox, }); + listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "每电缆对芯数", GroupName = "基本参数", PropertyValue = "2", ControlTypeName = Model.PROPERTYType.TextBox, }); + listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "电缆对编号前缀", GroupName = "基本参数", PropertyValue = "Set", ControlTypeName = Model.PROPERTYType.TextBox, }); pulldownlist = new Dictionary(); pulldownlist.Add("数字", "数字"); pulldownlist.Add("字母", "字母"); pulldownlist.Add("电缆对序号", "电缆对序号"); - listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "编号类型", GroupName = "电芯参数", PropertyValue = "数字", ControlTypeName = PROPERTYType.ComboBox, Item = pulldownlist, }); + listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "编号类型", GroupName = "电芯参数", PropertyValue = "数字", ControlTypeName = Model.PROPERTYType.ComboBox, Item = pulldownlist, }); pulldownlist = new Dictionary(); pulldownlist.Add("按电缆编号", "按电缆编号"); pulldownlist.Add("按电缆对编号", "按电缆对编号"); - listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "编号规则", GroupName = "电芯参数", PropertyValue = "按电缆对编号", ControlTypeName = PROPERTYType.ComboBox, Item = pulldownlist, }); - listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "电芯编号前缀", GroupName = "电芯参数", PropertyValue = "C", ControlTypeName = PROPERTYType.TextBox, }); - listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "极性", GroupName = "电芯参数", PropertyValue = "+,-,s", ControlTypeName = PROPERTYType.TextBox, }); + listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "编号规则", GroupName = "电芯参数", PropertyValue = "按电缆对编号", ControlTypeName = Model.PROPERTYType.ComboBox, Item = pulldownlist, }); + listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "电芯编号前缀", GroupName = "电芯参数", PropertyValue = "C", ControlTypeName = Model.PROPERTYType.TextBox, }); + listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "极性", GroupName = "电芯参数", PropertyValue = "+,-,s", ControlTypeName = Model.PROPERTYType.TextBox, }); //显示属性弹窗 var ReslistPro = ShowPropertyMessage("新建" + ec_Enginedata_Pixel.TagNumber + "电缆配置", listPropertys); if (ReslistPro == null || ReslistPro.Count == 0) return; @@ -519,7 +515,7 @@ namespace SWS.CAD.ViewModels MessageBox.Show("左右(From,To)端子必须对称连接(不能一个空白一个连接)", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return; } - Connections saveConnections = new Connections(); + Service.IOModuleService.Connections saveConnections = new Service.IOModuleService.Connections(); saveConnections.Conns = new List(); //左边修改的端子 @@ -611,7 +607,7 @@ namespace SWS.CAD.ViewModels #region 关闭 if (parameter.ToString().Equals("关闭")) { - RequestClose.Invoke(ButtonResult.Cancel); + RequestClose.Invoke(new DialogResult(ButtonResult.Cancel)); this.Dispose(); return; @@ -624,7 +620,7 @@ namespace SWS.CAD.ViewModels var Pannel = ResCableEngID.FromPanel; //打开窗体 - Prism.Dialogs.DialogParameters para = new Prism.Dialogs.DialogParameters(); + IDialogParameters para = new Prism.Services.Dialogs.DialogParameters(); para.Add(GlobalObject.dialogPar.info.ToString(), "Fo"); para.Add(GlobalObject.dialogPar.para1.ToString(), ResCableEngID); var _dialogService = GlobalObject._prismContainer.Resolve(); @@ -647,7 +643,7 @@ namespace SWS.CAD.ViewModels { var Pannel = ResCableEngID.ToPanel; //打开窗体 - Prism.Dialogs.DialogParameters para = new Prism.Dialogs.DialogParameters(); + IDialogParameters para = new Prism.Services.Dialogs.DialogParameters(); para.Add(GlobalObject.dialogPar.info.ToString(), "To"); para.Add(GlobalObject.dialogPar.para1.ToString(), ResCableEngID); var _dialogService = GlobalObject._prismContainer.Resolve(); diff --git a/newFront/c#前端/SWS.CAD/ViewModels/DialogCableConnectionVM/DialogCableConnection_NewStripViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/DialogCableConnectionVM/DialogCableConnection_NewStripViewModel.cs index 00d51178..6cb0eac0 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/DialogCableConnectionVM/DialogCableConnection_NewStripViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/DialogCableConnectionVM/DialogCableConnection_NewStripViewModel.cs @@ -2,25 +2,16 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Web.UI.WebControls; using System.Windows; -using System.Windows.Forms; using System.Windows.Input; -using System.Windows.Interop; -using System.Windows.Media; using DryIoc; -using Prism.Dialogs; -using SWS.CAD.Models; -using SWS.CAD.Services; +using Prism.Services.Dialogs; using SWS.CAD.ViewModels.myViewModelBase; -using SWS.CAD.Views.CustomControl; -using SWS.CAD.Views.Dialog; +using SWS.Commons; +using SWS.Model; +using SWS.Service; using Telerik.Windows.Controls; -using Telerik.Windows.Controls.VirtualKeyboard; using Unity; -using static SWS.CAD.Services.IOModuleService; namespace SWS.CAD.ViewModels { @@ -111,7 +102,9 @@ namespace SWS.CAD.ViewModels _enginedataService = GlobalObject.container.Resolve(); _iOModuleService = GlobalObject.container.Resolve(); } - public DialogCloseListener RequestClose { get; } + public string Title => ""; + + public event Action RequestClose; public bool CanCloseDialog() { @@ -151,9 +144,9 @@ namespace SWS.CAD.ViewModels } public override void ExecuteOKCommandAsync(object para) { - Prism.Dialogs.DialogParameters res = new Prism.Dialogs.DialogParameters(); + IDialogParameters res = new Prism.Services.Dialogs.DialogParameters(); //res.Add(GlobalObject.dialogPar.info.ToString(), $"{TextInfo}"); - RequestClose.Invoke(res, ButtonResult.Yes); + RequestClose.Invoke(new DialogResult(ButtonResult.Yes, res)); } public override void ExecuteCloseCommand(object parameter) { @@ -167,11 +160,12 @@ namespace SWS.CAD.ViewModels //} if (parameter as string == "ClickNo") { - RequestClose.Invoke(ButtonResult.No); + DialogResult res = new DialogResult(ButtonResult.No); + RequestClose.Invoke(res); } else { - RequestClose.Invoke(ButtonResult.Cancel); + RequestClose.Invoke(new DialogResult(ButtonResult.Cancel)); } this.Dispose(); } diff --git a/newFront/c#前端/SWS.CAD/ViewModels/DialogCheckInRecordViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/DialogCheckInRecordViewModel.cs index b526e90b..b784423e 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/DialogCheckInRecordViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/DialogCheckInRecordViewModel.cs @@ -1,25 +1,14 @@ using Aspose.Cells.Drawing; -using Prism.Dialogs; -using SWS.CAD.Models; -using SWS.CAD.Services; +using Prism.Services.Dialogs; using SWS.CAD.ViewModels.myViewModelBase; -using SWS.CAD.Views; -using SWS.CAD.Views.CustomControl; +using SWS.Commons; +using SWS.Model; +using SWS.Service; using System; -using System.Collections.Generic; using System.Collections.ObjectModel; -using System.Globalization; using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; using System.Windows.Forms; -using System.Windows.Interop; -using Teigha.DatabaseServices; -using Telerik.Windows.Controls; using Unity; -using static Bricscad.Quad.QuadSelectionData; using DialogResult = System.Windows.Forms.DialogResult; using MessageBox = System.Windows.Forms.MessageBox; @@ -36,7 +25,9 @@ namespace SWS.CAD.ViewModels _annexesService = GlobalObject.container.Resolve(); } - public DialogCloseListener RequestClose { get; } + public string Title => ""; + + public event Action RequestClose; public bool CanCloseDialog() { @@ -107,11 +98,12 @@ namespace SWS.CAD.ViewModels { if (parameter as string == "ClickNo") { - RequestClose.Invoke(ButtonResult.No); + Prism.Services.Dialogs.DialogResult res = new Prism.Services.Dialogs.DialogResult(ButtonResult.No); + RequestClose.Invoke(res); } else { - RequestClose.Invoke(ButtonResult.Cancel); + RequestClose.Invoke(new Prism.Services.Dialogs.DialogResult(ButtonResult.Cancel)); } this.Dispose(); } diff --git a/newFront/c#前端/SWS.CAD/ViewModels/DialogDrawingCatalogueViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/DialogDrawingCatalogueViewModel.cs index 6f800cae..4141c804 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/DialogDrawingCatalogueViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/DialogDrawingCatalogueViewModel.cs @@ -1,21 +1,11 @@ -using Prism.Dialogs; -using SWS.CAD.Models; -using SWS.CAD.Services; +using Prism.Services.Dialogs; using SWS.CAD.ViewModels.myViewModelBase; -using SWS.CAD.Views; -using SWS.CAD.Views.CustomControl; +using SWS.Commons; +using SWS.Model; +using SWS.Service; using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows; -using Teigha.DatabaseServices; -using Telerik.Windows.Controls; using Unity; -using static Bricscad.Quad.QuadSelectionData; namespace SWS.CAD.ViewModels { @@ -28,7 +18,9 @@ namespace SWS.CAD.ViewModels _drawingCatalogueService = GlobalObject.container.Resolve(); } - public DialogCloseListener RequestClose { get; } + public string Title => ""; + + public event Action RequestClose; public bool CanCloseDialog() { @@ -115,19 +107,20 @@ namespace SWS.CAD.ViewModels else { MessageBox.Show("保存成功!"); } #endregion - Prism.Dialogs.DialogParameters resPara = new Prism.Dialogs.DialogParameters(); + IDialogParameters resPara = new Prism.Services.Dialogs.DialogParameters(); resPara.Add(GlobalObject.dialogPar.info.ToString(), NameZH); - RequestClose.Invoke(resPara, ButtonResult.Yes); + RequestClose.Invoke(new DialogResult(ButtonResult.Yes, resPara)); } public override void ExecuteCloseCommand(object parameter) { if (parameter as string == "ClickNo") { - RequestClose.Invoke(ButtonResult.No); + DialogResult res = new DialogResult(ButtonResult.No); + RequestClose.Invoke(res); } else { - RequestClose.Invoke(ButtonResult.Cancel); + RequestClose.Invoke(new DialogResult(ButtonResult.Cancel)); } this.Dispose(); } diff --git a/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogBusbarManagementViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogBusbarManagementViewModel.cs index 196235f1..7c5063d2 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogBusbarManagementViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogBusbarManagementViewModel.cs @@ -2,23 +2,15 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Controls; using System.Windows; -using Prism.Common; -using Prism.Dialogs; -using SWS.CAD.Services; using SWS.CAD.ViewModels.myViewModelBase; -using SWS.CAD.Views.CustomControl; -using SWS.CAD.Models; -using Bricscad.EditorInput; using System.Windows.Input; using Telerik.Windows.Controls; -using System.Web.UI.WebControls; using Prism.Ioc; -using SWS.CAD.Views.SignalManagementViews; -using System.Diagnostics; +using Prism.Services.Dialogs; +using SWS.Commons; +using SWS.Model; +using SWS.WPF.Views; namespace SWS.CAD.ViewModels { @@ -105,7 +97,9 @@ namespace SWS.CAD.ViewModels #endregion - public DialogCloseListener RequestClose { get; } + public string Title => ""; + + public event Action RequestClose; public bool CanCloseDialog() { return true; @@ -141,21 +135,22 @@ namespace SWS.CAD.ViewModels public override void ExecuteOKCommandAsync(object para) { - Prism.Dialogs.DialogParameters res = new Prism.Dialogs.DialogParameters(); + IDialogParameters res = new Prism.Services.Dialogs.DialogParameters(); //res.Add(GlobalObject.dialogPar.para1.ToString(), Cables.ToList()); res.Add(GlobalObject.dialogPar.para1.ToString(), UpdateCableLs.ToList()); - RequestClose.Invoke(res, ButtonResult.Yes); + RequestClose.Invoke(new DialogResult(ButtonResult.Yes, res)); } public override void ExecuteCloseCommand(object parameter) { if (parameter as string == "ClickNo") { - RequestClose.Invoke(ButtonResult.No); + DialogResult res = new DialogResult(ButtonResult.No); + RequestClose.Invoke(res); } else { - RequestClose.Invoke(ButtonResult.Cancel); + RequestClose.Invoke(new DialogResult(ButtonResult.Cancel)); } this.Dispose(); } @@ -200,7 +195,7 @@ namespace SWS.CAD.ViewModels public void NewSignal(object parameter) { //打开信号管理页面 - Prism.Dialogs.DialogParameters para = new Prism.Dialogs.DialogParameters(); + IDialogParameters para = new Prism.Services.Dialogs.DialogParameters(); para.Add(GlobalObject.dialogPar.para1.ToString(), "关联母线"); var _dialogService = GlobalObject._prismContainer.Resolve(); _dialogService.ShowDialog(nameof(DialogSignalManagement), para, (RES) => diff --git a/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogCableConfigViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogCableConfigViewModel.cs index 1f0827d1..effe0cb2 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogCableConfigViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogCableConfigViewModel.cs @@ -2,23 +2,14 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Controls; -using System.Windows; -using Prism.Common; -using Prism.Dialogs; -using SWS.CAD.Services; using SWS.CAD.ViewModels.myViewModelBase; -using SWS.CAD.Views.CustomControl; -using SWS.CAD.Models; -using Bricscad.EditorInput; using System.Windows.Input; using Telerik.Windows.Controls; -using Teigha.DatabaseServices.Filters; -using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; -using System.Web.UI.WebControls; using Unity; +using Prism.Services.Dialogs; +using SWS.Commons; +using SWS.Service; +using SWS.Model; namespace SWS.CAD.ViewModels { @@ -102,7 +93,9 @@ namespace SWS.CAD.ViewModels } - public DialogCloseListener RequestClose { get; } + public string Title => ""; + + public event Action RequestClose; public bool CanCloseDialog() { return true; @@ -199,21 +192,22 @@ namespace SWS.CAD.ViewModels public override void ExecuteOKCommandAsync(object para) { - Prism.Dialogs.DialogParameters res = new Prism.Dialogs.DialogParameters(); + IDialogParameters res = new Prism.Services.Dialogs.DialogParameters(); res.Add(GlobalObject.dialogPar.para1.ToString(), CableSetInfos); - RequestClose.Invoke(res, ButtonResult.Yes); + RequestClose.Invoke(new DialogResult(ButtonResult.Yes, res)); } public override void ExecuteCloseCommand(object parameter) { if (parameter as string == "ClickNo") { - RequestClose.Invoke(ButtonResult.No); + DialogResult res = new DialogResult(ButtonResult.No); + RequestClose.Invoke(res); } else { - RequestClose.Invoke(ButtonResult.Cancel); + RequestClose.Invoke(new DialogResult(ButtonResult.Cancel)); } this.Dispose(); } @@ -270,7 +264,7 @@ namespace SWS.CAD.ViewModels var httpres = await _iOModuleService.DeleteCableProfile(_ec_Cable.CableID); if (httpres == null) { - RequestClose.Invoke(ButtonResult.Cancel); + RequestClose.Invoke(new DialogResult(ButtonResult.Cancel)); this.Dispose(); } diff --git a/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogCablePreAssignPreviewViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogCablePreAssignPreviewViewModel.cs index 737a7681..4cc233ee 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogCablePreAssignPreviewViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogCablePreAssignPreviewViewModel.cs @@ -2,21 +2,14 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Controls; -using System.Windows; -using Prism.Common; -using Prism.Dialogs; -using SWS.CAD.Services; using SWS.CAD.ViewModels.myViewModelBase; -using SWS.CAD.Views.CustomControl; -using SWS.CAD.Models; -using Bricscad.EditorInput; using System.Windows.Input; using Telerik.Windows.Controls; using Prism.Ioc; using SWS.CAD.Views.Dialog; +using Prism.Services.Dialogs; +using SWS.Commons; +using SWS.Model; namespace SWS.CAD.ViewModels { @@ -38,7 +31,9 @@ namespace SWS.CAD.ViewModels } #endregion - public DialogCloseListener RequestClose { get; } + public string Title => ""; + + public event Action RequestClose; public bool CanCloseDialog() { return true; @@ -63,7 +58,7 @@ namespace SWS.CAD.ViewModels if (PreAssignCables.Any(p => p.IsChecked == true)) { //打开窗体 - Prism.Dialogs.DialogParameters para = new Prism.Dialogs.DialogParameters(); + IDialogParameters para = new Prism.Services.Dialogs.DialogParameters(); para.Add(GlobalObject.dialogPar.para1.ToString(), PreAssignCables); var _dialogService = GlobalObject._prismContainer.Resolve(); _dialogService.ShowDialog(nameof(DialogCablePreAssignResult), para, async (RES) => @@ -78,19 +73,20 @@ namespace SWS.CAD.ViewModels } //返回的结果 - Prism.Dialogs.DialogParameters res = new Prism.Dialogs.DialogParameters(); + IDialogParameters res = new Prism.Services.Dialogs.DialogParameters(); //res.Add(GlobalObject.dialogPar.para1.ToString(), SelectedStripParametersInfo); - RequestClose.Invoke(res, ButtonResult.Yes); + RequestClose.Invoke(new DialogResult(ButtonResult.Yes, res)); } public override void ExecuteCloseCommand(object parameter) { if (parameter as string == "ClickNo") { - RequestClose.Invoke(ButtonResult.No); + DialogResult res = new DialogResult(ButtonResult.No); + RequestClose.Invoke(res); } else { - RequestClose.Invoke(ButtonResult.Cancel); + RequestClose.Invoke(new DialogResult(ButtonResult.Cancel)); } this.Dispose(); } diff --git a/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogCablePreAssignResultViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogCablePreAssignResultViewModel.cs index cb3a9f6f..30c3fab7 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogCablePreAssignResultViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogCablePreAssignResultViewModel.cs @@ -1,20 +1,12 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Controls; -using System.Windows; -using Prism.Common; -using Prism.Dialogs; -using SWS.CAD.Services; using SWS.CAD.ViewModels.myViewModelBase; -using SWS.CAD.Views.CustomControl; -using SWS.CAD.Models; -using Bricscad.EditorInput; using System.Windows.Input; using Telerik.Windows.Controls; +using Prism.Services.Dialogs; +using SWS.Commons; +using SWS.Model; namespace SWS.CAD.ViewModels { @@ -119,7 +111,9 @@ namespace SWS.CAD.ViewModels #endregion #endregion - public DialogCloseListener RequestClose { get; } + public string Title => ""; + + public event Action RequestClose; public bool CanCloseDialog() { return true; @@ -143,19 +137,20 @@ namespace SWS.CAD.ViewModels { //返回结果 - Prism.Dialogs.DialogParameters res = new Prism.Dialogs.DialogParameters(); + IDialogParameters res = new Prism.Services.Dialogs.DialogParameters(); //res.Add(GlobalObject.dialogPar.para1.ToString(), SelectedStripParametersInfo); - RequestClose.Invoke(res, ButtonResult.Yes); + RequestClose.Invoke(new DialogResult(ButtonResult.Yes, res)); } public override void ExecuteCloseCommand(object parameter) { if (parameter as string == "ClickNo") { - RequestClose.Invoke(ButtonResult.No); + DialogResult res = new DialogResult(ButtonResult.No); + RequestClose.Invoke(res); } else { - RequestClose.Invoke(ButtonResult.Cancel); + RequestClose.Invoke(new DialogResult(ButtonResult.Cancel)); } this.Dispose(); } diff --git a/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogChannelMigrationViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogChannelMigrationViewModel.cs index 3b43a98a..e21dc495 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogChannelMigrationViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogChannelMigrationViewModel.cs @@ -1,44 +1,36 @@ using System; -using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Controls; using System.Windows; -using Prism.Common; -using Prism.Dialogs; -using SWS.CAD.Services; using SWS.CAD.ViewModels.myViewModelBase; -using SWS.CAD.Views.CustomControl; -using SWS.CAD.Models; -using Bricscad.EditorInput; using System.Windows.Input; using Telerik.Windows.Controls; using Unity; -using System.Runtime.Remoting; -using System.Runtime.Remoting.Channels; +using Prism.Services.Dialogs; +using SWS.Commons; +using SWS.Service; +using SWS.Model; namespace SWS.CAD.ViewModels { public class DialogChannelMigrationViewModel : DialogBase, IDialogAware { #region 字段 - private ObservableCollection _PanelTreels = new ObservableCollection(); + private ObservableCollection _PanelTreels = new ObservableCollection(); /// /// 页面左侧树形结构数据 /// - public ObservableCollection PanelTreels + public ObservableCollection PanelTreels { get { return _PanelTreels; } set { _PanelTreels = value; RaisePropertyChanged(nameof(PanelTreels)); } } - private TreeModel _SelectedTreeNode; + private Model.TreeModel _SelectedTreeNode; /// /// 当前选中的树形节点 /// - public TreeModel SelectedTreeNode + public Model.TreeModel SelectedTreeNode { get { return _SelectedTreeNode; } set @@ -83,7 +75,9 @@ namespace SWS.CAD.ViewModels { _iOModuleService = GlobalObject.container.Resolve(); } - public DialogCloseListener RequestClose { get; } + public string Title => ""; + + public event Action RequestClose; public bool CanCloseDialog() { return true; @@ -114,10 +108,10 @@ namespace SWS.CAD.ViewModels } else { - Prism.Dialogs.DialogParameters res = new Prism.Dialogs.DialogParameters(); + IDialogParameters res = new Prism.Services.Dialogs.DialogParameters(); res.Add(GlobalObject.dialogPar.para1.ToString(), SelectedChannel); res.Add(GlobalObject.dialogPar.para2.ToString(), panelStrip); - RequestClose.Invoke(res, ButtonResult.Yes); + RequestClose.Invoke(new DialogResult(ButtonResult.Yes, res)); } } @@ -125,11 +119,12 @@ namespace SWS.CAD.ViewModels { if (parameter as string == "ClickNo") { - RequestClose.Invoke(ButtonResult.No); + DialogResult res = new DialogResult(ButtonResult.No); + RequestClose.Invoke(res); } else { - RequestClose.Invoke(ButtonResult.Cancel); + RequestClose.Invoke(new DialogResult(ButtonResult.Cancel)); } this.Dispose(); } diff --git a/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogIODistributionViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogIODistributionViewModel.cs index 1d8a8092..bfd8f1a3 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogIODistributionViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogIODistributionViewModel.cs @@ -1,45 +1,31 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.Diagnostics.Eventing.Reader; using System.IO; using System.Linq; -using System.Runtime.Remoting.Channels; -using System.Text; using System.Threading.Tasks; -using System.Web.UI.WebControls; -using System.Web.Util; -using System.Web.WebSockets; using System.Windows; -using System.Windows.Documents; -using System.Windows.Forms; using System.Windows.Input; -using System.Windows.Media.Animation; using System.Windows.Threading; using Bricscad.ApplicationServices; -using Bricscad.Civil; using Bricscad.EditorInput; -using NLog.LayoutRenderers; using OfficeOpenXml; -using Prism.Dialogs; using Prism.Events; using Prism.Ioc; +using Prism.Services.Dialogs; using SWS.CAD.CADFunc; using SWS.CAD.Event; -using SWS.CAD.Models; -using SWS.CAD.Services; using SWS.CAD.ViewModels.myViewModelBase; -using SWS.CAD.Views.CustomControl; using SWS.CAD.Views.Dialog; -using SWS.CAD.Views.SignalManagementViews; +using SWS.Commons; +using SWS.Model; +using SWS.Service; +using SWS.WPF.Views; using Teigha.DatabaseServices; using Telerik.Windows.Controls; -using Telerik.Windows.Controls.GridView; using Telerik.Windows.Data; using Unity; -using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window; -using static SWS.CAD.Services.IOModuleService; -using static SWS.CAD.Services.WireGroupService; +using static SWS.Service.IOModuleService; using Application = Bricscad.ApplicationServices.Application; namespace SWS.CAD.ViewModels @@ -47,21 +33,21 @@ namespace SWS.CAD.ViewModels public class DialogIODistributionViewModel : DialogBase, IDialogAware { #region 字段 - private ObservableCollection _PanelTreels = new ObservableCollection(); + private ObservableCollection _PanelTreels = new ObservableCollection(); /// /// 页面左侧树形结构数据 /// - public ObservableCollection PanelTreels + public ObservableCollection PanelTreels { get { return _PanelTreels; } set { _PanelTreels = value; RaisePropertyChanged(nameof(PanelTreels)); } } - private TreeModel _SelectedTreeNode; + private Model.TreeModel _SelectedTreeNode; /// /// 当前选中的树形节点 /// - public TreeModel SelectedTreeNode + public Model.TreeModel SelectedTreeNode { get { return _SelectedTreeNode; } set @@ -176,7 +162,9 @@ namespace SWS.CAD.ViewModels _eventAggregator.GetEvent().Subscribe(onGetHandsId, ThreadOption.UIThread, true); _eventAggregator.GetEvent().Subscribe(onGetdwgFileId, ThreadOption.UIThread, true); } - public DialogCloseListener RequestClose { get; } + public string Title => ""; + + public event Action RequestClose; public bool CanCloseDialog() { @@ -197,9 +185,9 @@ namespace SWS.CAD.ViewModels public override void ExecuteOKCommandAsync(object para) { - Prism.Dialogs.DialogParameters res = new Prism.Dialogs.DialogParameters(); + IDialogParameters res = new Prism.Services.Dialogs.DialogParameters(); //res.Add(GlobalObject.dialogPar.info.ToString(), $"{TextInfo}"); - RequestClose.Invoke(res, ButtonResult.Yes); + RequestClose.Invoke(new DialogResult(ButtonResult.Yes, res)); } public override void ExecuteCloseCommand(object parameter) { @@ -213,11 +201,12 @@ namespace SWS.CAD.ViewModels //} if (parameter as string == "ClickNo") { - RequestClose.Invoke(ButtonResult.No); + DialogResult res = new DialogResult(ButtonResult.No); + RequestClose.Invoke(res); } else { - RequestClose.Invoke(ButtonResult.Cancel); + RequestClose.Invoke(new DialogResult(ButtonResult.Cancel)); } this.Dispose(); } @@ -360,7 +349,7 @@ namespace SWS.CAD.ViewModels /// 更新树形结构的方法 /// /// - public void UpdateTreeNodes(List newNodes) + public void UpdateTreeNodes(List newNodes) { // 1. 保存当前选中节点的 ID(避免直接引用可能失效) string selectedNodeId = SelectedTreeNode?.ID; @@ -387,7 +376,7 @@ namespace SWS.CAD.ViewModels if (string.IsNullOrEmpty(targetNodeId)) return; // 递归查找目标节点 - TreeModel foundNode = FindNodeByNodeId(PanelTreels, targetNodeId); + Model.TreeModel foundNode = FindNodeByNodeId(PanelTreels, targetNodeId); if (foundNode != null) { SelectedTreeNode = foundNode; @@ -404,7 +393,7 @@ namespace SWS.CAD.ViewModels /// /// /// - private TreeModel FindNodeByNodeId(IEnumerable nodes, string nodeId) + private Model.TreeModel FindNodeByNodeId(IEnumerable nodes, string nodeId) { foreach (var node in nodes) { @@ -502,7 +491,7 @@ namespace SWS.CAD.ViewModels ObservableCollection ReslistPro = new ObservableCollection(); //打开窗体 - Prism.Dialogs.DialogParameters para = new Prism.Dialogs.DialogParameters(); + IDialogParameters para = new Prism.Services.Dialogs.DialogParameters(); para.Add(GlobalObject.dialogPar.title.ToString(), title); para.Add(GlobalObject.dialogPar.para1.ToString(), listPropertys); var _dialogService = GlobalObject._prismContainer.Resolve(); @@ -543,9 +532,9 @@ namespace SWS.CAD.ViewModels /// public virtual async void MouseRight_Click(object parameter) { - if (parameter.GetType() == typeof(TreeModel)) + if (parameter.GetType() == typeof(Model.TreeModel)) { - var treeNode = parameter as TreeModel; + var treeNode = parameter as Model.TreeModel; dynamic dynamicObj = treeNode.NodeExtData; string PanelIDValue = dynamicObj.PanelID; var panel = await _iOModuleService.GetPanel(PanelIDValue); @@ -593,7 +582,7 @@ namespace SWS.CAD.ViewModels } listPropertys.Add(new propertyModel() { Id = "位置选择", DisplayText = "位置选择", GroupName = "采集箱位置", PropertyValue = PanelTreels.Where(p => p.ID.Equals(treeNode.parentId)).Select(p => p.Text).FirstOrDefault(), ControlTypeName = PROPERTYType.ComboBox, Item = listPanelTrees }); //打开窗体 - Prism.Dialogs.DialogParameters para = new Prism.Dialogs.DialogParameters(); + IDialogParameters para = new Prism.Services.Dialogs.DialogParameters(); para.Add(GlobalObject.dialogPar.title.ToString(), "采集箱属性"); para.Add(GlobalObject.dialogPar.para1.ToString(), listPropertys); var _dialogService = GlobalObject._prismContainer.Resolve(); @@ -678,7 +667,7 @@ namespace SWS.CAD.ViewModels listPropertys.Add(new propertyModel() { Id = "value", DisplayText = "位置描述", GroupName = "基本参数", PropertyValue = "", ControlTypeName = PROPERTYType.TextBox }); listPropertys.Add(new propertyModel() { Id = "nodeType", DisplayText = "排序号", GroupName = "基本参数", PropertyValue = "0", ControlTypeName = PROPERTYType.TextBox }); //打开窗体 - Prism.Dialogs.DialogParameters para = new Prism.Dialogs.DialogParameters(); + IDialogParameters para = new Prism.Services.Dialogs.DialogParameters(); para.Add(GlobalObject.dialogPar.title.ToString(), "新增位置参数"); para.Add(GlobalObject.dialogPar.para1.ToString(), listPropertys); var _dialogService = GlobalObject._prismContainer.Resolve(); @@ -688,7 +677,7 @@ namespace SWS.CAD.ViewModels { var listPro = RES.Parameters.GetValue>(GlobalObject.dialogPar.para1.ToString()); - ec_dataitemdetail ent = new ec_dataitemdetail() + Model.ec_dataitemdetail ent = new Model.ec_dataitemdetail() { DataItemID = DataItemIDValue, DataItemCode = listPro.Where(p => p.DisplayText.Equals("位置描述")).Select(p => p.PropertyValue).FirstOrDefault(), @@ -746,7 +735,7 @@ namespace SWS.CAD.ViewModels } //打开窗体 - Prism.Dialogs.DialogParameters para = new Prism.Dialogs.DialogParameters(); + IDialogParameters para = new Prism.Services.Dialogs.DialogParameters(); para.Add(GlobalObject.dialogPar.title.ToString(), "端子排模版"); para.Add(GlobalObject.dialogPar.para1.ToString(), StripParametersInfos); para.Add(GlobalObject.dialogPar.para2.ToString(), true); @@ -785,7 +774,7 @@ namespace SWS.CAD.ViewModels listTermNameSuffix.Add("无", "无"); listPropertys.Add(new propertyModel() { Id = "TermNameSuffix", DisplayText = "端子后缀", GroupName = "端子编号", PropertyValue = stripParametersInfo.TermNameSuffix, ControlTypeName = PROPERTYType.ComboBox, Item = listTermNameSuffix }); //打开窗体 - para = new Prism.Dialogs.DialogParameters(); + para = new Prism.Services.Dialogs.DialogParameters(); para.Add(GlobalObject.dialogPar.title.ToString(), "新建端子排"); para.Add(GlobalObject.dialogPar.para1.ToString(), listPropertys); _dialogService = GlobalObject._prismContainer.Resolve(); @@ -932,7 +921,7 @@ namespace SWS.CAD.ViewModels listPropertys.Add(new propertyModel() { Id = "value", DisplayText = "位置描述", GroupName = "基本参数", PropertyValue = DataItemCodeValue, ControlTypeName = PROPERTYType.TextBox }); listPropertys.Add(new propertyModel() { Id = "nodeType", DisplayText = "排序号", GroupName = "基本参数", PropertyValue = OrderIDValue, ControlTypeName = PROPERTYType.TextBox }); //打开窗体 - Prism.Dialogs.DialogParameters para = new Prism.Dialogs.DialogParameters(); + IDialogParameters para = new Prism.Services.Dialogs.DialogParameters(); para.Add(GlobalObject.dialogPar.title.ToString(), "编辑位置参数"); para.Add(GlobalObject.dialogPar.para1.ToString(), listPropertys); var _dialogService = GlobalObject._prismContainer.Resolve(); @@ -942,7 +931,7 @@ namespace SWS.CAD.ViewModels { var listPro = RES.Parameters.GetValue>(GlobalObject.dialogPar.para1.ToString()); - ec_dataitemdetail ent = new ec_dataitemdetail() + Model.ec_dataitemdetail ent = new Model.ec_dataitemdetail() { DataItemID = DataItemIDValue, DataItemDetailID = DataItemDetailIDValue, @@ -976,7 +965,7 @@ namespace SWS.CAD.ViewModels listPropertys.Add(new propertyModel() { Id = "IO_TYPE", DisplayText = "信号类型", GroupName = "基本参数", PropertyValue = IO_TYPEValue, ControlTypeName = PROPERTYType.TextBox }); listPropertys.Add(new propertyModel() { Id = "Panel_Strip_Seq", DisplayText = "排序号", GroupName = "基本参数", PropertyValue = Panel_Strip_SeqValue, ControlTypeName = PROPERTYType.TextBox }); //打开窗体 - Prism.Dialogs.DialogParameters para = new Prism.Dialogs.DialogParameters(); + IDialogParameters para = new Prism.Services.Dialogs.DialogParameters(); para.Add(GlobalObject.dialogPar.title.ToString(), "编辑端子排"); para.Add(GlobalObject.dialogPar.para1.ToString(), listPropertys); var _dialogService = GlobalObject._prismContainer.Resolve(); @@ -1045,7 +1034,7 @@ namespace SWS.CAD.ViewModels { IsBusy = true; var listPropertys = new List(); - List AllTagNumbers = await _objectTypeService.GetListBySQL("ObjectTypeName like '%电缆%'"); + List AllTagNumbers = await _objectTypeService.GetListBySQL("ObjectTypeName like '%电缆%'"); if (AllTagNumbers == null) return; Dictionary listTagNumbers = new Dictionary(); listTagNumbers.Add("新增电缆位号", "新增电缆位号"); @@ -1056,7 +1045,7 @@ namespace SWS.CAD.ViewModels listPropertys.Add(new propertyModel() { Id = "TagNumber", DisplayText = "电缆位号", GroupName = "位号列表", PropertyValue = "", ControlTypeName = PROPERTYType.ComboBox, Item = listTagNumbers, IsReturnChanged = true, WhichPage = "电缆位号选择" }); IsBusy = false; //打开窗体 - Prism.Dialogs.DialogParameters para = new Prism.Dialogs.DialogParameters(); + IDialogParameters para = new Prism.Services.Dialogs.DialogParameters(); para.Add(GlobalObject.dialogPar.title.ToString(), "电缆位号选择"); para.Add(GlobalObject.dialogPar.para1.ToString(), listPropertys); var _dialogService = GlobalObject._prismContainer.Resolve(); @@ -1277,7 +1266,7 @@ namespace SWS.CAD.ViewModels else if (CableBy.CableClass.Equals("conventional") || CableBy.CableClass.Equals(""))//常规电缆 { //打开配置连接窗体 - Prism.Dialogs.DialogParameters para1 = new Prism.Dialogs.DialogParameters(); + IDialogParameters para1 = new Prism.Services.Dialogs.DialogParameters(); para1.Add(GlobalObject.dialogPar.title.ToString(), "端子排连接" + "电缆配置"); para1.Add(GlobalObject.dialogPar.para1.ToString(), CableBy); para1.Add(GlobalObject.dialogPar.para2.ToString(), panelStrip); @@ -1350,7 +1339,7 @@ namespace SWS.CAD.ViewModels } //SaveConnection - Connections newConnections = new Connections(); + Service.IOModuleService.Connections newConnections = new Service.IOModuleService.Connections(); newConnections.Conns = new List(); foreach (var CableSetInfo in CableSetInfos) { @@ -1435,7 +1424,7 @@ namespace SWS.CAD.ViewModels Database db = doc.Database; Editor ed = doc.Editor; //选择的元素返回的属性信息 - ec_enginedata resTagNumberListByPixels = new ec_enginedata(); + Model.ec_enginedata resTagNumberListByPixels = new Model.ec_enginedata(); var listPropertys = new List(); // 持续选择直到获取有效电缆 bool isValidCable = false; @@ -1709,7 +1698,7 @@ namespace SWS.CAD.ViewModels else if (CableBy.CableClass.Equals("conventional") || CableBy.CableClass.Equals(""))//常规电缆 { //打开配置连接窗体 - Prism.Dialogs.DialogParameters para1 = new Prism.Dialogs.DialogParameters(); + IDialogParameters para1 = new Prism.Services.Dialogs.DialogParameters(); para1.Add(GlobalObject.dialogPar.title.ToString(), "端子排连接" + "电缆配置"); para1.Add(GlobalObject.dialogPar.para1.ToString(), CableBy); para1.Add(GlobalObject.dialogPar.para2.ToString(), panelStrip); @@ -1785,7 +1774,7 @@ namespace SWS.CAD.ViewModels } //SaveConnection - Connections newConnections = new Connections(); + Service.IOModuleService.Connections newConnections = new Service.IOModuleService.Connections(); newConnections.Conns = new List(); foreach (var CableSetInfo in CableSetInfos) { @@ -1896,7 +1885,7 @@ namespace SWS.CAD.ViewModels listTermNameSuffix.Add("无", "无"); listPropertys.Add(new propertyModel() { Id = "TermNameSuffix", DisplayText = "端子后缀", GroupName = "端子编号", PropertyValue = stripParametersInfo.TermNameSuffix, ControlTypeName = PROPERTYType.ComboBox, Item = listTermNameSuffix }); //打开窗体 - Prism.Dialogs.DialogParameters para = new Prism.Dialogs.DialogParameters(); + IDialogParameters para = new Prism.Services.Dialogs.DialogParameters(); para.Add(GlobalObject.dialogPar.title.ToString(), "新增端子排通道"); para.Add(GlobalObject.dialogPar.para1.ToString(), listPropertys); var _dialogService = GlobalObject._prismContainer.Resolve(); @@ -2081,7 +2070,7 @@ namespace SWS.CAD.ViewModels if (parameter.ToString().Equals("导出端子排(模块)使用明细表")) { // 保存文件 - SaveFileDialog saveDialog = new SaveFileDialog + System.Windows.Forms.SaveFileDialog saveDialog = new System.Windows.Forms.SaveFileDialog { Filter = "Excel文件|*.xlsx", DefaultExt = ".xlsx", @@ -2110,10 +2099,10 @@ namespace SWS.CAD.ViewModels // 填充数据 int row = 2; - TreeModel PanelTree = PanelTreels.Where(p => p.Text.Equals("默认")).FirstOrDefault(); + Model.TreeModel PanelTree = PanelTreels.Where(p => p.Text.Equals("默认")).FirstOrDefault(); - foreach (TreeModel node in PanelTree.ChildNodes) + foreach (Model.TreeModel node in PanelTree.ChildNodes) { // 使用dynamic关键字,让编译器在运行时解析类型信息,使用属性名直接访问 dynamic PanelObj = node.NodeExtData; @@ -2206,7 +2195,7 @@ namespace SWS.CAD.ViewModels } //打开窗体 - Prism.Dialogs.DialogParameters para = new Prism.Dialogs.DialogParameters(); + IDialogParameters para = new Prism.Services.Dialogs.DialogParameters(); para.Add(GlobalObject.dialogPar.title.ToString(), "新增位置参数"); para.Add(GlobalObject.dialogPar.para1.ToString(), StripParametersInfos); para.Add(GlobalObject.dialogPar.para2.ToString(), false); @@ -2350,7 +2339,7 @@ namespace SWS.CAD.ViewModels else { //打开通道迁移页面 - Prism.Dialogs.DialogParameters para = new Prism.Dialogs.DialogParameters(); + IDialogParameters para = new Prism.Services.Dialogs.DialogParameters(); para.Add(GlobalObject.dialogPar.para1.ToString(), panelStrip); var _dialogService = GlobalObject._prismContainer.Resolve(); _dialogService.ShowDialog(nameof(DialogChannelMigration), para, async (RES) => @@ -2498,7 +2487,7 @@ namespace SWS.CAD.ViewModels { //打开信号管理页面 - Prism.Dialogs.DialogParameters para = new Prism.Dialogs.DialogParameters(); + IDialogParameters para = new Prism.Services.Dialogs.DialogParameters(); para.Add(GlobalObject.dialogPar.para1.ToString(), "关联通道"); para.Add(GlobalObject.dialogPar.info.ToString(), SelectedChannelInfo.Signal != null ? SelectedChannelInfo.Signal : null);//表示已有关联信号 var _dialogService = GlobalObject._prismContainer.Resolve(); @@ -2507,7 +2496,7 @@ namespace SWS.CAD.ViewModels if (RES.Result == ButtonResult.Yes) { //获取返回的信号信息在页面显示 - var signalInfos = RES.Parameters.GetValue>(GlobalObject.dialogPar.para1.ToString()); + var signalInfos = RES.Parameters.GetValue>(GlobalObject.dialogPar.para1.ToString()); SelectedChannelInfo.SignalName = signalInfos.FirstOrDefault()?.Group_Name; SelectedChannelInfo.GroupOther = signalInfos.FirstOrDefault()?.Signal_Group; SelectedChannelInfo.SignalCode = signalInfos.FirstOrDefault()?.Signal_SeqNo; @@ -2532,13 +2521,13 @@ namespace SWS.CAD.ViewModels #region 解除信号 if (parameter.ToString().Equals("解除信号")) { - WireGroups ent = new WireGroups(); + Model.WireGroups ent = new Model.WireGroups(); if (SelectedChannelInfo.Signal != null) { SelectedChannelInfo.Signal.ChannelID = ""; SelectedChannelInfo.Signal.StripName = ""; } - ent.Signals = new List(); + ent.Signals = new List(); ent.Signals.Add(SelectedChannelInfo.Signal); //解除信号 var data = await _wireGroupService.SaveSignals(ent); @@ -2570,7 +2559,7 @@ namespace SWS.CAD.ViewModels //母线详情逻辑 //打开配置连接窗体 var cables = await _iOModuleService.GetCables(); - Prism.Dialogs.DialogParameters para = new Prism.Dialogs.DialogParameters(); + IDialogParameters para = new Prism.Services.Dialogs.DialogParameters(); para.Add(GlobalObject.dialogPar.info.ToString(), SelectedChannelInfo.CableTag); para.Add(GlobalObject.dialogPar.para1.ToString(), cables); var _dialogService = GlobalObject._prismContainer.Resolve(); @@ -2583,7 +2572,7 @@ namespace SWS.CAD.ViewModels { foreach (var ResCable in ResCables) { - ResCable.WireGroups = new List(); + ResCable.WireGroups = new List(); } var httpres = await _iOModuleService.SaveCables(ResCables); } @@ -2615,7 +2604,7 @@ namespace SWS.CAD.ViewModels } IsBusy = false; //打开窗体 - Prism.Dialogs.DialogParameters para = new Prism.Dialogs.DialogParameters(); + IDialogParameters para = new Prism.Services.Dialogs.DialogParameters(); para.Add(GlobalObject.dialogPar.para1.ToString(), PreAssignCables); var _dialogService = GlobalObject._prismContainer.Resolve(); _dialogService.ShowDialog(nameof(DialogCablePreAssignPreview), para, async (RES) => @@ -2648,7 +2637,7 @@ namespace SWS.CAD.ViewModels private async void SavePanelStrip() { - WireGroups ent = new WireGroups(); + Model.WireGroups ent = new Model.WireGroups(); foreach (var ChannelInfo in ChannelInfos) { if (ChannelInfo.IsModified) @@ -2671,7 +2660,7 @@ namespace SWS.CAD.ViewModels } if (ChannelInfo.IsSaveSignal) { - ec_Wire_Group ec_Wire_Group = new ec_Wire_Group(); + SWS.Model.ec_Wire_Group ec_Wire_Group = new SWS.Model.ec_Wire_Group(); ec_Wire_Group.ChannelID = ChannelInfo.ChannelID; ec_Wire_Group.ElecOnly = ChannelInfo.Signal.ElecOnly; ec_Wire_Group.Group_Desc = ChannelInfo.Signal.Group_Desc; @@ -2684,7 +2673,7 @@ namespace SWS.CAD.ViewModels ec_Wire_Group.StripName = ChannelInfo.StripID; ec_Wire_Group.VDR_Record = ChannelInfo.Signal.VDR_Record; ec_Wire_Group.Wire_Group_ID = ChannelInfo.Signal.Wire_Group_ID; - ent.Signals = new List(); + ent.Signals = new List(); ent.Signals.Add(ec_Wire_Group); } } @@ -2863,11 +2852,11 @@ namespace SWS.CAD.ViewModels RaisePropertyChanged(nameof(SignalType)); } } - private ec_Wire_Group _Signal; + private SWS.Model.ec_Wire_Group _Signal; /// /// 通道关联的信号 /// - public ec_Wire_Group Signal + public SWS.Model.ec_Wire_Group Signal { get { return _Signal; } set diff --git a/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogNewComponentViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogNewComponentViewModel.cs index ed1c12b4..b7553748 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogNewComponentViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogNewComponentViewModel.cs @@ -2,39 +2,32 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Controls; using System.Windows; -using Prism.Common; -using Prism.Dialogs; -using SWS.CAD.Services; -using SWS.CAD.ViewModels.myViewModelBase; -using SWS.CAD.Views.CustomControl; -using SWS.CAD.Models; -using Bricscad.EditorInput; using System.Windows.Input; using Telerik.Windows.Controls; -using System.Runtime.Remoting; using Unity; -using Aspose.Cells.Tables; using System.Windows.Media; using Prism.Ioc; using SWS.CAD.CADFunc; using SWS.CAD.Views; using Prism.Events; using SWS.CAD.Event; +using Prism.Services.Dialogs; +using SWS.Commons; +using SWS.Model; +using SWS.WPF.ViewModels; +using SWS.Service; namespace SWS.CAD.ViewModels { public class DialogNewComponentViewModel : DialogBase, IDialogAware { #region 字段 - private ObservableCollection _TreeNodes; + private ObservableCollection _TreeNodes; /// /// 左侧树形结构数据源 /// - public ObservableCollection TreeNodes + public ObservableCollection TreeNodes { get { return _TreeNodes; } set @@ -44,11 +37,11 @@ namespace SWS.CAD.ViewModels } } - private TreeModel _SelectedTreeNode; + private Model.TreeModel _SelectedTreeNode; /// /// 当前选中的树形节点 /// - public TreeModel SelectedTreeNode + public Model.TreeModel SelectedTreeNode { get { return _SelectedTreeNode; } set @@ -307,7 +300,9 @@ namespace SWS.CAD.ViewModels eventAggregator.GetEvent().Subscribe(LostFocus, ThreadOption.UIThread, true); } - public DialogCloseListener RequestClose { get; } + public string Title => ""; + + public event Action RequestClose; public bool CanCloseDialog() { return true; @@ -324,7 +319,7 @@ namespace SWS.CAD.ViewModels //title = parameters.GetValue(GlobalObject.dialogPar.title.ToString()); title = "新增元件"; //获取左侧树形结构数据 - TreeNodes = new ObservableCollection(GlobalObject.designTree.Where(t => t.Text.Equals("接线设备"))); + TreeNodes = new ObservableCollection(GlobalObject.designTree.Where(t => t.Text.Equals("接线设备"))); IsEnableChangeEvent = parameters.GetValue(GlobalObject.dialogPar.info.ToString()); } @@ -332,19 +327,20 @@ namespace SWS.CAD.ViewModels { //返回结果 - Prism.Dialogs.DialogParameters res = new Prism.Dialogs.DialogParameters(); + IDialogParameters res = new Prism.Services.Dialogs.DialogParameters(); res.Add(GlobalObject.dialogPar.para1.ToString(), listShowProperty); - RequestClose.Invoke(res, ButtonResult.Yes); + RequestClose.Invoke(new DialogResult(ButtonResult.Yes, res)); } public override void ExecuteCloseCommand(object parameter) { if (parameter as string == "ClickNo") { - RequestClose.Invoke(ButtonResult.No); + DialogResult res = new DialogResult(ButtonResult.No); + RequestClose.Invoke(res); } else { - RequestClose.Invoke(ButtonResult.Cancel); + RequestClose.Invoke(new DialogResult(ButtonResult.Cancel)); } this.Dispose(); } @@ -454,7 +450,7 @@ namespace SWS.CAD.ViewModels /// 左边列表选中元件类型,右边出现对应属性,左下方出现图元列表 /// /// - private async void onTypeChange(TreeModel node) + private async void onTypeChange(Model.TreeModel node) { if (node != null) { @@ -591,7 +587,7 @@ namespace SWS.CAD.ViewModels { return; } if (string.IsNullOrEmpty(CurrentPropertyName)) { return; } - Prism.Dialogs.DialogParameters x = new Prism.Dialogs.DialogParameters(); + IDialogParameters x = new Prism.Services.Dialogs.DialogParameters(); x.Add(GlobalObject.dialogPar.para1.ToString(), SelectObject.tagNumber); x.Add(GlobalObject.dialogPar.para2.ToString(), CurrentPropertyName); var _dialogService = GlobalObject._prismContainer.Resolve(); diff --git a/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogNewPositionalViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogNewPositionalViewModel.cs index 494fdf16..6cf3103b 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogNewPositionalViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogNewPositionalViewModel.cs @@ -2,23 +2,16 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Controls; using System.Windows; -using Prism.Common; -using Prism.Dialogs; -using SWS.CAD.Services; using SWS.CAD.ViewModels.myViewModelBase; -using SWS.CAD.Views.CustomControl; -using SWS.CAD.Models; -using System.Runtime.Remoting; -using Bricscad.Ifc; using Prism.Ioc; using SWS.CAD.Views.Dialog; using Prism.Events; using Unity; using SWS.CAD.Event; +using Prism.Services.Dialogs; +using SWS.Commons; +using SWS.Model; namespace SWS.CAD.ViewModels { @@ -60,7 +53,9 @@ namespace SWS.CAD.ViewModels eventAggregator.GetEvent().Subscribe(SelectChannelInfos, ThreadOption.UIThread, true); } - public DialogCloseListener RequestClose { get; } + public string Title => ""; + + public event Action RequestClose; public bool CanCloseDialog() { return true; @@ -109,9 +104,9 @@ namespace SWS.CAD.ViewModels } } - Prism.Dialogs.DialogParameters res = new Prism.Dialogs.DialogParameters(); + IDialogParameters res = new DialogParameters(); res.Add(GlobalObject.dialogPar.para1.ToString(), listPro); - RequestClose.Invoke(res, ButtonResult.Yes); + RequestClose.Invoke(new DialogResult(ButtonResult.Yes, res)); } public override void ExecuteCloseCommand(object parameter) { @@ -125,11 +120,12 @@ namespace SWS.CAD.ViewModels //} if (parameter as string == "ClickNo") { - RequestClose.Invoke(ButtonResult.No); + DialogResult res = new DialogResult(ButtonResult.No); + RequestClose.Invoke(res); } else { - RequestClose.Invoke(ButtonResult.Cancel); + RequestClose.Invoke(new DialogResult(ButtonResult.Cancel)); } this.Dispose(); } @@ -145,7 +141,7 @@ namespace SWS.CAD.ViewModels if (model.PropertyValue.Equals("新增电缆位号")) { //打开窗体 - Prism.Dialogs.DialogParameters para = new Prism.Dialogs.DialogParameters(); + IDialogParameters para = new DialogParameters(); para.Add(GlobalObject.dialogPar.info.ToString(), true); var _dialogService = GlobalObject._prismContainer.Resolve(); _dialogService.ShowDialog(nameof(DialogNewComponent), para, async (RES) => diff --git a/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogNewStripViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogNewStripViewModel.cs index b2198b75..62c6057f 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogNewStripViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/DialogIODistributionVM/DialogNewStripViewModel.cs @@ -2,19 +2,11 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Controls; -using System.Windows; -using Prism.Common; -using Prism.Dialogs; -using SWS.CAD.Services; using SWS.CAD.ViewModels.myViewModelBase; -using SWS.CAD.Views.CustomControl; -using SWS.CAD.Models; -using Bricscad.EditorInput; using System.Windows.Input; using Telerik.Windows.Controls; +using Prism.Services.Dialogs; +using SWS.Commons; namespace SWS.CAD.ViewModels { @@ -119,7 +111,9 @@ namespace SWS.CAD.ViewModels #endregion #endregion - public DialogCloseListener RequestClose { get; } + public string Title => ""; + + public event Action RequestClose; public bool CanCloseDialog() { return true; @@ -142,7 +136,7 @@ namespace SWS.CAD.ViewModels public override void ExecuteOKCommandAsync(object para) { - Prism.Dialogs.DialogParameters res = new Prism.Dialogs.DialogParameters(); + IDialogParameters res = new Prism.Services.Dialogs.DialogParameters(); if (IsReadOnly)//页面是公共的,为只读时是新增端子排的页面,传回去的事选中的项数据 { res.Add(GlobalObject.dialogPar.para1.ToString(), SelectedStripParametersInfo); @@ -152,17 +146,18 @@ namespace SWS.CAD.ViewModels res.Add(GlobalObject.dialogPar.para1.ToString(), StripParametersInfos.ToList()); } - RequestClose.Invoke(res, ButtonResult.Yes); + RequestClose.Invoke(new DialogResult(ButtonResult.Yes, res)); } public override void ExecuteCloseCommand(object parameter) { if (parameter as string == "ClickNo") { - RequestClose.Invoke(ButtonResult.No); + DialogResult res = new DialogResult(ButtonResult.No); + RequestClose.Invoke(res); } else { - RequestClose.Invoke(ButtonResult.Cancel); + RequestClose.Invoke(new DialogResult(ButtonResult.Cancel)); } this.Dispose(); } diff --git a/newFront/c#前端/SWS.CAD/ViewModels/DialogInputViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/DialogInputViewModel.cs index d07b46a5..b7c8786c 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/DialogInputViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/DialogInputViewModel.cs @@ -1,18 +1,7 @@ -using Prism.Dialogs; -using SWS.CAD.Models; -using SWS.CAD.Services; +using Prism.Services.Dialogs; using SWS.CAD.ViewModels.myViewModelBase; -using SWS.CAD.Views; +using SWS.Commons; using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using Telerik.Windows.Controls; -using Unity; namespace SWS.CAD.ViewModels { @@ -23,8 +12,9 @@ namespace SWS.CAD.ViewModels { } + public string Title => ""; - public DialogCloseListener RequestClose { get; } + public event Action RequestClose; public bool CanCloseDialog() { @@ -62,19 +52,22 @@ namespace SWS.CAD.ViewModels } public override void ExecuteOKCommandAsync(object para) { - Prism.Dialogs.DialogParameters res = new Prism.Dialogs.DialogParameters(); + IDialogParameters res = new Prism.Services.Dialogs.DialogParameters(); res.Add(GlobalObject.dialogPar.info.ToString(), $"{TextInfo}"); - RequestClose.Invoke(res,ButtonResult.Yes); + DialogResult result = new DialogResult(ButtonResult.Yes, res); + RequestClose.Invoke(result); } public override void ExecuteCloseCommand(object parameter) { if (parameter as string == "ClickNo") { - RequestClose.Invoke(ButtonResult.No); + DialogResult res = new DialogResult(ButtonResult.No); + RequestClose.Invoke(res); } else { - RequestClose.Invoke(ButtonResult.Cancel); + + RequestClose.Invoke(new DialogResult(ButtonResult.Cancel)); } this.Dispose(); } diff --git a/newFront/c#前端/SWS.CAD/ViewModels/DialogNewTagNumberViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/DialogNewTagNumberViewModel.cs index 0e23347b..6c4ef5d7 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/DialogNewTagNumberViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/DialogNewTagNumberViewModel.cs @@ -1,21 +1,12 @@ -using Prism.Dialogs; -using SWS.CAD.Models; -using SWS.CAD.Services; +using Prism.Services.Dialogs; using SWS.CAD.ViewModels.myViewModelBase; -using SWS.CAD.Views; -using SWS.CAD.Views.CustomControl; +using SWS.Commons; +using SWS.Service; using System; using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Globalization; using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows; -using Teigha.DatabaseServices; -using Telerik.Windows.Controls; using Unity; -using static Bricscad.Quad.QuadSelectionData; namespace SWS.CAD.ViewModels { @@ -30,7 +21,9 @@ namespace SWS.CAD.ViewModels _objectTypeService = GlobalObject.container.Resolve(); } - public DialogCloseListener RequestClose { get; } + public string Title => ""; + + public event Action RequestClose; public bool CanCloseDialog() { @@ -74,8 +67,8 @@ namespace SWS.CAD.ViewModels } string msg = string.Empty; - List listPro = new List(); - ec_enginedata item = new ec_enginedata(); + List listPro = new List(); + SWS.Model.ec_enginedata item = new SWS.Model.ec_enginedata(); item.TagNumber = TagNumber; item.ObjectTypeID = objectTypeId; var res = await _objectTypeService.GetObjectTypePById(objectTypeId);//添加属性 @@ -83,7 +76,7 @@ namespace SWS.CAD.ViewModels { foreach (var dto in res) { - listPro.Add(new ec_enginedata_property() + listPro.Add(new SWS.Model.ec_enginedata_property() { EngineDataPropertyID = dto.PropertyID, PropertyName = dto.PropertyName, @@ -105,19 +98,20 @@ namespace SWS.CAD.ViewModels else { MessageBox.Show("新建位号成功!" ); } #endregion - Prism.Dialogs.DialogParameters resPara = new Prism.Dialogs.DialogParameters(); + IDialogParameters resPara = new Prism.Services.Dialogs.DialogParameters(); resPara.Add(GlobalObject.dialogPar.info.ToString(), TagNumber); - RequestClose.Invoke(resPara, ButtonResult.Yes); + RequestClose.Invoke(new DialogResult(ButtonResult.Yes, resPara)); } public override void ExecuteCloseCommand(object parameter) { if (parameter as string == "ClickNo") { - RequestClose.Invoke(ButtonResult.No); + DialogResult res = new DialogResult(ButtonResult.No); + RequestClose.Invoke(res); } else { - RequestClose.Invoke(ButtonResult.Cancel); + RequestClose.Invoke(new DialogResult(ButtonResult.Cancel)); } this.Dispose(); } diff --git a/newFront/c#前端/SWS.CAD/ViewModels/DialogOperateRecordViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/DialogOperateRecordViewModel.cs index 37b7b9a0..a301f408 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/DialogOperateRecordViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/DialogOperateRecordViewModel.cs @@ -1,13 +1,11 @@ -using System.Collections.ObjectModel; -using System.IO; -using System.Windows.Forms; -using Prism.Dialogs; -using SWS.CAD.Models; -using SWS.CAD.Services; +using System; +using System.Collections.ObjectModel; +using Prism.Services.Dialogs; using SWS.CAD.ViewModels.myViewModelBase; +using SWS.Commons; +using SWS.Model; +using SWS.Service; using Unity; -using DialogResult = System.Windows.Forms.DialogResult; -using MessageBox = System.Windows.Forms.MessageBox; namespace SWS.CAD.ViewModels { @@ -19,7 +17,9 @@ namespace SWS.CAD.ViewModels _drawingService = GlobalObject.container.Resolve(); } - public DialogCloseListener RequestClose { get; } + public string Title => ""; + + public event Action RequestClose; public bool CanCloseDialog() { @@ -63,11 +63,12 @@ namespace SWS.CAD.ViewModels { if (parameter as string == "ClickNo") { - RequestClose.Invoke(ButtonResult.No); + DialogResult res = new DialogResult(ButtonResult.No); + RequestClose.Invoke(res); } else { - RequestClose.Invoke(ButtonResult.Cancel); + RequestClose.Invoke(new DialogResult(ButtonResult.Cancel)); } this.Dispose(); } diff --git a/newFront/c#前端/SWS.CAD/ViewModels/DialogParallelCableViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/DialogParallelCableViewModel.cs index c0b15df7..65c776c9 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/DialogParallelCableViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/DialogParallelCableViewModel.cs @@ -1,26 +1,18 @@ using Prism.Commands; -using Prism.Dialogs; using Prism.Events; using Prism.Ioc; -using SWS.CAD.CADFunc; +using Prism.Services.Dialogs; using SWS.CAD.Event; -using SWS.CAD.Models; -using SWS.CAD.Services; -using SWS.CAD.ViewModels.myViewModelBase; -using SWS.CAD.Views; -using SWS.CAD.Views.CustomControl; +using SWS.Commons; +using SWS.Model; +using SWS.Service; +using SWS.WPF.ViewModels; using System; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.Globalization; using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows; using System.Windows.Input; -using Teigha.DatabaseServices; -using Teigha.GraphicsInterface; -using Telerik.Windows.Controls; using Unity; using DelegateCommand = Prism.Commands.DelegateCommand; @@ -130,7 +122,9 @@ namespace SWS.CAD.ViewModels } #region dialog - public DialogCloseListener RequestClose { get; } + public string Title => ""; + + public event Action RequestClose; public bool CanCloseDialog() { @@ -185,7 +179,7 @@ namespace SWS.CAD.ViewModels proModel2.PropertyValue = strValue2; eventAggregator.GetEvent().Publish(proModel1); eventAggregator.GetEvent().Publish(proModel2); - RequestClose.Invoke(ButtonResult.Yes); + DialogResult res = new DialogResult(ButtonResult.Yes); } #endregion @@ -195,11 +189,12 @@ namespace SWS.CAD.ViewModels { if (parameter as string == "ClickNo") { - RequestClose.Invoke(ButtonResult.No); + DialogResult res = new DialogResult(ButtonResult.No); + RequestClose.Invoke(res); } else { - RequestClose.Invoke(ButtonResult.Cancel); + RequestClose.Invoke(new DialogResult(ButtonResult.Cancel)); } this.Dispose(); } diff --git a/newFront/c#前端/SWS.CAD/ViewModels/DialogPreCheckInViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/DialogPreCheckInViewModel.cs index 3e5c91f6..10649ab9 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/DialogPreCheckInViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/DialogPreCheckInViewModel.cs @@ -1,22 +1,12 @@ -using Prism.Dialogs; -using Prism.Events; +using Prism.Events; +using Prism.Services.Dialogs; using SWS.CAD.Event; -using SWS.CAD.Models; -using SWS.CAD.Services; using SWS.CAD.ViewModels.myViewModelBase; -using SWS.CAD.Views; -using SWS.CAD.Views.CustomControl; +using SWS.Commons; +using SWS.Model; using System; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Markup; -using Teigha.DatabaseServices; -using Telerik.Windows.Controls; using Unity; using static Bricscad.Quad.QuadSelectionData; @@ -46,7 +36,9 @@ namespace SWS.CAD.ViewModels eventAggregator.GetEvent().Subscribe(CheckInResult, ThreadOption.UIThread, true); } - public DialogCloseListener RequestClose { get; } + public string Title => ""; + + public event Action RequestClose; public bool CanCloseDialog() { @@ -164,20 +156,21 @@ namespace SWS.CAD.ViewModels { if (flag) { - Prism.Dialogs.DialogParameters resPara = new Prism.Dialogs.DialogParameters(); + IDialogParameters resPara = new Prism.Services.Dialogs.DialogParameters(); //resPara.Add(GlobalObject.dialogPar.info.ToString(), TagNumber); - RequestClose.Invoke(resPara, ButtonResult.Yes); + RequestClose.Invoke(new DialogResult(ButtonResult.Yes, resPara)); } } public override void ExecuteCloseCommand(object parameter) { if (parameter as string == "ClickNo") { - RequestClose.Invoke(ButtonResult.No); + DialogResult res = new DialogResult(ButtonResult.No); + RequestClose.Invoke(res); } else { - RequestClose.Invoke(ButtonResult.Cancel); + RequestClose.Invoke(new DialogResult(ButtonResult.Cancel)); } this.Dispose(); } diff --git a/newFront/c#前端/SWS.CAD/ViewModels/DialogPropertyHistoryViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/DialogPropertyHistoryViewModel.cs index d695657e..f867c945 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/DialogPropertyHistoryViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/DialogPropertyHistoryViewModel.cs @@ -1,12 +1,11 @@ -using System.Collections.ObjectModel; -using System.IO; -using System.Windows.Forms; -using Prism.Dialogs; -using SWS.CAD.Models; -using SWS.CAD.Services; +using System; +using System.Collections.ObjectModel; +using Prism.Services.Dialogs; using SWS.CAD.ViewModels.myViewModelBase; +using SWS.Commons; +using SWS.Model; +using SWS.Service; using Unity; -using DialogResult = System.Windows.Forms.DialogResult; using MessageBox = System.Windows.Forms.MessageBox; namespace SWS.CAD.ViewModels @@ -19,7 +18,9 @@ namespace SWS.CAD.ViewModels _objectTypeService = GlobalObject.container.Resolve(); } - public DialogCloseListener RequestClose { get; } + public string Title => ""; + + public event Action RequestClose; public bool CanCloseDialog() { @@ -57,11 +58,12 @@ namespace SWS.CAD.ViewModels { if (parameter as string == "ClickNo") { - RequestClose.Invoke(ButtonResult.No); + DialogResult res = new DialogResult(ButtonResult.No); + RequestClose.Invoke(res); } else { - RequestClose.Invoke(ButtonResult.Cancel); + RequestClose.Invoke(new DialogResult(ButtonResult.Cancel)); } this.Dispose(); } diff --git a/newFront/c#前端/SWS.CAD/ViewModels/DialogPublishRecordViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/DialogPublishRecordViewModel.cs index c579962e..596b8ccd 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/DialogPublishRecordViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/DialogPublishRecordViewModel.cs @@ -1,10 +1,12 @@ -using System.Collections.ObjectModel; +using System; +using System.Collections.ObjectModel; using System.IO; using System.Windows.Forms; -using Prism.Dialogs; -using SWS.CAD.Models; -using SWS.CAD.Services; +using Prism.Services.Dialogs; using SWS.CAD.ViewModels.myViewModelBase; +using SWS.Commons; +using SWS.Model; +using SWS.Service; using Unity; using DialogResult = System.Windows.Forms.DialogResult; using MessageBox = System.Windows.Forms.MessageBox; @@ -21,7 +23,9 @@ namespace SWS.CAD.ViewModels _annexesService = GlobalObject.container.Resolve(); } - public DialogCloseListener RequestClose { get; } + public string Title => ""; + + public event Action RequestClose; public bool CanCloseDialog() { @@ -92,11 +96,12 @@ namespace SWS.CAD.ViewModels { if (parameter as string == "ClickNo") { - RequestClose.Invoke(ButtonResult.No); + Prism.Services.Dialogs.DialogResult res = new Prism.Services.Dialogs.DialogResult(ButtonResult.No); + RequestClose.Invoke(res); } else { - RequestClose.Invoke(ButtonResult.Cancel); + RequestClose.Invoke(new Prism.Services.Dialogs.DialogResult(ButtonResult.Cancel)); } this.Dispose(); } diff --git a/newFront/c#前端/SWS.CAD/ViewModels/DialogSignalManagementViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/DialogSignalManagementViewModel.cs index 0af96131..bf6f9652 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/DialogSignalManagementViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/DialogSignalManagementViewModel.cs @@ -1,2006 +1,2010 @@ -using Prism.Dialogs; -using SWS.CAD.Models; -using SWS.CAD.Services; -using SWS.CAD.ViewModels.myViewModelBase; -using SWS.CAD.Views; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Threading.Tasks; -using System.Windows.Input; -using Telerik.Windows.Controls; -using Unity; -using System.Windows; -using static SWS.CAD.Services.WireGroupService; -using SWS.CAD.Views.SignalManagementViews; -using Prism.Ioc; -using Telerik.Windows.Data; -using System.Data; -using DryIoc; +//using SWS.CAD.Models; +//using SWS.CAD.Services; +//using SWS.CAD.ViewModels.myViewModelBase; +//using SWS.CAD.Views; +//using System; +//using System.Collections.Generic; +//using System.Collections.ObjectModel; +//using System.Linq; +//using System.Threading.Tasks; +//using System.Windows.Input; +//using Telerik.Windows.Controls; +//using Unity; +//using System.Windows; +//using static SWS.CAD.Services.WireGroupService; +//using SWS.CAD.Views.SignalManagementViews; +//using Prism.Ioc; +//using Telerik.Windows.Data; +//using System.Data; +//using DryIoc; +//using Prism.Services.Dialogs; +//using SWS.Commons; -namespace SWS.CAD.ViewModels -{ - public class DialogSignalManagementViewModel : DialogBase, IDialogAware - { - #region 属性 +//namespace SWS.CAD.ViewModels +//{ +// public class DialogSignalManagementViewModel : DialogBase, IDialogAware +// { +// #region 属性 - private ObservableCollection _smInfos = new ObservableCollection(); - /// - /// 表格数据源 - /// - public ObservableCollection smInfos - { - get { return _smInfos; } - set - { - _smInfos = value; - RaisePropertyChanged(nameof(smInfos)); - } - } +// private ObservableCollection _smInfos = new ObservableCollection(); +// /// +// /// 表格数据源 +// /// +// public ObservableCollection smInfos +// { +// get { return _smInfos; } +// set +// { +// _smInfos = value; +// RaisePropertyChanged(nameof(smInfos)); +// } +// } - private QueryableCollectionView _smInfosView; - /// - /// 可筛选的的集合视图 - /// - public QueryableCollectionView smInfosView - { - get { return _smInfosView; } - set { _smInfosView = value; RaisePropertyChanged(nameof(smInfosView)); } - } +// private QueryableCollectionView _smInfosView; +// /// +// /// 可筛选的的集合视图 +// /// +// public QueryableCollectionView smInfosView +// { +// get { return _smInfosView; } +// set { _smInfosView = value; RaisePropertyChanged(nameof(smInfosView)); } +// } - private SignalManagementInfo _SelectedSmInfo; - /// - /// 选中行 - /// - public SignalManagementInfo SelectedSmInfo - { - get { return _SelectedSmInfo; } - set { _SelectedSmInfo = value; RaisePropertyChanged(nameof(SelectedSmInfo)); } - } +// private SignalManagementInfo _SelectedSmInfo; +// /// +// /// 选中行 +// /// +// public SignalManagementInfo SelectedSmInfo +// { +// get { return _SelectedSmInfo; } +// set { _SelectedSmInfo = value; RaisePropertyChanged(nameof(SelectedSmInfo)); } +// } - /// - /// 信号接口服务 - /// - WireGroupService _wireGroupService; +// /// +// /// 信号接口服务 +// /// +// WireGroupService _wireGroupService; - private string _count; - /// - /// 表格数据数量 - /// - public string count - { - get { return _count; } - set { _count = value; RaisePropertyChanged(nameof(count)); } - } +// private string _count; +// /// +// /// 表格数据数量 +// /// +// public string count +// { +// get { return _count; } +// set { _count = value; RaisePropertyChanged(nameof(count)); } +// } - private string _pojectName; - /// - /// 表格名 - /// - public string pojectName - { - get { return _pojectName; } - set { _pojectName = value; RaisePropertyChanged(nameof(pojectName)); } - } +// private string _pojectName; +// /// +// /// 表格名 +// /// +// public string pojectName +// { +// get { return _pojectName; } +// set { _pojectName = value; RaisePropertyChanged(nameof(pojectName)); } +// } - public DialogSignalNotice SignalNoticeView { get; set; } +// public DialogSignalNotice SignalNoticeView { get; set; } - private string _ButtonContent = "回收站"; - /// - /// 回收站按钮文本 - /// - public string ButtonContent - { - get { return _ButtonContent; } - set { _ButtonContent = value; RaisePropertyChanged(nameof(ButtonContent)); } - } +// private string _ButtonContent = "回收站"; +// /// +// /// 回收站按钮文本 +// /// +// public string ButtonContent +// { +// get { return _ButtonContent; } +// set { _ButtonContent = value; RaisePropertyChanged(nameof(ButtonContent)); } +// } - private string _SearchText; - /// - /// 搜索框文本 - /// - public string SearchText - { - get { return _SearchText; } - set { _SearchText = value; RaisePropertyChanged(nameof(SearchText)); } - } +// private string _SearchText; +// /// +// /// 搜索框文本 +// /// +// public string SearchText +// { +// get { return _SearchText; } +// set { _SearchText = value; RaisePropertyChanged(nameof(SearchText)); } +// } - private System.Windows.Visibility _IsButtonVisibility = Visibility.Hidden; - /// - /// 控制关联母线按钮显示隐藏 - /// - public System.Windows.Visibility IsButtonVisibility - { - get { return _IsButtonVisibility; } - set - { - _IsButtonVisibility = value; - RaisePropertyChanged(nameof(IsButtonVisibility)); - } - } - private Visibility _IsChannelButtonVisibility = Visibility.Hidden; - /// - /// 控制关联通道按钮显示隐藏 - /// - public Visibility IsChannelButtonVisibility - { - get { return _IsChannelButtonVisibility; } - set - { - _IsChannelButtonVisibility = value; - RaisePropertyChanged(nameof(IsChannelButtonVisibility)); - } - } +// private System.Windows.Visibility _IsButtonVisibility = Visibility.Hidden; +// /// +// /// 控制关联母线按钮显示隐藏 +// /// +// public System.Windows.Visibility IsButtonVisibility +// { +// get { return _IsButtonVisibility; } +// set +// { +// _IsButtonVisibility = value; +// RaisePropertyChanged(nameof(IsButtonVisibility)); +// } +// } +// private Visibility _IsChannelButtonVisibility = Visibility.Hidden; +// /// +// /// 控制关联通道按钮显示隐藏 +// /// +// public Visibility IsChannelButtonVisibility +// { +// get { return _IsChannelButtonVisibility; } +// set +// { +// _IsChannelButtonVisibility = value; +// RaisePropertyChanged(nameof(IsChannelButtonVisibility)); +// } +// } - private ec_Wire_Group _IsAssociated; - /// - /// 通道是否关联信号 - /// - public ec_Wire_Group IsAssociated - { - get { return _IsAssociated; } - set - { - _IsAssociated = value; - RaisePropertyChanged(nameof(IsAssociated)); - } - } +// private ec_Wire_Group _IsAssociated; +// /// +// /// 通道是否关联信号 +// /// +// public ec_Wire_Group IsAssociated +// { +// get { return _IsAssociated; } +// set +// { +// _IsAssociated = value; +// RaisePropertyChanged(nameof(IsAssociated)); +// } +// } - #region 下拉列表 - private List _GroupOthers; - /// - /// 绑定组别列表 - /// - public List GroupOthers - { - get { return _GroupOthers; } - set { _GroupOthers = value; RaisePropertyChanged(nameof(GroupOthers)); } - } +// #region 下拉列表 +// private List _GroupOthers; +// /// +// /// 绑定组别列表 +// /// +// public List GroupOthers +// { +// get { return _GroupOthers; } +// set { _GroupOthers = value; RaisePropertyChanged(nameof(GroupOthers)); } +// } - private List _BelongingMajors = new List { "E", "M" }; - /// - /// 绑定归属专业 - /// - public List BelongingMajors - { - get { return _BelongingMajors; } - set { _BelongingMajors = value; RaisePropertyChanged(nameof(BelongingMajors)); } - } +// private List _BelongingMajors = new List { "E", "M" }; +// /// +// /// 绑定归属专业 +// /// +// public List BelongingMajors +// { +// get { return _BelongingMajors; } +// set { _BelongingMajors = value; RaisePropertyChanged(nameof(BelongingMajors)); } +// } - private List _InOrOuts = new List { "input", "output" }; - /// - /// 绑定IO类型 - /// - public List InOrOuts - { - get { return _InOrOuts; } - set { _InOrOuts = value; RaisePropertyChanged(nameof(InOrOuts)); } - } +// private List _InOrOuts = new List { "input", "output" }; +// /// +// /// 绑定IO类型 +// /// +// public List InOrOuts +// { +// get { return _InOrOuts; } +// set { _InOrOuts = value; RaisePropertyChanged(nameof(InOrOuts)); } +// } - private List _IO_Types = new List { "ON/OFF", "NO", "NC", "4-20mA", "PT100", "Pulse", "N/A" }; - /// - /// 绑定信号类型 - /// - public List IO_Types - { - get { return _IO_Types; } - set { _IO_Types = value; RaisePropertyChanged(nameof(IO_Types)); } - } +// private List _IO_Types = new List { "ON/OFF", "NO", "NC", "4-20mA", "PT100", "Pulse", "N/A" }; +// /// +// /// 绑定信号类型 +// /// +// public List IO_Types +// { +// get { return _IO_Types; } +// set { _IO_Types = value; RaisePropertyChanged(nameof(IO_Types)); } +// } - private List _AL_GRPs; - /// - /// 绑定AL_GRP - /// - public List AL_GRPs - { - get { return _AL_GRPs; } - set { _AL_GRPs = value; RaisePropertyChanged(nameof(AL_GRPs)); } - } - private List _BL_GRPs; - /// - /// 绑定BL_GRP - /// - public List BL_GRPs - { - get { return _BL_GRPs; } - set { _BL_GRPs = value; RaisePropertyChanged(nameof(BL_GRPs)); } - } +// private List _AL_GRPs; +// /// +// /// 绑定AL_GRP +// /// +// public List AL_GRPs +// { +// get { return _AL_GRPs; } +// set { _AL_GRPs = value; RaisePropertyChanged(nameof(AL_GRPs)); } +// } +// private List _BL_GRPs; +// /// +// /// 绑定BL_GRP +// /// +// public List BL_GRPs +// { +// get { return _BL_GRPs; } +// set { _BL_GRPs = value; RaisePropertyChanged(nameof(BL_GRPs)); } +// } - private List _Suppliers; - /// - /// 绑定供应商 - /// - public List Suppliers - { - get { return _Suppliers; } - set { _Suppliers = value; RaisePropertyChanged(nameof(Suppliers)); } - } +// private List _Suppliers; +// /// +// /// 绑定供应商 +// /// +// public List Suppliers +// { +// get { return _Suppliers; } +// set { _Suppliers = value; RaisePropertyChanged(nameof(Suppliers)); } +// } - private List _WHCPUs; - /// - /// 绑定WHCPU - /// - public List WHCPUs - { - get { return _WHCPUs; } - set - { - _WHCPUs = value; - ECRCPUs = value; - ShipOfficeCPUs = value; - RaisePropertyChanged(nameof(WHCPUs)); - } - } +// private List _WHCPUs; +// /// +// /// 绑定WHCPU +// /// +// public List WHCPUs +// { +// get { return _WHCPUs; } +// set +// { +// _WHCPUs = value; +// ECRCPUs = value; +// ShipOfficeCPUs = value; +// RaisePropertyChanged(nameof(WHCPUs)); +// } +// } - private List _ECRCPUs; - /// - /// 绑定ECRCPU - /// - public List ECRCPUs - { - get { return _ECRCPUs; } - set { _ECRCPUs = value; RaisePropertyChanged(nameof(ECRCPUs)); } - } +// private List _ECRCPUs; +// /// +// /// 绑定ECRCPU +// /// +// public List ECRCPUs +// { +// get { return _ECRCPUs; } +// set { _ECRCPUs = value; RaisePropertyChanged(nameof(ECRCPUs)); } +// } - private List _ShipOfficeCPUs; - /// - /// 绑定ShipOfficeCPU - /// - public List ShipOfficeCPUs - { - get { return _ShipOfficeCPUs; } - set { _ShipOfficeCPUs = value; RaisePropertyChanged(nameof(ShipOfficeCPUs)); } - } +// private List _ShipOfficeCPUs; +// /// +// /// 绑定ShipOfficeCPU +// /// +// public List ShipOfficeCPUs +// { +// get { return _ShipOfficeCPUs; } +// set { _ShipOfficeCPUs = value; RaisePropertyChanged(nameof(ShipOfficeCPUs)); } +// } - private WireGroups _Ent; - /// - /// 新增或修改的列表 - /// - public WireGroups Ent - { - get { return _Ent; } - set { _Ent = value; } - } +// private WireGroups _Ent; +// /// +// /// 新增或修改的列表 +// /// +// public WireGroups Ent +// { +// get { return _Ent; } +// set { _Ent = value; } +// } - #endregion +// #endregion - #endregion +// #endregion - public DialogSignalManagementViewModel() - { - title = "信号管理"; - _wireGroupService = GlobalObject.container.Resolve(); - var serv = GlobalObject.container.Resolve(); - GroupOthers = Task.Run(() => serv.GetDetails("be_Signal_Group")).Result; - Suppliers = Task.Run(() => serv.GetDetails("Maker")).Result; - WHCPUs = Task.Run(() => serv.GetDetails("Alarm")).Result; +// public DialogSignalManagementViewModel() +// { +// title = "信号管理"; +// _wireGroupService = GlobalObject.container.Resolve(); +// var serv = GlobalObject.container.Resolve(); +// GroupOthers = Task.Run(() => serv.GetDetails("be_Signal_Group")).Result; +// Suppliers = Task.Run(() => serv.GetDetails("Maker")).Result; +// WHCPUs = Task.Run(() => serv.GetDetails("Alarm")).Result; - Ent = new WireGroups(); - Ent.Signals = new List(); +// Ent = new WireGroups(); +// Ent.Signals = new List(); - } +// } - public DialogCloseListener RequestClose { get; } +// public string Title => ""; - public bool CanCloseDialog() - { - return true; - } +// public event Action RequestClose; - public void OnDialogClosed() - { +// public bool CanCloseDialog() +// { +// return true; +// } - } +// public void OnDialogClosed() +// { - private List signals; - public async void OnDialogOpened(IDialogParameters parameters) - { +// } - try - { - IsBusy = true; BusyContent = "加载中..."; - signals = await _wireGroupService.GetSignals(GlobalObject.curProject.ProjectId, false); - IsBusy = false; - count = signals.Count.ToString(); - signals = signals.Where(s => s.Status != WireGroupStatusEnum.deleted).ToList(); - SetBaseData(signals); - count = smInfos.Count.ToString() + "/" + count; - pojectName = GlobalObject.curProject.ProjectName + " | " + GlobalObject.curProject.ShipNameCN; - //关联母线按钮是否显示 - string FromWhichPage = parameters.GetValue(GlobalObject.dialogPar.para1.ToString()); - if (FromWhichPage!=null) - { - if (FromWhichPage.Equals("关联母线")) - { - IsButtonVisibility = Visibility.Visible; - } - if (FromWhichPage.Equals("关联通道")) - { - IsChannelButtonVisibility = Visibility.Visible; - } - } +// private List signals; +// public async void OnDialogOpened(IDialogParameters parameters) +// { + +// try +// { +// IsBusy = true; BusyContent = "加载中..."; +// signals = await _wireGroupService.GetSignals(GlobalObject.curProject.ProjectId, false); +// IsBusy = false; +// count = signals.Count.ToString(); +// signals = signals.Where(s => s.Status != SWS.Model.WireGroupStatusEnum.deleted).ToList(); +// SetBaseData(signals); +// count = smInfos.Count.ToString() + "/" + count; +// pojectName = GlobalObject.curProject.ProjectName + " | " + GlobalObject.curProject.ShipNameCN; +// //关联母线按钮是否显示 +// string FromWhichPage = parameters.GetValue(GlobalObject.dialogPar.para1.ToString()); +// if (FromWhichPage!=null) +// { +// if (FromWhichPage.Equals("关联母线")) +// { +// IsButtonVisibility = Visibility.Visible; +// } +// if (FromWhichPage.Equals("关联通道")) +// { +// IsChannelButtonVisibility = Visibility.Visible; +// } +// } - IsAssociated = parameters.GetValue(GlobalObject.dialogPar.info.ToString()); - } - catch (Exception) - { +// IsAssociated = parameters.GetValue(GlobalObject.dialogPar.info.ToString()); +// } +// catch (Exception) +// { - } +// } - } - public override void ExecuteOKCommandAsync(object para) - { - Prism.Dialogs.DialogParameters res = new Prism.Dialogs.DialogParameters(); - //res.Add(GlobalObject.dialogPar.info.ToString(), $"{TextInfo}"); - RequestClose.Invoke(res, ButtonResult.Yes); - } - public override void ExecuteCloseCommand(object parameter) - { - if (smInfos.Any(s => s.IsModified == true)) - { - MessageBoxResult resultMessage = MessageBox.Show("修改未保存,是否取消修改", "KunHengCAD", MessageBoxButton.OKCancel, MessageBoxImage.Question); - if (resultMessage != MessageBoxResult.OK) - { - return; - } - } - if (parameter as string == "ClickNo") - { - RequestClose.Invoke(ButtonResult.No); - } - else - { - RequestClose.Invoke(ButtonResult.Cancel); - } - this.Dispose(); - } +// } +// public override void ExecuteOKCommandAsync(object para) +// { +// IDialogParameters res = new Prism.Services.Dialogs.DialogParameters(); +// //res.Add(GlobalObject.dialogPar.info.ToString(), $"{TextInfo}"); +// RequestClose.Invoke(new DialogResult(ButtonResult.Yes, res)); +// } +// public override void ExecuteCloseCommand(object parameter) +// { +// if (smInfos.Any(s => s.IsModified == true)) +// { +// MessageBoxResult resultMessage = MessageBox.Show("修改未保存,是否取消修改", "KunHengCAD", MessageBoxButton.OKCancel, MessageBoxImage.Question); +// if (resultMessage != MessageBoxResult.OK) +// { +// return; +// } +// } +// if (parameter as string == "ClickNo") +// { +// DialogResult res = new DialogResult(ButtonResult.No); +// RequestClose.Invoke(res); +// } +// else +// { +// RequestClose.Invoke(new DialogResult(ButtonResult.Cancel)); +// } +// this.Dispose(); +// } - #region 页面按钮事件 - public ICommand StatusButtonCmd => new DelegateCommand(StatusButton_Click); - /// - /// 显示状态按钮 - /// - /// - public virtual async void StatusButton_Click(object parameter) - { - smInfos = new ObservableCollection(); - IsBusy = true; BusyContent = "查询中..."; - signals = await _wireGroupService.GetSignals(GlobalObject.curProject.ProjectId, false); - IsBusy = false; - count = signals.Count.ToString(); - signals = signals.Where(s => s.Status != WireGroupStatusEnum.deleted).ToList(); - if (!parameter.Equals("All")) - { - signals = signals.Where(s => s.Status.ToString().Equals(parameter)).ToList(); - SetBaseData(signals, 1); - } - else - { - SetBaseData(signals); - } - count = smInfos.Count.ToString() + "/" + count; - } +// #region 页面按钮事件 +// public ICommand StatusButtonCmd => new DelegateCommand(StatusButton_Click); +// /// +// /// 显示状态按钮 +// /// +// /// +// public virtual async void StatusButton_Click(object parameter) +// { +// smInfos = new ObservableCollection(); +// IsBusy = true; BusyContent = "查询中..."; +// signals = await _wireGroupService.GetSignals(GlobalObject.curProject.ProjectId, false); +// IsBusy = false; +// count = signals.Count.ToString(); +// signals = signals.Where(s => s.Status != SWS.Model.WireGroupStatusEnum.deleted).ToList(); +// if (!parameter.Equals("All")) +// { +// signals = signals.Where(s => s.Status.ToString().Equals(parameter)).ToList(); +// SetBaseData(signals, 1); +// } +// else +// { +// SetBaseData(signals); +// } +// count = smInfos.Count.ToString() + "/" + count; +// } - public ICommand ButtonCmd => new DelegateCommand(Button_Click); - /// - /// 页面右侧按钮 - /// - /// - public virtual async void Button_Click(object parameter) - { - if (!_smInfos.Any()) - { - return; - } - int index = _smInfos.IndexOf(_SelectedSmInfo);//当前选中项在源数据集合中的索引 - #region 新增信号按钮 - if (parameter.Equals("新增信号")) - { +// public ICommand ButtonCmd => new DelegateCommand(Button_Click); +// /// +// /// 页面右侧按钮 +// /// +// /// +// public virtual async void Button_Click(object parameter) +// { +// if (!_smInfos.Any()) +// { +// return; +// } +// int index = _smInfos.IndexOf(_SelectedSmInfo);//当前选中项在源数据集合中的索引 +// #region 新增信号按钮 +// if (parameter.Equals("新增信号")) +// { - if (index != -1 || SelectedSmInfo.type != "虚拟点") - { - var newEntity = new SignalManagementInfo(); - newEntity.BelongingMajor = "M"; - newEntity.type = "信号"; - newEntity.Status = "New"; - newEntity.GroupOthers = GroupOthers; - newEntity.Suppliers = Suppliers; - newEntity.IsModified = true; - //订阅事件以更新数据。 - newEntity.GroupOtherChanged += (sender, e) => UpdateParametersValue((SignalManagementInfo)sender); - // 添加新行到选中行下方 - _smInfos.Insert(index == -1 ? 0 : index + 1, newEntity); - //重新排序 - int i = 0; - foreach (var item in _smInfos) - { - i++; - item.serialNumber = i.ToString(); - foreach (var item2 in item.ChildSignals) - { - i++; - item2.serialNumber = i.ToString(); - } - } - SelectedSmInfo = newEntity; - } - else - { - // 显示消息框 - MessageBox.Show("请选择信号节点!", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); - return; - } +// if (index != -1 || SelectedSmInfo.type != "虚拟点") +// { +// var newEntity = new SignalManagementInfo(); +// newEntity.BelongingMajor = "M"; +// newEntity.type = "信号"; +// newEntity.Status = "New"; +// newEntity.GroupOthers = GroupOthers; +// newEntity.Suppliers = Suppliers; +// newEntity.IsModified = true; +// //订阅事件以更新数据。 +// newEntity.GroupOtherChanged += (sender, e) => UpdateParametersValue((SignalManagementInfo)sender); +// // 添加新行到选中行下方 +// _smInfos.Insert(index == -1 ? 0 : index + 1, newEntity); +// //重新排序 +// int i = 0; +// foreach (var item in _smInfos) +// { +// i++; +// item.serialNumber = i.ToString(); +// foreach (var item2 in item.ChildSignals) +// { +// i++; +// item2.serialNumber = i.ToString(); +// } +// } +// SelectedSmInfo = newEntity; +// } +// else +// { +// // 显示消息框 +// MessageBox.Show("请选择信号节点!", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); +// return; +// } - } - #endregion +// } +// #endregion - #region 新增虚拟点 - if (parameter.Equals("新增虚拟点")) - { - if (index == -1 || SelectedSmInfo.type.Equals("虚拟点")) - { - MessageBox.Show("请选择信号节点!", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); - return; - } - else - { - var newEntity = new SignalManagementInfo(); - newEntity.BelongingMajor = SelectedSmInfo.BelongingMajor; - newEntity.type = "虚拟点"; - newEntity.Status = "New"; - newEntity.ParentID = SelectedSmInfo.Wire_Group_ID; - newEntity.GroupOthers = GroupOthers; - newEntity.GroupOther = SelectedSmInfo.GroupOther; - newEntity.Suppliers = Suppliers; - newEntity.IsModified = true; - //订阅事件以更新数据。 - newEntity.ParametersChanged += (sender, e) => UpdateParametersValue((SignalManagementInfo)sender); - // 添加新行到选中行下方 - //smInfos.Insert(index + 1, newEntity); - SelectedSmInfo.ChildSignals.Add(newEntity); - //重新排序 - int i = 0; - foreach (var item in smInfos) - { - i++; - item.serialNumber = i.ToString(); - foreach (var item2 in item.ChildSignals) - { - i++; - item2.serialNumber = i.ToString(); - } - } - SelectedSmInfo = newEntity; - } - } - #endregion +// #region 新增虚拟点 +// if (parameter.Equals("新增虚拟点")) +// { +// if (index == -1 || SelectedSmInfo.type.Equals("虚拟点")) +// { +// MessageBox.Show("请选择信号节点!", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); +// return; +// } +// else +// { +// var newEntity = new SignalManagementInfo(); +// newEntity.BelongingMajor = SelectedSmInfo.BelongingMajor; +// newEntity.type = "虚拟点"; +// newEntity.Status = "New"; +// newEntity.ParentID = SelectedSmInfo.Wire_Group_ID; +// newEntity.GroupOthers = GroupOthers; +// newEntity.GroupOther = SelectedSmInfo.GroupOther; +// newEntity.Suppliers = Suppliers; +// newEntity.IsModified = true; +// //订阅事件以更新数据。 +// newEntity.ParametersChanged += (sender, e) => UpdateParametersValue((SignalManagementInfo)sender); +// // 添加新行到选中行下方 +// //smInfos.Insert(index + 1, newEntity); +// SelectedSmInfo.ChildSignals.Add(newEntity); +// //重新排序 +// int i = 0; +// foreach (var item in smInfos) +// { +// i++; +// item.serialNumber = i.ToString(); +// foreach (var item2 in item.ChildSignals) +// { +// i++; +// item2.serialNumber = i.ToString(); +// } +// } +// SelectedSmInfo = newEntity; +// } +// } +// #endregion - #region 信号转虚拟点 - if (parameter.Equals("信号转虚拟点")) - { - if (SelectedSmInfo != null) - { - if (SelectedSmInfo.type.Equals("信号")) - { - Prism.Dialogs.DialogParameters para = new Prism.Dialogs.DialogParameters(); - para.Add(GlobalObject.dialogPar.para1.ToString(), smInfos); - var _dialogService = GlobalObject._prismContainer.Resolve(); - _dialogService.ShowDialog(nameof(DialogSignalSelect), para, (RES) => - { +// #region 信号转虚拟点 +// if (parameter.Equals("信号转虚拟点")) +// { +// if (SelectedSmInfo != null) +// { +// if (SelectedSmInfo.type.Equals("信号")) +// { +// IDialogParameters para = new Prism.Services.Dialogs.DialogParameters(); +// para.Add(GlobalObject.dialogPar.para1.ToString(), smInfos); +// var _dialogService = GlobalObject._prismContainer.Resolve(); +// _dialogService.ShowDialog(nameof(DialogSignalSelect), para, (RES) => +// { - if (RES.Result == ButtonResult.Yes) - { - var signal = RES.Parameters.GetValue(GlobalObject.dialogPar.para1.ToString()); - SelectedSmInfo.ParentID = signal.SignalId; - SelectedSmInfo.type = "虚拟点"; - SelectedSmInfo.Group_Name = SelectedSmInfo.Group_Name + (string.IsNullOrEmpty(SelectedSmInfo.Code) ? "" : "_" + SelectedSmInfo.Code); - SelectedSmInfo.IsModified = true; - var tempSmInfo = SelectedSmInfo; - smInfos.Remove(SelectedSmInfo); +// if (RES.Result == ButtonResult.Yes) +// { +// var signal = RES.Parameters.GetValue(GlobalObject.dialogPar.para1.ToString()); +// SelectedSmInfo.ParentID = signal.SignalId; +// SelectedSmInfo.type = "虚拟点"; +// SelectedSmInfo.Group_Name = SelectedSmInfo.Group_Name + (string.IsNullOrEmpty(SelectedSmInfo.Code) ? "" : "_" + SelectedSmInfo.Code); +// SelectedSmInfo.IsModified = true; +// var tempSmInfo = SelectedSmInfo; +// smInfos.Remove(SelectedSmInfo); - //var signalindex = smInfos.IndexOf(smInfos.FirstOrDefault(s => s.Wire_Group_ID == signal.SignalId)) + 1; +// //var signalindex = smInfos.IndexOf(smInfos.FirstOrDefault(s => s.Wire_Group_ID == signal.SignalId)) + 1; - //smInfos.Insert(signalindex, tempSmInfo); +// //smInfos.Insert(signalindex, tempSmInfo); - smInfos.FirstOrDefault(s => s.Wire_Group_ID == signal.SignalId).ChildSignals.Add(tempSmInfo); +// smInfos.FirstOrDefault(s => s.Wire_Group_ID == signal.SignalId).ChildSignals.Add(tempSmInfo); - var i = 0; - foreach (var item in smInfos) - { - i++; - item.serialNumber = i.ToString(); - foreach (var item2 in item.ChildSignals) - { - i++; - item2.serialNumber = i.ToString(); - } - } +// var i = 0; +// foreach (var item in smInfos) +// { +// i++; +// item.serialNumber = i.ToString(); +// foreach (var item2 in item.ChildSignals) +// { +// i++; +// item2.serialNumber = i.ToString(); +// } +// } - SelectedSmInfo = tempSmInfo; - } - else if (RES.Result == ButtonResult.No) - { } - }); +// SelectedSmInfo = tempSmInfo; +// } +// else if (RES.Result == ButtonResult.No) +// { } +// }); - } - else if (SelectedSmInfo.type.Equals("虚拟点")) - { - var parentSmif = smInfos.FirstOrDefault(s => s.Wire_Group_ID == SelectedSmInfo.ParentID); - SelectedSmInfo.type = "信号"; - SelectedSmInfo.ParentID = ""; - //SelectedSmInfo.Code = ""; - SelectedSmInfo.Group_Name = SelectedSmInfo.Group_Name.Split('_')[0]; +// } +// else if (SelectedSmInfo.type.Equals("虚拟点")) +// { +// var parentSmif = smInfos.FirstOrDefault(s => s.Wire_Group_ID == SelectedSmInfo.ParentID); +// SelectedSmInfo.type = "信号"; +// SelectedSmInfo.ParentID = ""; +// //SelectedSmInfo.Code = ""; +// SelectedSmInfo.Group_Name = SelectedSmInfo.Group_Name.Split('_')[0]; - SelectedSmInfo.IsModified = true; +// SelectedSmInfo.IsModified = true; - var tempSmInfo = SelectedSmInfo; +// var tempSmInfo = SelectedSmInfo; - parentSmif.ChildSignals.Remove(SelectedSmInfo); - var signalindex = smInfos.IndexOf(parentSmif); - //signalindex = smInfos.IndexOf(smInfos.Skip(signalindex).Where(s => s.type.Equals("信号")).First()); - smInfos.Insert(signalindex + 1, tempSmInfo); +// parentSmif.ChildSignals.Remove(SelectedSmInfo); +// var signalindex = smInfos.IndexOf(parentSmif); +// //signalindex = smInfos.IndexOf(smInfos.Skip(signalindex).Where(s => s.type.Equals("信号")).First()); +// smInfos.Insert(signalindex + 1, tempSmInfo); - var i = 0; - foreach (var item in smInfos) - { - i++; - item.serialNumber = i.ToString(); - foreach (var item2 in item.ChildSignals) - { - i++; - item2.serialNumber = i.ToString(); - } - } +// var i = 0; +// foreach (var item in smInfos) +// { +// i++; +// item.serialNumber = i.ToString(); +// foreach (var item2 in item.ChildSignals) +// { +// i++; +// item2.serialNumber = i.ToString(); +// } +// } - SelectedSmInfo = tempSmInfo; - } - } - } - #endregion +// SelectedSmInfo = tempSmInfo; +// } +// } +// } +// #endregion - #region 删除 - if (parameter.Equals("删除")) - { - if (SelectedSmInfo != null) - { - //RadWindow.Alert("Start time: " + this.StartTime + "\nEnd time: " + this.EndTime); - // 显示消息框 - MessageBoxResult result = MessageBox.Show("确定准备删除选择的一行数据", "KunHengCAD", MessageBoxButton.OKCancel, MessageBoxImage.Question); - if (result == MessageBoxResult.OK) - { +// #region 删除 +// if (parameter.Equals("删除")) +// { +// if (SelectedSmInfo != null) +// { +// //RadWindow.Alert("Start time: " + this.StartTime + "\nEnd time: " + this.EndTime); +// // 显示消息框 +// MessageBoxResult result = MessageBox.Show("确定准备删除选择的一行数据", "KunHengCAD", MessageBoxButton.OKCancel, MessageBoxImage.Question); +// if (result == MessageBoxResult.OK) +// { - //id为空表示新增的未保存所以直接删除,不为空表示数据库已存在只修改状态 - if (string.IsNullOrEmpty(SelectedSmInfo.Wire_Group_ID)) - { - smInfos.Remove(SelectedSmInfo); - } - else - { +// //id为空表示新增的未保存所以直接删除,不为空表示数据库已存在只修改状态 +// if (string.IsNullOrEmpty(SelectedSmInfo.Wire_Group_ID)) +// { +// smInfos.Remove(SelectedSmInfo); +// } +// else +// { - Prism.Dialogs.DialogParameters x = new Prism.Dialogs.DialogParameters(); - x.Add(GlobalObject.dialogPar.title.ToString(), "提示"); - x.Add(GlobalObject.dialogPar.info.ToString(), "请输入删除的原因:"); - var _dialogService = GlobalObject._prismContainer.Resolve(); - _dialogService.ShowDialog(nameof(DialogInput), x, (RES) => - { - if (RES.Result == ButtonResult.Yes) - { - var Reason = RES.Parameters.GetValue(GlobalObject.dialogPar.info.ToString()); - if (string.IsNullOrEmpty(Reason)) - { - MessageBox.Show("您输入的信息为空!"); - } - else - { - List histories = new List() - { - new ActionHistory() - { - ActionTime= DateTime.Now, - ActionType = Models.Action.准备删除, - reason = Reason +// IDialogParameters x = new Prism.Services.Dialogs.DialogParameters(); +// x.Add(GlobalObject.dialogPar.title.ToString(), "提示"); +// x.Add(GlobalObject.dialogPar.info.ToString(), "请输入删除的原因:"); +// var _dialogService = GlobalObject._prismContainer.Resolve(); +// _dialogService.ShowDialog(nameof(DialogInput), x, (RES) => +// { +// if (RES.Result == ButtonResult.Yes) +// { +// var Reason = RES.Parameters.GetValue(GlobalObject.dialogPar.info.ToString()); +// if (string.IsNullOrEmpty(Reason)) +// { +// MessageBox.Show("您输入的信息为空!"); +// } +// else +// { +// List histories = new List() +// { +// new ActionHistory() +// { +// ActionTime= DateTime.Now, +// ActionType = Models.Action.准备删除, +// reason = Reason - } - }; - SelectedSmInfo.ActionHistorys = histories; - SelectedSmInfo.Status = "ToDelete"; - SelectedSmInfo.IsModified = true; - if (SelectedSmInfo.type.Equals("虚拟点")) - { - SelectedSmInfo.GroupOther = ""; - } - } - } - else if (RES.Result == ButtonResult.No) - { } - }); - } +// } +// }; +// SelectedSmInfo.ActionHistorys = histories; +// SelectedSmInfo.Status = "ToDelete"; +// SelectedSmInfo.IsModified = true; +// if (SelectedSmInfo.type.Equals("虚拟点")) +// { +// SelectedSmInfo.GroupOther = ""; +// } +// } +// } +// else if (RES.Result == ButtonResult.No) +// { } +// }); +// } - } +// } - } - else - { - // 显示消息框 - MessageBox.Show("请选择要准备删除的信号!", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); - } - } - #endregion +// } +// else +// { +// // 显示消息框 +// MessageBox.Show("请选择要准备删除的信号!", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); +// } +// } +// #endregion - #region 撤销删除 - if (parameter.Equals("撤销删除")) - { - if (SelectedSmInfo != null && SelectedSmInfo.Status == "ToDelete") - { - List histories = new List() - { - new ActionHistory() - { - ActionTime= DateTime.Now, - ActionType = Models.Action.撤销删除, +// #region 撤销删除 +// if (parameter.Equals("撤销删除")) +// { +// if (SelectedSmInfo != null && SelectedSmInfo.Status == "ToDelete") +// { +// List histories = new List() +// { +// new ActionHistory() +// { +// ActionTime= DateTime.Now, +// ActionType = Models.Action.撤销删除, - } - }; - SelectedSmInfo.ActionHistorys = histories; - SelectedSmInfo.Status = "New"; - SelectedSmInfo.IsModified = true; - } - else - { - MessageBox.Show("只有待删除的信号才能撤销删除"); - } +// } +// }; +// SelectedSmInfo.ActionHistorys = histories; +// SelectedSmInfo.Status = "New"; +// SelectedSmInfo.IsModified = true; +// } +// else +// { +// MessageBox.Show("只有待删除的信号才能撤销删除"); +// } - } - #endregion +// } +// #endregion - #region 彻底删除 - if (parameter.Equals("彻底删除")) - { - if (SelectedSmInfo != null) - { - List Signals = new List() - { - new ec_Wire_Group() - { - Group_Name = SelectedSmInfo.Group_Name, - Wire_Group_ID = SelectedSmInfo.Wire_Group_ID - } - }; - WireGroups ent = new WireGroups(); - ent.Signals = Signals; - string message = await _wireGroupService.CanSaveSignals(ent, Models.Action.删除); - if (message != "OK") - { - // 显示消息框 - MessageBox.Show(message, "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); - return; - } - else - { - List histories = new List() - { - new ActionHistory() - { - ActionTime= DateTime.Now, - ActionType = Models.Action.删除, - reason = "" +// #region 彻底删除 +// if (parameter.Equals("彻底删除")) +// { +// if (SelectedSmInfo != null) +// { +// List Signals = new List() +// { +// new ec_Wire_Group() +// { +// Group_Name = SelectedSmInfo.Group_Name, +// Wire_Group_ID = SelectedSmInfo.Wire_Group_ID +// } +// }; +// WireGroups ent = new WireGroups(); +// ent.Signals = Signals; +// string message = await _wireGroupService.CanSaveSignals(ent, Models.Action.删除); +// if (message != "OK") +// { +// // 显示消息框 +// MessageBox.Show(message, "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); +// return; +// } +// else +// { +// List histories = new List() +// { +// new ActionHistory() +// { +// ActionTime= DateTime.Now, +// ActionType = Models.Action.删除, +// reason = "" - } - }; - SelectedSmInfo.ActionHistorys = histories; - SelectedSmInfo.Status = "deleted"; - SelectedSmInfo.DeleteFlg = true; - SelectedSmInfo.IsModified = true; - SignalManagementInfo tempsmif = new SignalManagementInfo(); - tempsmif = SelectedSmInfo; - if (SelectedSmInfo.type.Equals("信号")) - { - smInfos.Remove(SelectedSmInfo); - smInfos.Add(tempsmif); - } - else - { - var parentSmif = smInfos.FirstOrDefault(s => s.Wire_Group_ID == SelectedSmInfo.ParentID); - parentSmif.ChildSignals.Remove(SelectedSmInfo); - smInfos.Add(tempsmif); - } +// } +// }; +// SelectedSmInfo.ActionHistorys = histories; +// SelectedSmInfo.Status = "deleted"; +// SelectedSmInfo.DeleteFlg = true; +// SelectedSmInfo.IsModified = true; +// SignalManagementInfo tempsmif = new SignalManagementInfo(); +// tempsmif = SelectedSmInfo; +// if (SelectedSmInfo.type.Equals("信号")) +// { +// smInfos.Remove(SelectedSmInfo); +// smInfos.Add(tempsmif); +// } +// else +// { +// var parentSmif = smInfos.FirstOrDefault(s => s.Wire_Group_ID == SelectedSmInfo.ParentID); +// parentSmif.ChildSignals.Remove(SelectedSmInfo); +// smInfos.Add(tempsmif); +// } - } - } +// } +// } - } - #endregion +// } +// #endregion - #region 还原信号 - if (parameter.Equals("还原信号")) - { - if (SelectedSmInfo != null) - { - Prism.Dialogs.DialogParameters x = new Prism.Dialogs.DialogParameters(); - x.Add(GlobalObject.dialogPar.title.ToString(), "提示"); - x.Add(GlobalObject.dialogPar.info.ToString(), "请输入还原信号的原因:"); - var _dialogService = GlobalObject._prismContainer.Resolve(); - _dialogService.ShowDialog(nameof(DialogInput), x, (RES) => - { - if (RES.Result == ButtonResult.Yes) - { - var Reason = RES.Parameters.GetValue(GlobalObject.dialogPar.info.ToString()); - if (string.IsNullOrEmpty(Reason)) - { - MessageBox.Show("您输入的信息为空!"); - } - else - { - List histories = new List() - { - new ActionHistory() - { - ActionTime= DateTime.Now, - ActionType = Models.Action.回收站恢复, - reason = Reason +// #region 还原信号 +// if (parameter.Equals("还原信号")) +// { +// if (SelectedSmInfo != null) +// { +// IDialogParameters x = new Prism.Services.Dialogs.DialogParameters(); +// x.Add(GlobalObject.dialogPar.title.ToString(), "提示"); +// x.Add(GlobalObject.dialogPar.info.ToString(), "请输入还原信号的原因:"); +// var _dialogService = GlobalObject._prismContainer.Resolve(); +// _dialogService.ShowDialog(nameof(DialogInput), x, (RES) => +// { +// if (RES.Result == ButtonResult.Yes) +// { +// var Reason = RES.Parameters.GetValue(GlobalObject.dialogPar.info.ToString()); +// if (string.IsNullOrEmpty(Reason)) +// { +// MessageBox.Show("您输入的信息为空!"); +// } +// else +// { +// List histories = new List() +// { +// new ActionHistory() +// { +// ActionTime= DateTime.Now, +// ActionType = Models.Action.回收站恢复, +// reason = Reason - } - }; - SelectedSmInfo.ActionHistorys = histories; - SelectedSmInfo.Status = "New"; - SelectedSmInfo.DeleteFlg = false; - SelectedSmInfo.IsModified = true; - SignalManagementInfo tempsmif = new SignalManagementInfo(); - tempsmif = SelectedSmInfo; - if (SelectedSmInfo.Equals("信号")) - { - smInfos.Remove(SelectedSmInfo); - smInfos.Add(tempsmif); - } - else - { - var parentSmif = smInfos.FirstOrDefault(s => s.Wire_Group_ID == SelectedSmInfo.ParentID); - parentSmif.ChildSignals.Remove(SelectedSmInfo); - smInfos.Add(tempsmif); - } +// } +// }; +// SelectedSmInfo.ActionHistorys = histories; +// SelectedSmInfo.Status = "New"; +// SelectedSmInfo.DeleteFlg = false; +// SelectedSmInfo.IsModified = true; +// SignalManagementInfo tempsmif = new SignalManagementInfo(); +// tempsmif = SelectedSmInfo; +// if (SelectedSmInfo.Equals("信号")) +// { +// smInfos.Remove(SelectedSmInfo); +// smInfos.Add(tempsmif); +// } +// else +// { +// var parentSmif = smInfos.FirstOrDefault(s => s.Wire_Group_ID == SelectedSmInfo.ParentID); +// parentSmif.ChildSignals.Remove(SelectedSmInfo); +// smInfos.Add(tempsmif); +// } - } - } - else if (RES.Result == ButtonResult.No) - { } - }); +// } +// } +// else if (RES.Result == ButtonResult.No) +// { } +// }); - } - } +// } +// } - #endregion +// #endregion - #region 审核 - if (parameter.Equals("审核")) - { - if (SelectedSmInfo != null) - { +// #region 审核 +// if (parameter.Equals("审核")) +// { +// if (SelectedSmInfo != null) +// { - List Signals = new List() - { - new ec_Wire_Group() - { - Group_Name = SelectedSmInfo.Group_Name, - Wire_Group_ID = SelectedSmInfo.Wire_Group_ID - } - }; - WireGroups ent = new WireGroups(); - ent.Signals = Signals; - string message = await _wireGroupService.CanSaveSignals(ent, Models.Action.审核); - if (message != "OK") - { - // 显示消息框 - MessageBox.Show(message, "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); - return; - } - else - { - List histories = new List() - { - new ActionHistory() - { - ActionTime= DateTime.Now, - ActionType = Models.Action.审核, - reason = "" +// List Signals = new List() +// { +// new ec_Wire_Group() +// { +// Group_Name = SelectedSmInfo.Group_Name, +// Wire_Group_ID = SelectedSmInfo.Wire_Group_ID +// } +// }; +// WireGroups ent = new WireGroups(); +// ent.Signals = Signals; +// string message = await _wireGroupService.CanSaveSignals(ent, Models.Action.审核); +// if (message != "OK") +// { +// // 显示消息框 +// MessageBox.Show(message, "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); +// return; +// } +// else +// { +// List histories = new List() +// { +// new ActionHistory() +// { +// ActionTime= DateTime.Now, +// ActionType = Models.Action.审核, +// reason = "" - } - }; - SelectedSmInfo.ActionHistorys = histories; - SelectedSmInfo.Status = "Confirmed"; - SelectedSmInfo.IsModified = true; - } - } - } - #endregion +// } +// }; +// SelectedSmInfo.ActionHistorys = histories; +// SelectedSmInfo.Status = "Confirmed"; +// SelectedSmInfo.IsModified = true; +// } +// } +// } +// #endregion - #region 重新打开 - if (parameter.Equals("重新打开")) - { - if (SelectedSmInfo != null) - { - var messageBoxResult = MessageBox.Show("确定重新打开选中的一行数据?", "KunHengCAD", MessageBoxButton.OKCancel, MessageBoxImage.Question); - if (messageBoxResult == MessageBoxResult.OK) - { - if (SelectedSmInfo.Status == "Confirmed") - { - Prism.Dialogs.DialogParameters x = new Prism.Dialogs.DialogParameters(); - x.Add(GlobalObject.dialogPar.title.ToString(), "提示"); - x.Add(GlobalObject.dialogPar.info.ToString(), "请输入重新打开改信号的原因:"); - var _dialogService = GlobalObject._prismContainer.Resolve(); - _dialogService.ShowDialog(nameof(DialogInput), x, (RES) => - { - if (RES.Result == ButtonResult.Yes) - { - var Reason = RES.Parameters.GetValue(GlobalObject.dialogPar.info.ToString()); - if (string.IsNullOrEmpty(Reason)) - { - MessageBox.Show("输入的信息不能为空!"); - } - else - { - List histories = new List() - { - new ActionHistory() - { - ActionTime= DateTime.Now, - ActionType = Models.Action.重新打开, - reason = Reason +// #region 重新打开 +// if (parameter.Equals("重新打开")) +// { +// if (SelectedSmInfo != null) +// { +// var messageBoxResult = MessageBox.Show("确定重新打开选中的一行数据?", "KunHengCAD", MessageBoxButton.OKCancel, MessageBoxImage.Question); +// if (messageBoxResult == MessageBoxResult.OK) +// { +// if (SelectedSmInfo.Status == "Confirmed") +// { +// IDialogParameters x = new Prism.Services.Dialogs.DialogParameters(); +// x.Add(GlobalObject.dialogPar.title.ToString(), "提示"); +// x.Add(GlobalObject.dialogPar.info.ToString(), "请输入重新打开改信号的原因:"); +// var _dialogService = GlobalObject._prismContainer.Resolve(); +// _dialogService.ShowDialog(nameof(DialogInput), x, (RES) => +// { +// if (RES.Result == ButtonResult.Yes) +// { +// var Reason = RES.Parameters.GetValue(GlobalObject.dialogPar.info.ToString()); +// if (string.IsNullOrEmpty(Reason)) +// { +// MessageBox.Show("输入的信息不能为空!"); +// } +// else +// { +// List histories = new List() +// { +// new ActionHistory() +// { +// ActionTime= DateTime.Now, +// ActionType = Models.Action.重新打开, +// reason = Reason - } - }; - SelectedSmInfo.ActionHistorys = histories; - SelectedSmInfo.Status = "Reopen"; - SelectedSmInfo.IsModified = true; - } - } - else if (RES.Result == ButtonResult.No) - { } - }); - } - else - { - // 显示消息框 - MessageBox.Show("只有已审核的信号才能重新打开", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); - return; - } - } - else - { - return; - } +// } +// }; +// SelectedSmInfo.ActionHistorys = histories; +// SelectedSmInfo.Status = "Reopen"; +// SelectedSmInfo.IsModified = true; +// } +// } +// else if (RES.Result == ButtonResult.No) +// { } +// }); +// } +// else +// { +// // 显示消息框 +// MessageBox.Show("只有已审核的信号才能重新打开", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); +// return; +// } +// } +// else +// { +// return; +// } - } - } - #endregion +// } +// } +// #endregion - #region 关联通道 - if (parameter.Equals("关联通道")) - { - if (SelectedSmInfo == null) - { - System.Windows.MessageBox.Show("您未选择关联信号", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return; - } - else - { - if (!SelectedSmInfo.Status.Equals("New") || SelectedSmInfo.Status.Equals("Reopen")) - { - System.Windows.MessageBox.Show("只有新增或重新打开的信号才能关联,请重新选择!", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return; - } - else - { - if (IsAssociated != null) - { - MessageBoxResult result = System.Windows.MessageBox.Show("已关联的信号:" + IsAssociated.Group_Name + "是否确认被覆盖?", "KunHengCAD", MessageBoxButton.OKCancel, MessageBoxImage.Warning); - if (result == MessageBoxResult.OK) - { - List WireGroups = new List(); - WireGroups.Add(SelectedSmInfo.to_ec_Wire_Group(signals)); - Prism.Dialogs.DialogParameters res = new Prism.Dialogs.DialogParameters(); - res.Add(GlobalObject.dialogPar.para1.ToString(), WireGroups); - RequestClose.Invoke(res, ButtonResult.Yes); - this.Dispose(); - } - else - { - return; - } - } +// #region 关联通道 +// if (parameter.Equals("关联通道")) +// { +// if (SelectedSmInfo == null) +// { +// System.Windows.MessageBox.Show("您未选择关联信号", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return; +// } +// else +// { +// if (!SelectedSmInfo.Status.Equals("New") || SelectedSmInfo.Status.Equals("Reopen")) +// { +// System.Windows.MessageBox.Show("只有新增或重新打开的信号才能关联,请重新选择!", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return; +// } +// else +// { +// if (IsAssociated != null) +// { +// MessageBoxResult result = System.Windows.MessageBox.Show("已关联的信号:" + IsAssociated.Group_Name + "是否确认被覆盖?", "KunHengCAD", MessageBoxButton.OKCancel, MessageBoxImage.Warning); +// if (result == MessageBoxResult.OK) +// { +// List WireGroups = new List(); +// WireGroups.Add(SelectedSmInfo.to_ec_Wire_Group(signals)); +// IDialogParameters res = new Prism.Services.Dialogs.DialogParameters(); +// res.Add(GlobalObject.dialogPar.para1.ToString(), WireGroups); +// RequestClose.Invoke(new DialogResult(ButtonResult.Yes, res)); +// this.Dispose(); +// } +// else +// { +// return; +// } +// } - } - } - } - #endregion - - #region 关联母线 - if (parameter.Equals("关联母线")) - { - if (SelectedSmInfo == null) - { - System.Windows.MessageBox.Show("您未选择关联信号", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return; - } - else - { - if (!SelectedSmInfo.CommunicationPoint) - { - System.Windows.MessageBox.Show("只有通讯信号才能关联,请重新选择!", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return; - } - else - { - List WireGroupIds = new List(); - WireGroupIds.Add(SelectedSmInfo); - Prism.Dialogs.DialogParameters res = new Prism.Dialogs.DialogParameters(); - res.Add(GlobalObject.dialogPar.para1.ToString(), WireGroupIds); - RequestClose.Invoke(res, ButtonResult.Yes); - this.Dispose(); - } - } - } - #endregion - } - - - - public ICommand HeadButtonCmd => new DelegateCommand(HeadButton_Click); - /// - /// 页面右侧按钮 - /// - /// - public virtual async void HeadButton_Click(object parameter) - { - #region 保存按钮 - if (parameter.Equals("保存")) - { - //新增或者修改的集合 - List updatals = new List(); - foreach (var item in smInfos) - { - if (item.IsModified) - { - updatals.Add(item); - } - foreach (var item2 in item.ChildSignals) - { - if (item2.IsModified) - { - updatals.Add(item2); - } - } - } - //updatals = smInfos.Where(s => s.IsModified == true).ToList(); - foreach (var item in updatals) - { - //保存的为信号时才判断组别 - if (item.type == "信号") - { - if (string.IsNullOrEmpty(item.GroupOther)) - { - // 显示消息框 - MessageBox.Show("组别不能为空", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); - return; - } - } - else if (item.type == "虚拟点") - { - if (string.IsNullOrEmpty(item.Code)) - { - MessageBox.Show("Code列不能为空", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); - return; - } - } - - Ent.Signals.Add(item.to_ec_Wire_Group(signals)); - } - //保存 - var data = await _wireGroupService.SaveSignals(Ent); - if (data != null && data.Count != 0) - { - - //foreach (var item in data) - //{ - - //} - smInfos = new ObservableCollection(); - IsBusy = true; BusyContent = "保存中..."; - signals = await _wireGroupService.GetSignals(GlobalObject.curProject.ProjectId, false); - IsBusy = false; - count = signals.Count.ToString(); - if (ButtonContent.Equals("回收站")) - { - signals = signals.Where(s => s.Status != WireGroupStatusEnum.deleted).ToList(); - } - else - { - signals = signals.Where(s => s.Status == WireGroupStatusEnum.deleted).ToList(); - } - - SetBaseData(signals); - count = smInfos.Count.ToString() + "/" + count; - Ent.Signals.Clear(); - // 显示消息框 - MessageBox.Show("保存成功", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Information); - } - else - { - - } - - } - #endregion - - #region 退出按钮 - if (parameter.Equals("退出")) - { - if (smInfos.Any(s => s.IsModified == true)) - { - MessageBoxResult resultMessage = MessageBox.Show("修改未保存,是否取消修改", "KunHengCAD", MessageBoxButton.OKCancel, MessageBoxImage.Question); - if (resultMessage != MessageBoxResult.OK) - { - return; - } - } - RequestClose.Invoke(ButtonResult.Cancel); - this.Dispose(); - } - #endregion - - #region 通知消息 - if (parameter.Equals("通知信息")) - { - - //RadWindow window = new RadWindow(); - - //window.Content = new DialogSignalNotice(); - //window.WindowStartupLocation = WindowStartupLocation.CenterOwner; - //window.Header = "通知消息"; - ////window.CanClose = false; - //window.Show(); - - //打开窗体 - Prism.Dialogs.DialogParameters para = new Prism.Dialogs.DialogParameters(); - var _dialogService = GlobalObject._prismContainer.Resolve(); - _dialogService.ShowDialog(nameof(DialogSignalNotice), para, (RES) => - { - if (RES.Result == ButtonResult.Yes) - { - - } - else if (RES.Result == ButtonResult.No) - { } - }); - - } - #endregion - - #region 历史记录 - if (parameter.Equals("历史记录")) - { - if (SelectedSmInfo != null) - { - //打开窗体 - Prism.Dialogs.DialogParameters para = new Prism.Dialogs.DialogParameters(); - para.Add(GlobalObject.dialogPar.para1.ToString(), SelectedSmInfo); - var _dialogService = GlobalObject._prismContainer.Resolve(); - _dialogService.ShowDialog(nameof(DialogSignalPropertyhisAndLogs), para, (RES) => - { - if (RES.Result == ButtonResult.Yes) - { - - } - else if (RES.Result == ButtonResult.No) - { } - }); - } - - } - #endregion - - #region 回收站 - if (parameter.Equals("回收站")) - { - switch (ButtonContent) - { - case "回收站": - ButtonContent = "显示全部"; - break; - case "显示全部": - ButtonContent = "回收站"; - break; - } - - - smInfos = new ObservableCollection(); - IsBusy = true; BusyContent = "查询中..."; - signals = await _wireGroupService.GetSignals(GlobalObject.curProject.ProjectId, false); - IsBusy = false; - count = signals.Count.ToString(); - if (ButtonContent.Equals("回收站")) - { - signals = signals.Where(s => s.Status != WireGroupStatusEnum.deleted).ToList(); - } - else - { - signals = signals.Where(s => s.Status == WireGroupStatusEnum.deleted).ToList(); - - } - SetBaseData(signals); - count = smInfos.Count.ToString() + "/" + count; - } - #endregion - - #region 搜索 - if (parameter.Equals("搜索框")) - { - PerformSearch(); - } - #endregion - - } - - public ICommand EditEndCmd => new DelegateCommand(EditEnd); - /// - /// 编辑结束事件 - /// - /// - public virtual void EditEnd(object parameter) - { - //做个标记表示该项修改过 - SelectedSmInfo.IsModified = true; - - } - - - - #endregion - - #region 方法 - /// - /// 设置数据 - /// 0是初始化数据,1是查询数据 - /// - public void SetBaseData(List signals, int model = 0) - { - - int index = 0; - foreach (var signal in signals) - { - if (model == 0) - { - if (string.IsNullOrEmpty(signal.ParentID)) - { - index++; - SignalManagementInfo info = new SignalManagementInfo(); - info.serialNumber = index.ToString(); - SetEntData(info, signal); - smInfos.Add(info); - foreach (var signal2 in signals) - { - if (signal.Wire_Group_ID.Equals(signal2.ParentID)) - { - index++; - SignalManagementInfo info2 = new SignalManagementInfo(); - - info2.serialNumber = index.ToString(); - SetEntData(info2, signal2); - info.ChildSignals.Add(info2); - info.ChildSignalsView = new QueryableCollectionView(info.ChildSignals); - info.IsExpandable = true; - } - } - } - } - else - { - index++; - SignalManagementInfo info = new SignalManagementInfo(); - info.serialNumber = index.ToString(); - SetEntData(info, signal); - smInfos.Add(info); - } - - } - smInfosView = new QueryableCollectionView(smInfos); - } - - public void SetEntData(SignalManagementInfo info, ec_Wire_Group signal) - { - info.Wire_Group_ID = signal.Wire_Group_ID; - info.ParentID = signal.ParentID; - info.Status = signal.Status.ToString(); - info.type = string.IsNullOrEmpty(signal.ParentID) ? "信号" : "虚拟点"; - info.Group_Name = signal.Group_Name; - info.Group_Desc_EN = signal.Group_Desc_EN; - info.Group_Desc = signal.Group_Desc; - info.BelongingMajor = signal.ElecOnly ? "E" : "M"; - - info.GroupOthers = GroupOthers; - info.GroupOther = GroupOthers.Where(g => g.DataItemCode == signal.Signal_Group).Select(g => g.DataItemName).FirstOrDefault(); - - info.Signal_SeqNo = signal.Signal_SeqNo; - info.Code = signal.Code; - info.InOrOut = signal.InOrOut; - info.IO_Type = signal.IO_Type; - info.Range_Min = signal.Range_Min; - info.Range_Max = signal.Range_Max; - info.Unit = signal.Unit; - info.Alarm_LL = signal.Alarm_LL; - info.Alarm_L = signal.Alarm_L; - info.Alarm_H = signal.Alarm_H; - info.Alarm_HH = signal.Alarm_HH; - info.SENSOR_CODE = signal.SENSOR_CODE; - info.CommunicationPoint = signal.CommunicationPoint; - info.SeriousType = signal.SeriousType; - info.AL_GRP = signal.AL_GRP; - info.BL_GRP = signal.BL_GRP; - info.Time_Delay = signal.Time_Delay; - info.Suppliers = Suppliers; - info.Supplier = Suppliers.Where(g => g.DataItemCode == signal.Supplier).Select(g => g.DataItemName).FirstOrDefault(); - info.EquipName = signal.EquipName; - info.VDR_Record = signal.VDR_Record; - info.WHConsole = signal.WHConsole; - //info.WHCPU = signal.WHCPU; - foreach (var item in signal.WHCPU.Split('|')) - { - info.WHCPUs.Add(WHCPUs.Where(e => e.DataItemCode.Equals(item.Trim())).FirstOrDefault()); - } - info.ECRConsole = signal.ECRConsole; - //info.ECRCPU = signal.ECRCPU; - foreach (var item in signal.ECRCPU.Split('|')) - { - info.ECRCPUs.Add(ECRCPUs.Where(e => e.DataItemCode.Equals(item.Trim())).FirstOrDefault()); - } - info.ShipOfficeConsole = signal.ShipOfficeConsole; - //info.ShipOfficeCPU = signal.ShipOfficeCPU; - foreach (var item in signal.ShipOfficeCPU.Split('|')) - { - info.ShipOfficeCPUs.Add(ShipOfficeCPUs.Where(e => e.DataItemCode.Equals(item.Trim())).FirstOrDefault()); - } - info.SLD = signal.SLD; - info.SHD = signal.SHD; - info.SafetyDelay = signal.SafetyDelay; - info.AutoCtrl = signal.AutoCtrl; - info.AssociatedCableInfo = (signal.CableName == "" || signal.CableName == null ? "" : "电缆位号:" + signal.CableName) + (signal.CableSetName == null ? "" : " 电缆对:" + signal.CableSetName); - info.AssociatedChannelInfo = (signal.PanelName == null ? "" : "采集箱:" + signal.PanelName) + (signal.StripName == null ? "" : "端子排:" + signal.StripName) + (signal.ChannelName == null ? "" : " 通道:" + signal.ChannelName); - info.Remarks = signal.Remarks; - info.DeleteFlg = signal.DeleteFlg; - //订阅事件以更新数据。 - info.ParametersChanged += (sender, e) => UpdateParametersValue((SignalManagementInfo)sender); - } - - - /// - /// 选择组别改变时修改Group_Name和Code() - /// - /// - private async void UpdateParametersValue(SignalManagementInfo item) - { - if (item.type == "信号") - { - //获取当前组别的可用编码 - string group = GroupOthers.Where(e => e.DataItemName.Equals(item.GroupOther)).Select(e => e.DataItemCode).FirstOrDefault(); - if (string.IsNullOrEmpty(item.Signal_SeqNo))//编码列为空时才通过接口获取可用编码 - { - var seq = await _wireGroupService.GetNextAvailableSeq(group); - int count = smInfos.Where(s => s.IsModified == true && string.IsNullOrEmpty(s.Wire_Group_ID)).ToList().Count; - if (count > 1) - { - seq = (double.Parse(seq) + count - 1).ToString(); - } - item.Signal_SeqNo = seq.ToString(); - } - item.Group_Name = group + item.Signal_SeqNo; - } - else if (item.type == "虚拟点") - { - if (string.IsNullOrEmpty(item.Group_Name)) - { - string Group_Name = smInfos.Where(e => e.Wire_Group_ID == item.ParentID).Select(e => e.Group_Name).FirstOrDefault(); - item.Group_Name = Group_Name + "_" + item.Code; - } - else - { - item.Group_Name = item.Group_Name.Split('_')[0] + "_" + item.Code; - } - - } - - - - } - /// - /// 搜索方法 - /// - private void PerformSearch() - { - smInfosView.FilterDescriptors.Clear(); - - if (!string.IsNullOrEmpty(SearchText)) - { - var compositeFilter = new CompositeFilterDescriptor - { - LogicalOperator = FilterCompositionLogicalOperator.Or - }; - - foreach (var prop in typeof(SignalManagementInfo).GetProperties()) - { - if (prop.PropertyType == typeof(string)) - { - compositeFilter.FilterDescriptors.Add(new FilterDescriptor - { - Member = prop.Name, - Operator = FilterOperator.Contains, - Value = SearchText.ToLower(), - IsCaseSensitive = false - }); - } - } - - smInfosView.FilterDescriptors.Add(compositeFilter); - } - - - } - - #endregion - - } - - - - public class SignalManagementInfo : DialogBase - { - public event EventHandler GroupOtherChanged; - public event EventHandler CodeChanged; - public event EventHandler ParametersChanged; - - #region 表格字段 - - private string _Wire_Group_ID; - /// - /// ID - /// - public string Wire_Group_ID - { - get { return _Wire_Group_ID; } - set { _Wire_Group_ID = value; RaisePropertyChanged(nameof(Wire_Group_ID)); } - } - - private string _ParentID; - /// - /// 如果有值表示其为虚拟点 - /// - public string ParentID - { - get { return _ParentID; } - set { _ParentID = value; } - } - - - private string _Status; - /// - /// 状态 - /// - public string Status - { - get { return _Status; } - set { _Status = value; RaisePropertyChanged(nameof(Status)); } - } - - private string _serialNumber; - /// - /// 序号 - /// - public string serialNumber - { - get { return _serialNumber; } - set { _serialNumber = value; RaisePropertyChanged(nameof(serialNumber)); } - } - private string _type; - /// - /// 类型 - /// - public string type - { - get { return _type; } - set { _type = value; RaisePropertyChanged(nameof(type)); } - } - private string _Group_Name; - /// - /// CH.NO - /// - public string Group_Name - { - get { return _Group_Name; } - set { _Group_Name = value; RaisePropertyChanged(nameof(Group_Name)); } - } - - - private string _Group_Desc_EN; - /// - /// 英文描述 - /// - public string Group_Desc_EN - { - get { return _Group_Desc_EN; } - set { _Group_Desc_EN = value; RaisePropertyChanged(nameof(Group_Desc_EN)); } - } - private string _Group_Desc; - /// - /// 中文描述 - /// - public string Group_Desc - { - get { return _Group_Desc; } - set { _Group_Desc = value; RaisePropertyChanged(nameof(Group_Desc)); } - } - private string _BelongingMajor; - /// - /// 归属专业 - /// - public string BelongingMajor - { - get { return _BelongingMajor; } - set { _BelongingMajor = value; RaisePropertyChanged(nameof(BelongingMajor)); } - } - - private string _GroupOther; - /// - /// 组别 - /// - public string GroupOther - { - get { return _GroupOther; } - set - { - _GroupOther = value; - RaisePropertyChanged(nameof(GroupOther)); - ParametersChanged?.Invoke(this, EventArgs.Empty); - } - } - private List _GroupOthers; - /// - /// 组别列表 - /// - public List GroupOthers - { - get { return _GroupOthers; } - set { _GroupOthers = value; RaisePropertyChanged(nameof(GroupOthers)); } - } - - private string _Signal_SeqNo; - /// - /// 编码 - /// - public string Signal_SeqNo - { - get { return _Signal_SeqNo; } - set { _Signal_SeqNo = value; RaisePropertyChanged(nameof(Signal_SeqNo)); } - } - private string _Code; - /// - /// Code - /// - public string Code - { - get { return _Code; } - set - { - _Code = value; - RaisePropertyChanged(nameof(Code)); - ParametersChanged?.Invoke(this, EventArgs.Empty); - } - } - private string _InOrOut; - /// - /// IO类型 - /// - public string InOrOut - { - get { return _InOrOut; } - set { _InOrOut = value; RaisePropertyChanged(nameof(InOrOut)); } - } - - private string _IO_Type; - /// - /// 信号类型 - /// - public string IO_Type - { - get { return _IO_Type; } - set { _IO_Type = value; RaisePropertyChanged(nameof(IO_Type)); } - } - private string _Range_Min; - /// - /// Range_Min - /// - public string Range_Min - { - get { return _Range_Min; } - set { _Range_Min = value; RaisePropertyChanged(nameof(Range_Min)); } - } - private string _Range_Max; - /// - /// Range_Max - /// - public string Range_Max - { - get { return _Range_Max; } - set { _Range_Max = value; RaisePropertyChanged(nameof(Range_Max)); } - } - private string _Unit; - /// - /// 单位 - /// - public string Unit - { - get { return _Unit; } - set { _Unit = value; RaisePropertyChanged(nameof(Unit)); } - } - private string _Alarm_LL; - - public string Alarm_LL - { - get { return _Alarm_LL; } - set { _Alarm_LL = value; RaisePropertyChanged(nameof(Alarm_LL)); } - } - private string _Alarm_L; - - public string Alarm_L - { - get { return _Alarm_L; } - set { _Alarm_L = value; RaisePropertyChanged(nameof(Alarm_L)); } - } - private string _Alarm_H; - - public string Alarm_H - { - get { return _Alarm_H; } - set { _Alarm_H = value; RaisePropertyChanged(nameof(Alarm_H)); } - } - private string _Alarm_HH; - - public string Alarm_HH - { - get { return _Alarm_HH; } - set { _Alarm_HH = value; RaisePropertyChanged(nameof(Alarm_HH)); } - } - private string _SENSOR_CODE; - - public string SENSOR_CODE - { - get { return _SENSOR_CODE; } - set { _SENSOR_CODE = value; RaisePropertyChanged(nameof(SENSOR_CODE)); } - } - private bool _CommunicationPoint; - /// - /// 是否是通讯点 - /// - public bool CommunicationPoint - { - get { return _CommunicationPoint; } - set { _CommunicationPoint = value; RaisePropertyChanged(nameof(CommunicationPoint)); } - } - private string _SeriousType; - - public string SeriousType - { - get { return _SeriousType; } - set { _SeriousType = value; RaisePropertyChanged(nameof(SeriousType)); } - } - private string _AL_GRP; - - public string AL_GRP - { - get { return _AL_GRP; } - set { _AL_GRP = value; RaisePropertyChanged(nameof(AL_GRP)); } - } - private string _BL_GRP; - - public string BL_GRP - { - get { return _BL_GRP; } - set { _BL_GRP = value; RaisePropertyChanged(nameof(BL_GRP)); } - } - private string _Time_Delay; - - public string Time_Delay - { - get { return _Time_Delay; } - set { _Time_Delay = value; RaisePropertyChanged(nameof(Time_Delay)); } - } - private string _Supplier; - /// - /// 供应商 - /// - public string Supplier - { - get { return _Supplier; } - set { _Supplier = value; RaisePropertyChanged(nameof(Supplier)); } - } - private string _EquipName; - /// - /// 设备名 - /// - public string EquipName - { - get { return _EquipName; } - set { _EquipName = value; RaisePropertyChanged(nameof(EquipName)); } - } - private bool _VDR_Record; - - public bool VDR_Record - { - get { return _VDR_Record; } - set { _VDR_Record = value; RaisePropertyChanged(nameof(VDR_Record)); } - } - private string _WHConsole; - - public string WHConsole - { - get { return _WHConsole; } - set { _WHConsole = value; RaisePropertyChanged(nameof(WHConsole)); } - } - private ObservableCollection _WHCPU = new ObservableCollection(); - - public ObservableCollection WHCPU - { - get { return _WHCPU; } - set - { - _WHCPU = value; - WHCPUs.AddRange(value); - RaisePropertyChanged(nameof(WHCPU)); - } - } - private ObservableCollection _WHCPUs = new ObservableCollection(); - public ObservableCollection WHCPUs - { - get { return _WHCPUs; } - set { _WHCPUs = value; OnPropertyChanged(nameof(WHCPUs)); } - } - - private string _ECRConsole; - - public string ECRConsole - { - get { return _ECRConsole; } - set { _ECRConsole = value; RaisePropertyChanged(nameof(ECRConsole)); } - } - private string _ECRCPU; - - public string ECRCPU - { - get { return _ECRCPU; } - set { _ECRCPU = value; RaisePropertyChanged(nameof(ECRCPU)); } - } - - private ObservableCollection _ECRCPUs = new ObservableCollection(); - public ObservableCollection ECRCPUs - { - get { return _ECRCPUs; } - set { _ECRCPUs = value; RaisePropertyChanged(nameof(ECRCPUs)); } - } - - private string _ShipOfficeConsole; - - public string ShipOfficeConsole - { - get { return _ShipOfficeConsole; } - set { _ShipOfficeConsole = value; RaisePropertyChanged(nameof(ShipOfficeConsole)); } - } - private string _ShipOfficeCPU; - - public string ShipOfficeCPU - { - get { return _ShipOfficeCPU; } - set { _ShipOfficeCPU = value; RaisePropertyChanged(nameof(ShipOfficeCPU)); } - } - - private ObservableCollection _ShipOfficeCPUs = new ObservableCollection(); - - public ObservableCollection ShipOfficeCPUs - { - get { return _ShipOfficeCPUs; } - set { _ShipOfficeCPUs = value; RaisePropertyChanged(nameof(ShipOfficeCPUs)); } - } - - private bool _SLD; - - public bool SLD - { - get { return _SLD; } - set { _SLD = value; RaisePropertyChanged(nameof(SLD)); } - } - private bool _SHD; - - public bool SHD - { - get { return _SHD; } - set { _SHD = value; RaisePropertyChanged(nameof(SHD)); } - } - private string _SafetyDelay; - /// - /// 安保延迟 - /// - public string SafetyDelay - { - get { return _SafetyDelay; } - set { _SafetyDelay = value; RaisePropertyChanged(nameof(SafetyDelay)); } - } - private string _AutoCtrl; - /// - /// 自动控制 - /// - public string AutoCtrl - { - get { return _AutoCtrl; } - set { _AutoCtrl = value; RaisePropertyChanged(nameof(AutoCtrl)); } - } - private string _AssociatedCableInfo; - /// - /// 关联电缆信息 - /// - public string AssociatedCableInfo - { - get { return _AssociatedCableInfo; } - set { _AssociatedCableInfo = value; RaisePropertyChanged(nameof(AssociatedCableInfo)); } - } - private string _AssociatedChannelInfo; - /// - /// 关联通道信息 - /// - public string AssociatedChannelInfo - { - get { return _AssociatedChannelInfo; } - set { _AssociatedChannelInfo = value; RaisePropertyChanged(nameof(AssociatedChannelInfo)); } - } - private string _Remarks; - /// - /// 备注 - /// - public string Remarks - { - get { return _Remarks; } - set { _Remarks = value; RaisePropertyChanged(nameof(Remarks)); } - } - private List _Suppliers; - /// - /// 绑定供应商 - /// - public List Suppliers - { - get { return _Suppliers; } - set { _Suppliers = value; RaisePropertyChanged(nameof(Suppliers)); } - } - - #region 扩展字段 - private bool _IsModified; - /// - /// 是否修改 - /// - public bool IsModified - { - get { return _IsModified; } - set { _IsModified = value; RaisePropertyChanged(nameof(IsModified)); } - } - - private bool _IsExpanded = false; - /// - /// 是否展开 - /// - public bool IsExpanded - { - get { return _IsExpanded; } - set { _IsExpanded = value; RaisePropertyChanged(nameof(IsExpanded)); } - } - - private bool _IsExpandable; - /// - /// 是否可展开 - /// - public bool IsExpandable - { - get { return _IsExpandable; } - set { _IsExpandable = value; RaisePropertyChanged(nameof(IsExpandable)); } - } - - private List _ActionHistorys; - /// - /// 操作历史 - /// - public List ActionHistorys - { - get { return _ActionHistorys; } - set { _ActionHistorys = value; } - } - - private bool _DeleteFlg; - /// - /// 删除标记 - /// - public bool DeleteFlg - { - get { return _DeleteFlg; } - set { _DeleteFlg = value; } - } - - private ObservableCollection _ChildSignals = new ObservableCollection(); - - public ObservableCollection ChildSignals - { - get { return _ChildSignals; } - set { _ChildSignals = value; RaisePropertyChanged(nameof(ChildSignals)); } - } - - private QueryableCollectionView _ChildSignalsView; - /// - /// 虚拟点集合视图 - /// - public QueryableCollectionView ChildSignalsView - { - get { return _ChildSignalsView; } - set { _ChildSignalsView = value; RaisePropertyChanged(nameof(ChildSignalsView)); } - } - #endregion - - - - #endregion - - #region 方法 - /// - /// 将表格对象转换为数据模型类 - /// - /// - public ec_Wire_Group to_ec_Wire_Group(List sigals) - { - ec_Wire_Group ent; - if (string.IsNullOrEmpty(Wire_Group_ID)) - { - ent = new ec_Wire_Group(); - } - else - { - ent = sigals.Where(e => e.Wire_Group_ID.Equals(Wire_Group_ID)).First(); - } - switch (Status) - { - case "ToDelete": - ent.Status = WireGroupStatusEnum.ToDelete; - break; - case "New": - ent.Status = WireGroupStatusEnum.New; - break; - case "Used": - ent.Status = WireGroupStatusEnum.Used; - break; - case "Confirmed": - ent.Status = WireGroupStatusEnum.Confirmed; - break; - case "Reopen": - ent.Status = WireGroupStatusEnum.Reopen; - break; - case "deleted": - ent.Status = WireGroupStatusEnum.deleted; - break; - } - - ent.Wire_Group_ID = Wire_Group_ID; - ent.ParentID = ParentID; - ent.Group_Name = Group_Name; - ent.Group_Desc_EN = Group_Desc_EN; - ent.Group_Desc = Group_Desc; - ent.ElecOnly = BelongingMajor.Equals("E") ? true : false; - if (GroupOther == null) - { - ent.Signal_Group = ""; - } - else - { - ent.Signal_Group = GroupOthers.Where(g => g.DataItemName == GroupOther).Select(g => g.DataItemCode).FirstOrDefault(); - - } - ent.Signal_SeqNo = Signal_SeqNo; - ent.Code = Code; - ent.InOrOut = InOrOut; - ent.IO_Type = IO_Type; - ent.Range_Min = Range_Min; - ent.Range_Max = Range_Max; - ent.Unit = Unit; - ent.Alarm_LL = Alarm_LL; - ent.Alarm_L = Alarm_L; - ent.Alarm_H = Alarm_H; - ent.Alarm_HH = Alarm_HH; - ent.SENSOR_CODE = SENSOR_CODE; - ent.CommunicationPoint = CommunicationPoint; - ent.SeriousType = SeriousType; - ent.AL_GRP = AL_GRP; - ent.BL_GRP = BL_GRP; - ent.Time_Delay = Time_Delay; - ent.Supplier = Suppliers.Where(g => g.DataItemName == Supplier).Select(g => g.DataItemCode).FirstOrDefault(); - ent.EquipName = EquipName; - ent.VDR_Record = VDR_Record; - ent.WHConsole = WHConsole; - ent.WHCPU = ""; - foreach (var item in WHCPUs) - { - if (item != null) - { - ent.WHCPU = ent.WHCPU + item.DataItemCode + "|"; - } - - } - ent.ECRConsole = ECRConsole; - ent.ECRCPU = ""; - foreach (var item in ECRCPUs) - { - if (item != null) - { - ent.ECRCPU = ent.ECRCPU + item.DataItemCode + "|"; - } - - } - ent.ShipOfficeConsole = ShipOfficeConsole; - ent.ShipOfficeCPU = ""; - foreach (var item in ShipOfficeCPUs) - { - if (item != null) - { - ent.ShipOfficeCPU = ent.ShipOfficeCPU + item.DataItemCode + "|"; - } - - } - ent.SLD = SLD; - ent.SHD = SHD; - ent.SafetyDelay = SafetyDelay; - ent.AutoCtrl = AutoCtrl; - if (string.IsNullOrEmpty(AssociatedCableInfo)) - { - //// 使用正则表达式匹配模式,并提取每组数据 - //var matches = Regex.Matches(AssociatedCableInfo, @"电缆位号:(.*?)\s电缆对:(.*)"); - // if (matches.Count > 0) // 确保至少有一个匹配项 - // { - // string cableNumber = matches[0].Groups[1].Value; // 第一个冒号后的值 - // string cableSet = matches[0].Groups[2].Value; // 第二个冒号后的值 - // } - ent.CableName = ""; - ent.CableSetName = ""; - } - else - { - ent.CableName = AssociatedCableInfo.Split(' ')[0].Split(':')[1]; - ent.CableSetName = (AssociatedCableInfo.Split(' ').Count() > 1) ? AssociatedCableInfo.Split(' ')[1].Split(':')[1] : ""; - } - if (string.IsNullOrEmpty(AssociatedChannelInfo)) - { - ent.PanelName = ""; - ent.StripName = ""; - ent.ChannelName = ""; - } - else - { - ent.PanelName = AssociatedChannelInfo.Split(' ')[0].Split(':')[1]; - ent.StripName = (AssociatedChannelInfo.Split(' ').Count() > 1) ? AssociatedChannelInfo.Split(' ')[1].Split(':')[1] : ""; - ent.ChannelName = (AssociatedChannelInfo.Split(' ').Count() > 2) ? AssociatedChannelInfo.Split(' ')[2].Split(':')[2] : ""; - } - ent.Remarks = Remarks; - ent.ActionHistorys = ActionHistorys; - ent.DeleteFlg = DeleteFlg; - - return ent; - } - #endregion - - } - -} +// } +// } +// } +// #endregion + +// #region 关联母线 +// if (parameter.Equals("关联母线")) +// { +// if (SelectedSmInfo == null) +// { +// System.Windows.MessageBox.Show("您未选择关联信号", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return; +// } +// else +// { +// if (!SelectedSmInfo.CommunicationPoint) +// { +// System.Windows.MessageBox.Show("只有通讯信号才能关联,请重新选择!", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return; +// } +// else +// { +// List WireGroupIds = new List(); +// WireGroupIds.Add(SelectedSmInfo); +// IDialogParameters res = new Prism.Services.Dialogs.DialogParameters(); +// res.Add(GlobalObject.dialogPar.para1.ToString(), WireGroupIds); +// RequestClose.Invoke(new DialogResult(ButtonResult.Yes, res)); +// this.Dispose(); +// } +// } +// } +// #endregion +// } + + + +// public ICommand HeadButtonCmd => new DelegateCommand(HeadButton_Click); +// /// +// /// 页面右侧按钮 +// /// +// /// +// public virtual async void HeadButton_Click(object parameter) +// { +// #region 保存按钮 +// if (parameter.Equals("保存")) +// { +// //新增或者修改的集合 +// List updatals = new List(); +// foreach (var item in smInfos) +// { +// if (item.IsModified) +// { +// updatals.Add(item); +// } +// foreach (var item2 in item.ChildSignals) +// { +// if (item2.IsModified) +// { +// updatals.Add(item2); +// } +// } +// } +// //updatals = smInfos.Where(s => s.IsModified == true).ToList(); +// foreach (var item in updatals) +// { +// //保存的为信号时才判断组别 +// if (item.type == "信号") +// { +// if (string.IsNullOrEmpty(item.GroupOther)) +// { +// // 显示消息框 +// MessageBox.Show("组别不能为空", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); +// return; +// } +// } +// else if (item.type == "虚拟点") +// { +// if (string.IsNullOrEmpty(item.Code)) +// { +// MessageBox.Show("Code列不能为空", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); +// return; +// } +// } + +// Ent.Signals.Add(item.to_ec_Wire_Group(signals)); +// } +// //保存 +// var data = await _wireGroupService.SaveSignals(Ent); +// if (data != null && data.Count != 0) +// { + +// //foreach (var item in data) +// //{ + +// //} +// smInfos = new ObservableCollection(); +// IsBusy = true; BusyContent = "保存中..."; +// signals = await _wireGroupService.GetSignals(GlobalObject.curProject.ProjectId, false); +// IsBusy = false; +// count = signals.Count.ToString(); +// if (ButtonContent.Equals("回收站")) +// { +// signals = signals.Where(s => s.Status != WireGroupStatusEnum.deleted).ToList(); +// } +// else +// { +// signals = signals.Where(s => s.Status == WireGroupStatusEnum.deleted).ToList(); +// } + +// SetBaseData(signals); +// count = smInfos.Count.ToString() + "/" + count; +// Ent.Signals.Clear(); +// // 显示消息框 +// MessageBox.Show("保存成功", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Information); +// } +// else +// { + +// } + +// } +// #endregion + +// #region 退出按钮 +// if (parameter.Equals("退出")) +// { +// if (smInfos.Any(s => s.IsModified == true)) +// { +// MessageBoxResult resultMessage = MessageBox.Show("修改未保存,是否取消修改", "KunHengCAD", MessageBoxButton.OKCancel, MessageBoxImage.Question); +// if (resultMessage != MessageBoxResult.OK) +// { +// return; +// } +// } +// RequestClose.Invoke(new DialogResult(ButtonResult.Cancel)); +// this.Dispose(); +// } +// #endregion + +// #region 通知消息 +// if (parameter.Equals("通知信息")) +// { + +// //RadWindow window = new RadWindow(); + +// //window.Content = new DialogSignalNotice(); +// //window.WindowStartupLocation = WindowStartupLocation.CenterOwner; +// //window.Header = "通知消息"; +// ////window.CanClose = false; +// //window.Show(); + +// //打开窗体 +// IDialogParameters para = new Prism.Services.Dialogs.DialogParameters(); +// var _dialogService = GlobalObject._prismContainer.Resolve(); +// _dialogService.ShowDialog(nameof(DialogSignalNotice), para, (RES) => +// { +// if (RES.Result == ButtonResult.Yes) +// { + +// } +// else if (RES.Result == ButtonResult.No) +// { } +// }); + +// } +// #endregion + +// #region 历史记录 +// if (parameter.Equals("历史记录")) +// { +// if (SelectedSmInfo != null) +// { +// //打开窗体 +// IDialogParameters para = new Prism.Services.Dialogs.DialogParameters(); +// para.Add(GlobalObject.dialogPar.para1.ToString(), SelectedSmInfo); +// var _dialogService = GlobalObject._prismContainer.Resolve(); +// _dialogService.ShowDialog(nameof(DialogSignalPropertyhisAndLogs), para, (RES) => +// { +// if (RES.Result == ButtonResult.Yes) +// { + +// } +// else if (RES.Result == ButtonResult.No) +// { } +// }); +// } + +// } +// #endregion + +// #region 回收站 +// if (parameter.Equals("回收站")) +// { +// switch (ButtonContent) +// { +// case "回收站": +// ButtonContent = "显示全部"; +// break; +// case "显示全部": +// ButtonContent = "回收站"; +// break; +// } + + +// smInfos = new ObservableCollection(); +// IsBusy = true; BusyContent = "查询中..."; +// signals = await _wireGroupService.GetSignals(GlobalObject.curProject.ProjectId, false); +// IsBusy = false; +// count = signals.Count.ToString(); +// if (ButtonContent.Equals("回收站")) +// { +// signals = signals.Where(s => s.Status != WireGroupStatusEnum.deleted).ToList(); +// } +// else +// { +// signals = signals.Where(s => s.Status == WireGroupStatusEnum.deleted).ToList(); + +// } +// SetBaseData(signals); +// count = smInfos.Count.ToString() + "/" + count; +// } +// #endregion + +// #region 搜索 +// if (parameter.Equals("搜索框")) +// { +// PerformSearch(); +// } +// #endregion + +// } + +// public ICommand EditEndCmd => new DelegateCommand(EditEnd); +// /// +// /// 编辑结束事件 +// /// +// /// +// public virtual void EditEnd(object parameter) +// { +// //做个标记表示该项修改过 +// SelectedSmInfo.IsModified = true; + +// } + + + +// #endregion + +// #region 方法 +// /// +// /// 设置数据 +// /// 0是初始化数据,1是查询数据 +// /// +// public void SetBaseData(List signals, int model = 0) +// { + +// int index = 0; +// foreach (var signal in signals) +// { +// if (model == 0) +// { +// if (string.IsNullOrEmpty(signal.ParentID)) +// { +// index++; +// SignalManagementInfo info = new SignalManagementInfo(); +// info.serialNumber = index.ToString(); +// SetEntData(info, signal); +// smInfos.Add(info); +// foreach (var signal2 in signals) +// { +// if (signal.Wire_Group_ID.Equals(signal2.ParentID)) +// { +// index++; +// SignalManagementInfo info2 = new SignalManagementInfo(); + +// info2.serialNumber = index.ToString(); +// SetEntData(info2, signal2); +// info.ChildSignals.Add(info2); +// info.ChildSignalsView = new QueryableCollectionView(info.ChildSignals); +// info.IsExpandable = true; +// } +// } +// } +// } +// else +// { +// index++; +// SignalManagementInfo info = new SignalManagementInfo(); +// info.serialNumber = index.ToString(); +// SetEntData(info, signal); +// smInfos.Add(info); +// } + +// } +// smInfosView = new QueryableCollectionView(smInfos); +// } + +// public void SetEntData(SignalManagementInfo info, ec_Wire_Group signal) +// { +// info.Wire_Group_ID = signal.Wire_Group_ID; +// info.ParentID = signal.ParentID; +// info.Status = signal.Status.ToString(); +// info.type = string.IsNullOrEmpty(signal.ParentID) ? "信号" : "虚拟点"; +// info.Group_Name = signal.Group_Name; +// info.Group_Desc_EN = signal.Group_Desc_EN; +// info.Group_Desc = signal.Group_Desc; +// info.BelongingMajor = signal.ElecOnly ? "E" : "M"; + +// info.GroupOthers = GroupOthers; +// info.GroupOther = GroupOthers.Where(g => g.DataItemCode == signal.Signal_Group).Select(g => g.DataItemName).FirstOrDefault(); + +// info.Signal_SeqNo = signal.Signal_SeqNo; +// info.Code = signal.Code; +// info.InOrOut = signal.InOrOut; +// info.IO_Type = signal.IO_Type; +// info.Range_Min = signal.Range_Min; +// info.Range_Max = signal.Range_Max; +// info.Unit = signal.Unit; +// info.Alarm_LL = signal.Alarm_LL; +// info.Alarm_L = signal.Alarm_L; +// info.Alarm_H = signal.Alarm_H; +// info.Alarm_HH = signal.Alarm_HH; +// info.SENSOR_CODE = signal.SENSOR_CODE; +// info.CommunicationPoint = signal.CommunicationPoint; +// info.SeriousType = signal.SeriousType; +// info.AL_GRP = signal.AL_GRP; +// info.BL_GRP = signal.BL_GRP; +// info.Time_Delay = signal.Time_Delay; +// info.Suppliers = Suppliers; +// info.Supplier = Suppliers.Where(g => g.DataItemCode == signal.Supplier).Select(g => g.DataItemName).FirstOrDefault(); +// info.EquipName = signal.EquipName; +// info.VDR_Record = signal.VDR_Record; +// info.WHConsole = signal.WHConsole; +// //info.WHCPU = signal.WHCPU; +// foreach (var item in signal.WHCPU.Split('|')) +// { +// info.WHCPUs.Add(WHCPUs.Where(e => e.DataItemCode.Equals(item.Trim())).FirstOrDefault()); +// } +// info.ECRConsole = signal.ECRConsole; +// //info.ECRCPU = signal.ECRCPU; +// foreach (var item in signal.ECRCPU.Split('|')) +// { +// info.ECRCPUs.Add(ECRCPUs.Where(e => e.DataItemCode.Equals(item.Trim())).FirstOrDefault()); +// } +// info.ShipOfficeConsole = signal.ShipOfficeConsole; +// //info.ShipOfficeCPU = signal.ShipOfficeCPU; +// foreach (var item in signal.ShipOfficeCPU.Split('|')) +// { +// info.ShipOfficeCPUs.Add(ShipOfficeCPUs.Where(e => e.DataItemCode.Equals(item.Trim())).FirstOrDefault()); +// } +// info.SLD = signal.SLD; +// info.SHD = signal.SHD; +// info.SafetyDelay = signal.SafetyDelay; +// info.AutoCtrl = signal.AutoCtrl; +// info.AssociatedCableInfo = (signal.CableName == "" || signal.CableName == null ? "" : "电缆位号:" + signal.CableName) + (signal.CableSetName == null ? "" : " 电缆对:" + signal.CableSetName); +// info.AssociatedChannelInfo = (signal.PanelName == null ? "" : "采集箱:" + signal.PanelName) + (signal.StripName == null ? "" : "端子排:" + signal.StripName) + (signal.ChannelName == null ? "" : " 通道:" + signal.ChannelName); +// info.Remarks = signal.Remarks; +// info.DeleteFlg = signal.DeleteFlg; +// //订阅事件以更新数据。 +// info.ParametersChanged += (sender, e) => UpdateParametersValue((SignalManagementInfo)sender); +// } + + +// /// +// /// 选择组别改变时修改Group_Name和Code() +// /// +// /// +// private async void UpdateParametersValue(SignalManagementInfo item) +// { +// if (item.type == "信号") +// { +// //获取当前组别的可用编码 +// string group = GroupOthers.Where(e => e.DataItemName.Equals(item.GroupOther)).Select(e => e.DataItemCode).FirstOrDefault(); +// if (string.IsNullOrEmpty(item.Signal_SeqNo))//编码列为空时才通过接口获取可用编码 +// { +// var seq = await _wireGroupService.GetNextAvailableSeq(group); +// int count = smInfos.Where(s => s.IsModified == true && string.IsNullOrEmpty(s.Wire_Group_ID)).ToList().Count; +// if (count > 1) +// { +// seq = (double.Parse(seq) + count - 1).ToString(); +// } +// item.Signal_SeqNo = seq.ToString(); +// } +// item.Group_Name = group + item.Signal_SeqNo; +// } +// else if (item.type == "虚拟点") +// { +// if (string.IsNullOrEmpty(item.Group_Name)) +// { +// string Group_Name = smInfos.Where(e => e.Wire_Group_ID == item.ParentID).Select(e => e.Group_Name).FirstOrDefault(); +// item.Group_Name = Group_Name + "_" + item.Code; +// } +// else +// { +// item.Group_Name = item.Group_Name.Split('_')[0] + "_" + item.Code; +// } + +// } + + + +// } +// /// +// /// 搜索方法 +// /// +// private void PerformSearch() +// { +// smInfosView.FilterDescriptors.Clear(); + +// if (!string.IsNullOrEmpty(SearchText)) +// { +// var compositeFilter = new CompositeFilterDescriptor +// { +// LogicalOperator = FilterCompositionLogicalOperator.Or +// }; + +// foreach (var prop in typeof(SignalManagementInfo).GetProperties()) +// { +// if (prop.PropertyType == typeof(string)) +// { +// compositeFilter.FilterDescriptors.Add(new FilterDescriptor +// { +// Member = prop.Name, +// Operator = FilterOperator.Contains, +// Value = SearchText.ToLower(), +// IsCaseSensitive = false +// }); +// } +// } + +// smInfosView.FilterDescriptors.Add(compositeFilter); +// } + + +// } + +// #endregion + +// } + + + +// public class SignalManagementInfo : DialogBase +// { +// public event EventHandler GroupOtherChanged; +// public event EventHandler CodeChanged; +// public event EventHandler ParametersChanged; + +// #region 表格字段 + +// private string _Wire_Group_ID; +// /// +// /// ID +// /// +// public string Wire_Group_ID +// { +// get { return _Wire_Group_ID; } +// set { _Wire_Group_ID = value; RaisePropertyChanged(nameof(Wire_Group_ID)); } +// } + +// private string _ParentID; +// /// +// /// 如果有值表示其为虚拟点 +// /// +// public string ParentID +// { +// get { return _ParentID; } +// set { _ParentID = value; } +// } + + +// private string _Status; +// /// +// /// 状态 +// /// +// public string Status +// { +// get { return _Status; } +// set { _Status = value; RaisePropertyChanged(nameof(Status)); } +// } + +// private string _serialNumber; +// /// +// /// 序号 +// /// +// public string serialNumber +// { +// get { return _serialNumber; } +// set { _serialNumber = value; RaisePropertyChanged(nameof(serialNumber)); } +// } +// private string _type; +// /// +// /// 类型 +// /// +// public string type +// { +// get { return _type; } +// set { _type = value; RaisePropertyChanged(nameof(type)); } +// } +// private string _Group_Name; +// /// +// /// CH.NO +// /// +// public string Group_Name +// { +// get { return _Group_Name; } +// set { _Group_Name = value; RaisePropertyChanged(nameof(Group_Name)); } +// } + + +// private string _Group_Desc_EN; +// /// +// /// 英文描述 +// /// +// public string Group_Desc_EN +// { +// get { return _Group_Desc_EN; } +// set { _Group_Desc_EN = value; RaisePropertyChanged(nameof(Group_Desc_EN)); } +// } +// private string _Group_Desc; +// /// +// /// 中文描述 +// /// +// public string Group_Desc +// { +// get { return _Group_Desc; } +// set { _Group_Desc = value; RaisePropertyChanged(nameof(Group_Desc)); } +// } +// private string _BelongingMajor; +// /// +// /// 归属专业 +// /// +// public string BelongingMajor +// { +// get { return _BelongingMajor; } +// set { _BelongingMajor = value; RaisePropertyChanged(nameof(BelongingMajor)); } +// } + +// private string _GroupOther; +// /// +// /// 组别 +// /// +// public string GroupOther +// { +// get { return _GroupOther; } +// set +// { +// _GroupOther = value; +// RaisePropertyChanged(nameof(GroupOther)); +// ParametersChanged?.Invoke(this, EventArgs.Empty); +// } +// } +// private List _GroupOthers; +// /// +// /// 组别列表 +// /// +// public List GroupOthers +// { +// get { return _GroupOthers; } +// set { _GroupOthers = value; RaisePropertyChanged(nameof(GroupOthers)); } +// } + +// private string _Signal_SeqNo; +// /// +// /// 编码 +// /// +// public string Signal_SeqNo +// { +// get { return _Signal_SeqNo; } +// set { _Signal_SeqNo = value; RaisePropertyChanged(nameof(Signal_SeqNo)); } +// } +// private string _Code; +// /// +// /// Code +// /// +// public string Code +// { +// get { return _Code; } +// set +// { +// _Code = value; +// RaisePropertyChanged(nameof(Code)); +// ParametersChanged?.Invoke(this, EventArgs.Empty); +// } +// } +// private string _InOrOut; +// /// +// /// IO类型 +// /// +// public string InOrOut +// { +// get { return _InOrOut; } +// set { _InOrOut = value; RaisePropertyChanged(nameof(InOrOut)); } +// } + +// private string _IO_Type; +// /// +// /// 信号类型 +// /// +// public string IO_Type +// { +// get { return _IO_Type; } +// set { _IO_Type = value; RaisePropertyChanged(nameof(IO_Type)); } +// } +// private string _Range_Min; +// /// +// /// Range_Min +// /// +// public string Range_Min +// { +// get { return _Range_Min; } +// set { _Range_Min = value; RaisePropertyChanged(nameof(Range_Min)); } +// } +// private string _Range_Max; +// /// +// /// Range_Max +// /// +// public string Range_Max +// { +// get { return _Range_Max; } +// set { _Range_Max = value; RaisePropertyChanged(nameof(Range_Max)); } +// } +// private string _Unit; +// /// +// /// 单位 +// /// +// public string Unit +// { +// get { return _Unit; } +// set { _Unit = value; RaisePropertyChanged(nameof(Unit)); } +// } +// private string _Alarm_LL; + +// public string Alarm_LL +// { +// get { return _Alarm_LL; } +// set { _Alarm_LL = value; RaisePropertyChanged(nameof(Alarm_LL)); } +// } +// private string _Alarm_L; + +// public string Alarm_L +// { +// get { return _Alarm_L; } +// set { _Alarm_L = value; RaisePropertyChanged(nameof(Alarm_L)); } +// } +// private string _Alarm_H; + +// public string Alarm_H +// { +// get { return _Alarm_H; } +// set { _Alarm_H = value; RaisePropertyChanged(nameof(Alarm_H)); } +// } +// private string _Alarm_HH; + +// public string Alarm_HH +// { +// get { return _Alarm_HH; } +// set { _Alarm_HH = value; RaisePropertyChanged(nameof(Alarm_HH)); } +// } +// private string _SENSOR_CODE; + +// public string SENSOR_CODE +// { +// get { return _SENSOR_CODE; } +// set { _SENSOR_CODE = value; RaisePropertyChanged(nameof(SENSOR_CODE)); } +// } +// private bool _CommunicationPoint; +// /// +// /// 是否是通讯点 +// /// +// public bool CommunicationPoint +// { +// get { return _CommunicationPoint; } +// set { _CommunicationPoint = value; RaisePropertyChanged(nameof(CommunicationPoint)); } +// } +// private string _SeriousType; + +// public string SeriousType +// { +// get { return _SeriousType; } +// set { _SeriousType = value; RaisePropertyChanged(nameof(SeriousType)); } +// } +// private string _AL_GRP; + +// public string AL_GRP +// { +// get { return _AL_GRP; } +// set { _AL_GRP = value; RaisePropertyChanged(nameof(AL_GRP)); } +// } +// private string _BL_GRP; + +// public string BL_GRP +// { +// get { return _BL_GRP; } +// set { _BL_GRP = value; RaisePropertyChanged(nameof(BL_GRP)); } +// } +// private string _Time_Delay; + +// public string Time_Delay +// { +// get { return _Time_Delay; } +// set { _Time_Delay = value; RaisePropertyChanged(nameof(Time_Delay)); } +// } +// private string _Supplier; +// /// +// /// 供应商 +// /// +// public string Supplier +// { +// get { return _Supplier; } +// set { _Supplier = value; RaisePropertyChanged(nameof(Supplier)); } +// } +// private string _EquipName; +// /// +// /// 设备名 +// /// +// public string EquipName +// { +// get { return _EquipName; } +// set { _EquipName = value; RaisePropertyChanged(nameof(EquipName)); } +// } +// private bool _VDR_Record; + +// public bool VDR_Record +// { +// get { return _VDR_Record; } +// set { _VDR_Record = value; RaisePropertyChanged(nameof(VDR_Record)); } +// } +// private string _WHConsole; + +// public string WHConsole +// { +// get { return _WHConsole; } +// set { _WHConsole = value; RaisePropertyChanged(nameof(WHConsole)); } +// } +// private ObservableCollection _WHCPU = new ObservableCollection(); + +// public ObservableCollection WHCPU +// { +// get { return _WHCPU; } +// set +// { +// _WHCPU = value; +// WHCPUs.AddRange(value); +// RaisePropertyChanged(nameof(WHCPU)); +// } +// } +// private ObservableCollection _WHCPUs = new ObservableCollection(); +// public ObservableCollection WHCPUs +// { +// get { return _WHCPUs; } +// set { _WHCPUs = value; OnPropertyChanged(nameof(WHCPUs)); } +// } + +// private string _ECRConsole; + +// public string ECRConsole +// { +// get { return _ECRConsole; } +// set { _ECRConsole = value; RaisePropertyChanged(nameof(ECRConsole)); } +// } +// private string _ECRCPU; + +// public string ECRCPU +// { +// get { return _ECRCPU; } +// set { _ECRCPU = value; RaisePropertyChanged(nameof(ECRCPU)); } +// } + +// private ObservableCollection _ECRCPUs = new ObservableCollection(); +// public ObservableCollection ECRCPUs +// { +// get { return _ECRCPUs; } +// set { _ECRCPUs = value; RaisePropertyChanged(nameof(ECRCPUs)); } +// } + +// private string _ShipOfficeConsole; + +// public string ShipOfficeConsole +// { +// get { return _ShipOfficeConsole; } +// set { _ShipOfficeConsole = value; RaisePropertyChanged(nameof(ShipOfficeConsole)); } +// } +// private string _ShipOfficeCPU; + +// public string ShipOfficeCPU +// { +// get { return _ShipOfficeCPU; } +// set { _ShipOfficeCPU = value; RaisePropertyChanged(nameof(ShipOfficeCPU)); } +// } + +// private ObservableCollection _ShipOfficeCPUs = new ObservableCollection(); + +// public ObservableCollection ShipOfficeCPUs +// { +// get { return _ShipOfficeCPUs; } +// set { _ShipOfficeCPUs = value; RaisePropertyChanged(nameof(ShipOfficeCPUs)); } +// } + +// private bool _SLD; + +// public bool SLD +// { +// get { return _SLD; } +// set { _SLD = value; RaisePropertyChanged(nameof(SLD)); } +// } +// private bool _SHD; + +// public bool SHD +// { +// get { return _SHD; } +// set { _SHD = value; RaisePropertyChanged(nameof(SHD)); } +// } +// private string _SafetyDelay; +// /// +// /// 安保延迟 +// /// +// public string SafetyDelay +// { +// get { return _SafetyDelay; } +// set { _SafetyDelay = value; RaisePropertyChanged(nameof(SafetyDelay)); } +// } +// private string _AutoCtrl; +// /// +// /// 自动控制 +// /// +// public string AutoCtrl +// { +// get { return _AutoCtrl; } +// set { _AutoCtrl = value; RaisePropertyChanged(nameof(AutoCtrl)); } +// } +// private string _AssociatedCableInfo; +// /// +// /// 关联电缆信息 +// /// +// public string AssociatedCableInfo +// { +// get { return _AssociatedCableInfo; } +// set { _AssociatedCableInfo = value; RaisePropertyChanged(nameof(AssociatedCableInfo)); } +// } +// private string _AssociatedChannelInfo; +// /// +// /// 关联通道信息 +// /// +// public string AssociatedChannelInfo +// { +// get { return _AssociatedChannelInfo; } +// set { _AssociatedChannelInfo = value; RaisePropertyChanged(nameof(AssociatedChannelInfo)); } +// } +// private string _Remarks; +// /// +// /// 备注 +// /// +// public string Remarks +// { +// get { return _Remarks; } +// set { _Remarks = value; RaisePropertyChanged(nameof(Remarks)); } +// } +// private List _Suppliers; +// /// +// /// 绑定供应商 +// /// +// public List Suppliers +// { +// get { return _Suppliers; } +// set { _Suppliers = value; RaisePropertyChanged(nameof(Suppliers)); } +// } + +// #region 扩展字段 +// private bool _IsModified; +// /// +// /// 是否修改 +// /// +// public bool IsModified +// { +// get { return _IsModified; } +// set { _IsModified = value; RaisePropertyChanged(nameof(IsModified)); } +// } + +// private bool _IsExpanded = false; +// /// +// /// 是否展开 +// /// +// public bool IsExpanded +// { +// get { return _IsExpanded; } +// set { _IsExpanded = value; RaisePropertyChanged(nameof(IsExpanded)); } +// } + +// private bool _IsExpandable; +// /// +// /// 是否可展开 +// /// +// public bool IsExpandable +// { +// get { return _IsExpandable; } +// set { _IsExpandable = value; RaisePropertyChanged(nameof(IsExpandable)); } +// } + +// private List _ActionHistorys; +// /// +// /// 操作历史 +// /// +// public List ActionHistorys +// { +// get { return _ActionHistorys; } +// set { _ActionHistorys = value; } +// } + +// private bool _DeleteFlg; +// /// +// /// 删除标记 +// /// +// public bool DeleteFlg +// { +// get { return _DeleteFlg; } +// set { _DeleteFlg = value; } +// } + +// private ObservableCollection _ChildSignals = new ObservableCollection(); + +// public ObservableCollection ChildSignals +// { +// get { return _ChildSignals; } +// set { _ChildSignals = value; RaisePropertyChanged(nameof(ChildSignals)); } +// } + +// private QueryableCollectionView _ChildSignalsView; +// /// +// /// 虚拟点集合视图 +// /// +// public QueryableCollectionView ChildSignalsView +// { +// get { return _ChildSignalsView; } +// set { _ChildSignalsView = value; RaisePropertyChanged(nameof(ChildSignalsView)); } +// } +// #endregion + + + +// #endregion + +// #region 方法 +// /// +// /// 将表格对象转换为数据模型类 +// /// +// /// +// public ec_Wire_Group to_ec_Wire_Group(List sigals) +// { +// ec_Wire_Group ent; +// if (string.IsNullOrEmpty(Wire_Group_ID)) +// { +// ent = new ec_Wire_Group(); +// } +// else +// { +// ent = sigals.Where(e => e.Wire_Group_ID.Equals(Wire_Group_ID)).First(); +// } +// switch (Status) +// { +// case "ToDelete": +// ent.Status = WireGroupStatusEnum.ToDelete; +// break; +// case "New": +// ent.Status = WireGroupStatusEnum.New; +// break; +// case "Used": +// ent.Status = WireGroupStatusEnum.Used; +// break; +// case "Confirmed": +// ent.Status = WireGroupStatusEnum.Confirmed; +// break; +// case "Reopen": +// ent.Status = WireGroupStatusEnum.Reopen; +// break; +// case "deleted": +// ent.Status = WireGroupStatusEnum.deleted; +// break; +// } + +// ent.Wire_Group_ID = Wire_Group_ID; +// ent.ParentID = ParentID; +// ent.Group_Name = Group_Name; +// ent.Group_Desc_EN = Group_Desc_EN; +// ent.Group_Desc = Group_Desc; +// ent.ElecOnly = BelongingMajor.Equals("E") ? true : false; +// if (GroupOther == null) +// { +// ent.Signal_Group = ""; +// } +// else +// { +// ent.Signal_Group = GroupOthers.Where(g => g.DataItemName == GroupOther).Select(g => g.DataItemCode).FirstOrDefault(); + +// } +// ent.Signal_SeqNo = Signal_SeqNo; +// ent.Code = Code; +// ent.InOrOut = InOrOut; +// ent.IO_Type = IO_Type; +// ent.Range_Min = Range_Min; +// ent.Range_Max = Range_Max; +// ent.Unit = Unit; +// ent.Alarm_LL = Alarm_LL; +// ent.Alarm_L = Alarm_L; +// ent.Alarm_H = Alarm_H; +// ent.Alarm_HH = Alarm_HH; +// ent.SENSOR_CODE = SENSOR_CODE; +// ent.CommunicationPoint = CommunicationPoint; +// ent.SeriousType = SeriousType; +// ent.AL_GRP = AL_GRP; +// ent.BL_GRP = BL_GRP; +// ent.Time_Delay = Time_Delay; +// ent.Supplier = Suppliers.Where(g => g.DataItemName == Supplier).Select(g => g.DataItemCode).FirstOrDefault(); +// ent.EquipName = EquipName; +// ent.VDR_Record = VDR_Record; +// ent.WHConsole = WHConsole; +// ent.WHCPU = ""; +// foreach (var item in WHCPUs) +// { +// if (item != null) +// { +// ent.WHCPU = ent.WHCPU + item.DataItemCode + "|"; +// } + +// } +// ent.ECRConsole = ECRConsole; +// ent.ECRCPU = ""; +// foreach (var item in ECRCPUs) +// { +// if (item != null) +// { +// ent.ECRCPU = ent.ECRCPU + item.DataItemCode + "|"; +// } + +// } +// ent.ShipOfficeConsole = ShipOfficeConsole; +// ent.ShipOfficeCPU = ""; +// foreach (var item in ShipOfficeCPUs) +// { +// if (item != null) +// { +// ent.ShipOfficeCPU = ent.ShipOfficeCPU + item.DataItemCode + "|"; +// } + +// } +// ent.SLD = SLD; +// ent.SHD = SHD; +// ent.SafetyDelay = SafetyDelay; +// ent.AutoCtrl = AutoCtrl; +// if (string.IsNullOrEmpty(AssociatedCableInfo)) +// { +// //// 使用正则表达式匹配模式,并提取每组数据 +// //var matches = Regex.Matches(AssociatedCableInfo, @"电缆位号:(.*?)\s电缆对:(.*)"); +// // if (matches.Count > 0) // 确保至少有一个匹配项 +// // { +// // string cableNumber = matches[0].Groups[1].Value; // 第一个冒号后的值 +// // string cableSet = matches[0].Groups[2].Value; // 第二个冒号后的值 +// // } +// ent.CableName = ""; +// ent.CableSetName = ""; +// } +// else +// { +// ent.CableName = AssociatedCableInfo.Split(' ')[0].Split(':')[1]; +// ent.CableSetName = (AssociatedCableInfo.Split(' ').Count() > 1) ? AssociatedCableInfo.Split(' ')[1].Split(':')[1] : ""; +// } +// if (string.IsNullOrEmpty(AssociatedChannelInfo)) +// { +// ent.PanelName = ""; +// ent.StripName = ""; +// ent.ChannelName = ""; +// } +// else +// { +// ent.PanelName = AssociatedChannelInfo.Split(' ')[0].Split(':')[1]; +// ent.StripName = (AssociatedChannelInfo.Split(' ').Count() > 1) ? AssociatedChannelInfo.Split(' ')[1].Split(':')[1] : ""; +// ent.ChannelName = (AssociatedChannelInfo.Split(' ').Count() > 2) ? AssociatedChannelInfo.Split(' ')[2].Split(':')[2] : ""; +// } +// ent.Remarks = Remarks; +// ent.ActionHistorys = ActionHistorys; +// ent.DeleteFlg = DeleteFlg; + +// return ent; +// } +// #endregion + +// } + +//} diff --git a/newFront/c#前端/SWS.CAD/ViewModels/DialogSignalNoticeViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/DialogSignalNoticeViewModel.cs index 12bc4c89..8ccedd1c 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/DialogSignalNoticeViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/DialogSignalNoticeViewModel.cs @@ -1,32 +1,18 @@ -using Bricscad.EditorInput; -using Bricscad.ApplicationServices; -using Prism.Dialogs; -using SWS.CAD.Models; -using SWS.CAD.Services; + + using SWS.CAD.ViewModels.myViewModelBase; -using SWS.CAD.Views; -using System; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.Globalization; using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Input; using Telerik.Windows.Controls; using Unity; -using System.Windows; -using System.Runtime.Remoting.Channels; -using static SWS.CAD.GlobalObject; -using static SWS.CAD.Services.WireGroupService; -using System.ComponentModel; -using static System.Net.Mime.MediaTypeNames; -using System.Text.RegularExpressions; -using Aspose.Cells.Drawing.Texts; -using Telerik.Windows.Controls.Primitives; using SWS.CAD.Views.SignalManagementViews; -using DryIoc.ImTools; -using System.Diagnostics.Eventing.Reader; +using Prism.Services.Dialogs; +using SWS.Commons; +using SWS.Model; +using SWS.Service; +using System; namespace SWS.CAD.ViewModels { @@ -72,7 +58,9 @@ namespace SWS.CAD.ViewModels _wireGroupService = GlobalObject.container.Resolve(); } - public DialogCloseListener RequestClose { get; } + public string Title => ""; + + public event Action RequestClose; public bool CanCloseDialog() { @@ -100,19 +88,20 @@ namespace SWS.CAD.ViewModels } public override void ExecuteOKCommandAsync(object para) { - Prism.Dialogs.DialogParameters res = new Prism.Dialogs.DialogParameters(); + IDialogParameters res = new Prism.Services.Dialogs.DialogParameters(); //res.Add(GlobalObject.dialogPar.info.ToString(), $"{TextInfo}"); - RequestClose.Invoke(res, ButtonResult.Yes); + RequestClose.Invoke(new DialogResult(ButtonResult.Yes, res)); } public override void ExecuteCloseCommand(object parameter) { if (parameter as string == "ClickNo") { - RequestClose.Invoke(ButtonResult.No); + DialogResult res = new DialogResult(ButtonResult.No); + RequestClose.Invoke(res); } else { - RequestClose.Invoke(ButtonResult.Cancel); + RequestClose.Invoke(new DialogResult(ButtonResult.Cancel)); } this.Dispose(); } @@ -172,7 +161,7 @@ namespace SWS.CAD.ViewModels } - RequestClose.Invoke(ButtonResult.Cancel); + RequestClose.Invoke(new DialogResult(ButtonResult.Cancel)); this.Dispose(); } @@ -181,7 +170,7 @@ namespace SWS.CAD.ViewModels #region 取消 if (parameter.Equals("取消")) { - RequestClose.Invoke(ButtonResult.Cancel); + RequestClose.Invoke(new DialogResult(ButtonResult.Cancel)); this.Dispose(); } #endregion @@ -287,11 +276,11 @@ namespace SWS.CAD.ViewModels set { _IO_Type = value; } } - private Models.Action _ActionID; + private Model.Action _ActionID; /// /// 操作ID /// - public Models.Action ActionID + public Model.Action ActionID { get { return _ActionID; } set { _ActionID = value; } diff --git a/newFront/c#前端/SWS.CAD/ViewModels/DialogSignalPropertyhisAndLogsViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/DialogSignalPropertyhisAndLogsViewModel.cs index 0391793b..df939771 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/DialogSignalPropertyhisAndLogsViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/DialogSignalPropertyhisAndLogsViewModel.cs @@ -1,17 +1,15 @@ -using Prism.Dialogs; -using SWS.CAD.Models; -using SWS.CAD.Services; -using SWS.CAD.ViewModels.myViewModelBase; + using System.Collections.Generic; using System.Collections.ObjectModel; using System.Windows.Input; using Telerik.Windows.Controls; using Unity; -using SWS.CAD.Views.SignalManagementViews; using System; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json; -using Bricscad.EditorInput; +using Prism.Services.Dialogs; +using SWS.Commons; +using SWS.Model; +using SWS.WPF.ViewModels; +using SWS.Service; namespace SWS.CAD.ViewModels { public class DialogSignalPropertyhisAndLogsViewModel : DialogBase, IDialogAware @@ -82,7 +80,9 @@ namespace SWS.CAD.ViewModels _wireGroupService = GlobalObject.container.Resolve(); } - public DialogCloseListener RequestClose { get; } + public string Title => ""; + + public event Action RequestClose; public bool CanCloseDialog() { @@ -130,19 +130,20 @@ namespace SWS.CAD.ViewModels } public override void ExecuteOKCommandAsync(object para) { - Prism.Dialogs.DialogParameters res = new Prism.Dialogs.DialogParameters(); + IDialogParameters res = new Prism.Services.Dialogs.DialogParameters(); //res.Add(GlobalObject.dialogPar.info.ToString(), $"{TextInfo}"); - RequestClose.Invoke(res, ButtonResult.Yes); + RequestClose.Invoke(new DialogResult(ButtonResult.Yes, res)); } public override void ExecuteCloseCommand(object parameter) { if (parameter as string == "ClickNo") { - RequestClose.Invoke(ButtonResult.No); + DialogResult res = new DialogResult(ButtonResult.No); + RequestClose.Invoke(res); } else { - RequestClose.Invoke(ButtonResult.Cancel); + RequestClose.Invoke(new DialogResult(ButtonResult.Cancel)); } this.Dispose(); } @@ -162,7 +163,7 @@ namespace SWS.CAD.ViewModels if (parameter.Equals("确定")) { - RequestClose.Invoke(ButtonResult.Cancel); + RequestClose.Invoke(new DialogResult(ButtonResult.Cancel)); this.Dispose(); } @@ -171,7 +172,7 @@ namespace SWS.CAD.ViewModels #region 取消 if (parameter.Equals("取消")) { - RequestClose.Invoke(ButtonResult.Cancel); + RequestClose.Invoke(new DialogResult(ButtonResult.Cancel)); this.Dispose(); } #endregion @@ -181,110 +182,110 @@ namespace SWS.CAD.ViewModels #endregion } - public class SignalLog: DialogBase - { - #region 属性 - private int _ID; - /// - /// 序号 - /// - public int ID - { - get { return _ID; } - set { _ID = value; } - } + //public class SignalLog: DialogBase + //{ + // #region 属性 + // private int _ID; + // /// + // /// 序号 + // /// + // public int ID + // { + // get { return _ID; } + // set { _ID = value; } + // } - private string _WireGroupLogID; + // private string _WireGroupLogID; - public string WireGroupLogID - { - get { return _WireGroupLogID; } - set { _WireGroupLogID = value; } - } - private string _WireGroupID; + // public string WireGroupLogID + // { + // get { return _WireGroupLogID; } + // set { _WireGroupLogID = value; } + // } + // private string _WireGroupID; - public string WireGroupID - { - get { return _WireGroupID; } - set { _WireGroupID = value; } - } - [JsonConverter(typeof(StringEnumConverter))] - private Models.Action _OperateType; - /// - /// 操作 - /// - public Models.Action OperateType - { - get { return _OperateType; } - set { _OperateType = value; } - } - private string _ExtraMsg; - /// - /// 附加信息 - /// - public string ExtraMsg - { - get { return _ExtraMsg; } - set { _ExtraMsg = value; } - } - private string _CreateUserID; + // public string WireGroupID + // { + // get { return _WireGroupID; } + // set { _WireGroupID = value; } + // } + // [JsonConverter(typeof(StringEnumConverter))] + // private Models.Action _OperateType; + // /// + // /// 操作 + // /// + // public Models.Action OperateType + // { + // get { return _OperateType; } + // set { _OperateType = value; } + // } + // private string _ExtraMsg; + // /// + // /// 附加信息 + // /// + // public string ExtraMsg + // { + // get { return _ExtraMsg; } + // set { _ExtraMsg = value; } + // } + // private string _CreateUserID; - public string CreateUserID - { - get { return _CreateUserID; } - set { _CreateUserID = value; } - } - private string _CreateUserName; - /// - /// 操作人 - /// - public string CreateUserName - { - get { return _CreateUserName; } - set { _CreateUserName = value; } - } + // public string CreateUserID + // { + // get { return _CreateUserID; } + // set { _CreateUserID = value; } + // } + // private string _CreateUserName; + // /// + // /// 操作人 + // /// + // public string CreateUserName + // { + // get { return _CreateUserName; } + // set { _CreateUserName = value; } + // } - private DateTime? _CreateTime; - /// - /// 操作时间 - /// - /// - public DateTime? CreateTime - { - get { return _CreateTime; } - set { _CreateTime = value; } - } + // private DateTime? _CreateTime; + // /// + // /// 操作时间 + // /// + // /// + // public DateTime? CreateTime + // { + // get { return _CreateTime; } + // set { _CreateTime = value; } + // } - #endregion + // #endregion - #region 方法 - public SignalLog() - { + // #region 方法 + // public SignalLog() + // { - } - public SignalLog(ec_wire_group_log ec_Notice) - { - #region 前端表格对应列 - this.OperateType = ec_Notice.OperateType; - this.ExtraMsg = ec_Notice.ExtraMsg; - this.CreateUserName = ec_Notice.CreateUserName; - this.CreateTime = ec_Notice.CreateTime; - #endregion + // } + // public SignalLog(ec_wire_group_log ec_Notice) + // { + // #region 前端表格对应列 + // this.OperateType = ec_Notice.OperateType; + // this.ExtraMsg = ec_Notice.ExtraMsg; + // this.CreateUserName = ec_Notice.CreateUserName; + // this.CreateTime = ec_Notice.CreateTime; + // #endregion - } - /// - /// 设置数据 - /// - public void setData() - { + // } + // /// + // /// 设置数据 + // /// + // public void setData() + // { - } - #endregion - } + // } + // #endregion + //} public class SingnalPropertyhis : DialogBase { diff --git a/newFront/c#前端/SWS.CAD/ViewModels/DialogSignalSelectViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/DialogSignalSelectViewModel.cs index feef8005..02890fbe 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/DialogSignalSelectViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/DialogSignalSelectViewModel.cs @@ -1,15 +1,9 @@ -using Prism.Dialogs; -using SWS.CAD.Models; -using SWS.CAD.Services; +using Prism.Services.Dialogs; using SWS.CAD.ViewModels.myViewModelBase; -using SWS.CAD.Views; +using SWS.Commons; +using SWS.Model; using System; -using System.Collections.Generic; using System.Collections.ObjectModel; -using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows; using Telerik.Windows.Controls; using Unity; @@ -24,7 +18,9 @@ namespace SWS.CAD.ViewModels title = "信号选择框"; } - public DialogCloseListener RequestClose { get; } + public string Title => ""; + + public event Action RequestClose; public bool CanCloseDialog() { @@ -74,19 +70,20 @@ namespace SWS.CAD.ViewModels MessageBox.Show("请选择一个信号!"); return; } - Prism.Dialogs.DialogParameters res = new Prism.Dialogs.DialogParameters(); + IDialogParameters res = new Prism.Services.Dialogs.DialogParameters(); res.Add(GlobalObject.dialogPar.para1.ToString(), SelectedSignal); - RequestClose.Invoke(res,ButtonResult.Yes); + RequestClose.Invoke(new DialogResult(ButtonResult.Yes, res)); } public override void ExecuteCloseCommand(object parameter) { if (parameter as string == "ClickNo") { - RequestClose.Invoke(ButtonResult.No); + DialogResult res = new DialogResult(ButtonResult.No); + RequestClose.Invoke(res); } else { - RequestClose.Invoke(ButtonResult.Cancel); + RequestClose.Invoke(new DialogResult(ButtonResult.Cancel)); } this.Dispose(); } diff --git a/newFront/c#前端/SWS.CAD/ViewModels/DialogTagSelectViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/DialogTagSelectViewModel.cs index c2642e69..281363d4 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/DialogTagSelectViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/DialogTagSelectViewModel.cs @@ -1,23 +1,14 @@ -using Prism.Commands; -using Prism.Dialogs; + using Prism.Ioc; -using SWS.CAD.CADFunc; -using SWS.CAD.Models; -using SWS.CAD.Services; +using Prism.Services.Dialogs; using SWS.CAD.ViewModels.myViewModelBase; using SWS.CAD.Views; using SWS.CAD.Views.CustomControl; +using SWS.Commons; using System; -using System.Collections.Generic; using System.Collections.ObjectModel; -using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows; using System.Windows.Input; -using Teigha.DatabaseServices; -using Telerik.Windows.Controls; using Unity; using DelegateCommand = Prism.Commands.DelegateCommand; @@ -37,7 +28,7 @@ namespace SWS.CAD.ViewModels } public void onNewTagNumber() { - Prism.Dialogs.DialogParameters x = new Prism.Dialogs.DialogParameters(); + IDialogParameters x = new Prism.Services.Dialogs.DialogParameters(); x.Add(GlobalObject.dialogPar.id.ToString(), objectTypeId); var _dialogService = GlobalObject._prismContainer.Resolve(); _dialogService.ShowDialog(nameof(DialogNewTagNumber), x, (RES) => @@ -54,7 +45,9 @@ namespace SWS.CAD.ViewModels { } }); } - public DialogCloseListener RequestClose { get; } + public string Title => ""; + + public event Action RequestClose; public bool CanCloseDialog() { @@ -105,19 +98,20 @@ namespace SWS.CAD.ViewModels MessageBox.Show("位号不能为空!"); return; } - Prism.Dialogs.DialogParameters res = new Prism.Dialogs.DialogParameters(); + IDialogParameters res = new Prism.Services.Dialogs.DialogParameters(); res.Add(GlobalObject.dialogPar.info.ToString(), TagNumber); - RequestClose.Invoke(res,ButtonResult.Yes); + RequestClose.Invoke(new DialogResult(ButtonResult.Yes, res)); } public override void ExecuteCloseCommand(object parameter) { if (parameter as string == "ClickNo") { - RequestClose.Invoke(ButtonResult.No); + DialogResult res = new DialogResult(ButtonResult.No); + RequestClose.Invoke(res); } else { - RequestClose.Invoke(ButtonResult.Cancel); + RequestClose.Invoke(new DialogResult(ButtonResult.Cancel)); } this.Dispose(); } diff --git a/newFront/c#前端/SWS.CAD/ViewModels/DialogUnitSelectViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/DialogUnitSelectViewModel.cs index 44bec1f6..f27ced15 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/DialogUnitSelectViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/DialogUnitSelectViewModel.cs @@ -1,9 +1,11 @@ -using System.Collections.ObjectModel; +using System; +using System.Collections.ObjectModel; using System.Linq; using System.Windows; -using Prism.Dialogs; -using SWS.CAD.Models; +using Prism.Services.Dialogs; using SWS.CAD.ViewModels.myViewModelBase; +using SWS.Commons; +using SWS.Model; namespace SWS.CAD.ViewModels { @@ -15,7 +17,9 @@ namespace SWS.CAD.ViewModels title = "设计单位选择框"; } - public DialogCloseListener RequestClose { get; } + public string Title => ""; + + public event Action RequestClose; public bool CanCloseDialog() { @@ -64,19 +68,22 @@ namespace SWS.CAD.ViewModels MessageBox.Show("请选择一个单位!"); return; } - Prism.Dialogs.DialogParameters res = new Prism.Dialogs.DialogParameters(); + IDialogParameters res = new DialogParameters(); res.Add(GlobalObject.dialogPar.unit.ToString(), SelectedUnit); - RequestClose.Invoke(res,ButtonResult.Yes); + DialogResult result = new DialogResult(ButtonResult.Yes, res); + RequestClose.Invoke(result); } public override void ExecuteCloseCommand(object parameter) { if (parameter as string == "ClickNo") { - RequestClose.Invoke(ButtonResult.No); + DialogResult res = new DialogResult(ButtonResult.No); + RequestClose.Invoke(res); } else { - RequestClose.Invoke(ButtonResult.Cancel); + DialogResult res = new DialogResult(ButtonResult.Cancel); + RequestClose.Invoke(res); } this.Dispose(); } diff --git a/newFront/c#前端/SWS.CAD/ViewModels/LeftPanelViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/LeftPanelViewModel.cs index 3827cb75..ec98813f 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/LeftPanelViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/LeftPanelViewModel.cs @@ -1,14 +1,9 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Prism.Commands; -using Prism.Dialogs; using Prism.Events; using Prism.Ioc; using SWS.CAD.Event; -using SWS.CAD.Helper; -using SWS.CAD.Models; -using SWS.CAD.Models.NoEntity; -using SWS.CAD.Services; using SWS.CAD.Views; using System; using System.Collections.Generic; @@ -30,22 +25,17 @@ using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel; using MessageBox = System.Windows.MessageBox; using Application = Bricscad.ApplicationServices.Application; using SWS.CAD.CADFunc; -using Microsoft.Xaml.Behaviors.Core; using Teigha.DatabaseServices; -using System.Windows.Controls; -using Bricscad.ApplicationServices; using Bricscad.EditorInput; using SWS.CAD.Views.CustomControl; -using Teigha.GraphicsInterface; using DryIoc; -using System.Windows.Documents; -using System.Xml.Linq; -using System.ComponentModel; -using System.Windows.Shapes; using Path = System.IO.Path; -using System.Web.UI.WebControls; -using DryIoc.ImTools; using ImageSource = System.Windows.Media.ImageSource; +using Prism.Services.Dialogs; +using SWS.Commons; +using SWS.Model; +using SWS.Service; +using SWS.WPF.Views; namespace SWS.CAD.ViewModels { public class LeftPanelViewModel : ViewModelBase @@ -146,7 +136,7 @@ namespace SWS.CAD.ViewModels /// public ICommand Command_Guanlian { get; set; } - private void onExecuteCommand(TreeModel obj) + private void onExecuteCommand(Model.TreeModel obj) { if (obj != null) { @@ -189,11 +179,11 @@ namespace SWS.CAD.ViewModels set { _curProjName = value; RaisePropertyChanged(nameof(curProjName)); } } - private ObservableCollection drawings; + private ObservableCollection drawings; /// /// 图纸目录树 /// - public ObservableCollection Drawings + public ObservableCollection Drawings { get { return this.drawings; } set @@ -205,11 +195,11 @@ namespace SWS.CAD.ViewModels } } } - private ObservableCollection _historyDrawings; + private ObservableCollection _historyDrawings; /// /// 历史版次图纸树 /// - public ObservableCollection historyDrawings + public ObservableCollection historyDrawings { get { return this._historyDrawings; } set @@ -222,20 +212,20 @@ namespace SWS.CAD.ViewModels } } - private ObservableCollection _objectTypeTree; + private ObservableCollection _objectTypeTree; /// /// 放置元件列表 /// - public ObservableCollection objectTypeTree + public ObservableCollection objectTypeTree { get { return _objectTypeTree; } set { _objectTypeTree = value; RaisePropertyChanged(nameof(objectTypeTree)); } } - private TreeModel _selectType; + private Model.TreeModel _selectType; /// /// 选中的元件树节点 /// - public TreeModel selectType + public Model.TreeModel selectType { get { return _selectType; } set @@ -254,20 +244,20 @@ namespace SWS.CAD.ViewModels RaisePropertyChanged(nameof(selectType)); } } - private ObservableCollection _designTree; + private ObservableCollection _designTree; /// /// 设计浏览列表 /// - public ObservableCollection designTree + public ObservableCollection designTree { get { return _designTree; } set { _designTree = value; RaisePropertyChanged(nameof(designTree)); } } - private TreeModel _selectDesign; + private Model.TreeModel _selectDesign; /// /// 选中的设计浏览树节点 /// - public TreeModel selectDesign + public Model.TreeModel selectDesign { get { return _selectDesign; } set @@ -277,9 +267,9 @@ namespace SWS.CAD.ViewModels } } - private TreeModel _selectedNode; + private Model.TreeModel _selectedNode; - public TreeModel selectedNode + public Model.TreeModel selectedNode { get { return _selectedNode; } set @@ -366,7 +356,7 @@ namespace SWS.CAD.ViewModels } #endregion ObjectTypeService objectTypeService { get; set; } - ObservableCollection originDrawings = new ObservableCollection(); + ObservableCollection originDrawings = new ObservableCollection(); ProjectService _projectService; DrawingServce _dwgService; ConfigService _configService; @@ -377,7 +367,7 @@ namespace SWS.CAD.ViewModels IEventAggregator eventAggregator; private readonly IDialogService _dialogService; private bool isCheckIn = false;//是否正在进行检入 关联云线 - private bool isIOassociationChannel= false;//是否正在进行位号关联通道 + private bool isIOassociationChannel = false;//是否正在进行位号关联通道 private bool isObjectTypeGuanlian = false;//是否正在进行元件关联图元 关联云线 public LeftPanelViewModel( DrawingServce httpService, ProjectService projectServ, @@ -393,39 +383,39 @@ namespace SWS.CAD.ViewModels _configService = configService; _projectService = projectServ; this.eventAggregator = eventAggregator; - ExcuteCommand = new DelegateCommand(onExecuteCommand); - Command_CreateDwg = new DelegateCommand(onCreateDwg); - Command_OpenDwg = new DelegateCommand(onOpenDwg); - Command_DeleteDwg = new DelegateCommand(onDeleteDwg); - Command_EditPropertyDwg = new DelegateCommand(onPropertyDwg); - Command_OpenDwgFileFolder = new DelegateCommand(onOpenDwgFileFolder); - Command_CheckInDwg = new DelegateCommand(onCheckInDwg); - Command_CheckOutDwg = new DelegateCommand(onCheckOutDwg); - Command_FreeDwg = new DelegateCommand(onFreeDwg); - Command_UpDwg = new DelegateCommand(onUpDwg); - Command_DownDwg = new DelegateCommand(onDownDwg); - Command_GenerateFileMaterial = new DelegateCommand(onGenerateFileMaterialDwg); - Command_ReviseDwg = new DelegateCommand(onReviseDwg); - Command_PublishDwg = new DelegateCommand(onPublishDwg); - Command_CheckInRecordDwg = new DelegateCommand(onCheckInRecordDwg); - Command_CheckInAuditDwg = new DelegateCommand(onCheckInAuditDwg); - Command_PublishRecordDwg = new DelegateCommand(onPublishRecordDwg); - Command_OperateRecordDwg = new DelegateCommand(onOperateRecordDwg); - Common_SelectedDesign = new DelegateCommand(onDesignSelectedChange); - Common_DoubleClickDesign = new DelegateCommand(onDesignDoubleClick); - Command_ReadOnlyOpenDwg = new DelegateCommand(onReadOnlyOpenDwg); - Command_RefreshHistoryDwg = new DelegateCommand(onRefreshHistoryDwg); + ExcuteCommand = new DelegateCommand(onExecuteCommand); + Command_CreateDwg = new DelegateCommand(onCreateDwg); + Command_OpenDwg = new DelegateCommand(onOpenDwg); + Command_DeleteDwg = new DelegateCommand(onDeleteDwg); + Command_EditPropertyDwg = new DelegateCommand(onPropertyDwg); + Command_OpenDwgFileFolder = new DelegateCommand(onOpenDwgFileFolder); + Command_CheckInDwg = new DelegateCommand(onCheckInDwg); + Command_CheckOutDwg = new DelegateCommand(onCheckOutDwg); + Command_FreeDwg = new DelegateCommand(onFreeDwg); + Command_UpDwg = new DelegateCommand(onUpDwg); + Command_DownDwg = new DelegateCommand(onDownDwg); + Command_GenerateFileMaterial = new DelegateCommand(onGenerateFileMaterialDwg); + Command_ReviseDwg = new DelegateCommand(onReviseDwg); + Command_PublishDwg = new DelegateCommand(onPublishDwg); + Command_CheckInRecordDwg = new DelegateCommand(onCheckInRecordDwg); + Command_CheckInAuditDwg = new DelegateCommand(onCheckInAuditDwg); + Command_PublishRecordDwg = new DelegateCommand(onPublishRecordDwg); + Command_OperateRecordDwg = new DelegateCommand(onOperateRecordDwg); + Common_SelectedDesign = new DelegateCommand(onDesignSelectedChange); + Common_DoubleClickDesign = new DelegateCommand(onDesignDoubleClick); + Command_ReadOnlyOpenDwg = new DelegateCommand(onReadOnlyOpenDwg); + Command_RefreshHistoryDwg = new DelegateCommand(onRefreshHistoryDwg); Command_TagDoubleClick = new DelegateCommand(onTagDoubleClick); Command_Guanlian = new DelegateCommand(onGuanlian); - Command_EditDrawingCatalogue = new DelegateCommand(onEditDrawingCatalogue); + Command_EditDrawingCatalogue = new DelegateCommand(onEditDrawingCatalogue); window_loaded = new Telerik.Windows.Controls.DelegateCommand(onWindow_loaded); eventAggregator.GetEvent().Subscribe(onEnterProjOK, ThreadOption.UIThread, true); eventAggregator.GetEvent().Subscribe(CheckInDwg, ThreadOption.UIThread, true); eventAggregator.GetEvent().Subscribe(ChangeIORelation, ThreadOption.UIThread, true); objectTypeService = GlobalObject.container.Resolve(); listLibrary = new ObservableCollection(); - designTree = new ObservableCollection(); - objectTypeTree = new ObservableCollection(); + designTree = new ObservableCollection(); + objectTypeTree = new ObservableCollection(); guanlian1Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.guanlian.png"); guanlian2Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"SWS.CAD.Images.guanlian2.png"); guanlianImage = guanlian2Image; @@ -437,9 +427,9 @@ namespace SWS.CAD.ViewModels /// /// /// - private ObservableCollection CheckInOutStatus(ObservableCollection trees) + private ObservableCollection CheckInOutStatus(ObservableCollection trees) { - foreach (TreeModel node in trees) + foreach (Model.TreeModel node in trees) { foreach (var item in node.ChildNodes) { @@ -454,7 +444,7 @@ namespace SWS.CAD.ViewModels /// /// /// - private void UpdateNode(TreeModel item, ec_drawing_file dwgObj) + private void UpdateNode(Model.TreeModel item, ec_drawing_file dwgObj) { if (dwgObj.IsCheckOut == 0) { @@ -497,17 +487,17 @@ namespace SWS.CAD.ViewModels { Drawings.Clear(); } - originDrawings = JsonConvert.DeserializeObject>(data.ToString()); - Drawings = new ObservableCollection(originDrawings); + originDrawings = JsonConvert.DeserializeObject>(data.ToString()); + Drawings = new ObservableCollection(originDrawings); Drawings = CheckInOutStatus(Drawings); curProjName = "当前项目:" + GlobalObject.curProject.ProjectName; LoginOK = true; //放置元件列表树 data = obj.First(x => (string)x["Name"] == "对象类型树")["data"]; - GlobalObject.objectTypeTree = JsonConvert.DeserializeObject>(data.ToString()); + GlobalObject.objectTypeTree = JsonConvert.DeserializeObject>(data.ToString()); GlobalObject.objectTypeTree = SetTreeGlyph(GlobalObject.objectTypeTree); #region 设计元件 最近使用 - TreeModel recentNode = new TreeModel() + Model.TreeModel recentNode = new Model.TreeModel() { ID = "0", NodeType = "000", Text = "最近使用" }; var strRecentObjectType = _configService.Read("Project" + GlobalObject.curProject.ProjectId, nameof(ConfigIni.RecentObjectType)); if (!string.IsNullOrEmpty(strRecentObjectType)) @@ -516,21 +506,21 @@ namespace SWS.CAD.ViewModels foreach (var id in listObjectTypeId) { //获取节点 - TreeModel node = TreeHelper.GetTreeModel(GlobalObject.objectTypeTree, id); + Model.TreeModel node = Helper.TreeHelper.GetTreeModel(GlobalObject.objectTypeTree, id); if (node != null) { - var node1 = (TreeModel)node.Clone(); + var node1 = (Model.TreeModel)node.Clone(); recentNode.ChildNodes.Add(node1); } } } GlobalObject.objectTypeTree.Insert(0, recentNode); #endregion - objectTypeTree = new ObservableCollection(GlobalObject.objectTypeTree); + objectTypeTree = new ObservableCollection(GlobalObject.objectTypeTree); //设计浏览树 data = obj.First(x => (string)x["Name"] == "对象类型树")["data"]; - GlobalObject.designTree = JsonConvert.DeserializeObject>(data.ToString()); - designTree = new ObservableCollection(GlobalObject.designTree); + GlobalObject.designTree = JsonConvert.DeserializeObject>(data.ToString()); + designTree = new ObservableCollection(GlobalObject.designTree); //加载项目下的所有计量单位 var listUnit = await _dataItemService.GetMeasuringUnitList(); @@ -541,7 +531,7 @@ namespace SWS.CAD.ViewModels GlobalObject.AllDwgName.Clear(); foreach (var dwg in Drawings) { - TreeHelper.GetTreeText(dwg); + Helper.TreeHelper.GetTreeText(dwg); } #endregion @@ -563,13 +553,13 @@ namespace SWS.CAD.ViewModels /// /// 完整的节点 /// - private List SetTreeGlyph(List nodes) + private List SetTreeGlyph(List nodes) { foreach (var node in nodes) { if (node.ChildNodes.Count > 0) { - node.ChildNodes = new ObservableCollection(SetTreeGlyph(node.ChildNodes.ToList())); + node.ChildNodes = new ObservableCollection(SetTreeGlyph(node.ChildNodes.ToList())); //node.FontColor = new SolidColorBrush(Colors.Yellow); //图纸名称字体颜色:黄色 } else @@ -605,20 +595,63 @@ namespace SWS.CAD.ViewModels #endregion #region 查找树节点 + public ICommand TextChangedCmd => new Telerik.Windows.Controls.DelegateCommand(TextBox_TextChanged); + /// + /// 显示状态按钮 + /// + /// + public virtual async void TextBox_TextChanged(object parameter) + { + var textValue = parameter.ToString(); + } + + /// /// 查找树节点 /// /// 查找内容 - public void SearchTree(string searchText) + public async void SearchTree(string tag, string searchText) { if (Drawings != null) { - // 递归筛选树形结构中的节点 - var filteredItems = FilterTree(originDrawings, searchText); - Drawings.Clear(); - foreach (var item in filteredItems) + if (tag.Equals("工程文件")) { - Drawings.Add(item); + // 递归筛选树形结构中的节点 + //var filteredItems = FilterTree(originDrawings, searchText); + //Drawings.Clear(); + //foreach (var item in filteredItems) + //{ + // Drawings.Add(item); + //} + if (string.IsNullOrEmpty(searchText)) + { + Drawings.Clear(); + Drawings = new ObservableCollection(GlobalObject.objectTypeTree); + return; + } + //调用接口筛选树形结构的节点 + var resObjectTypeData = await objectTypeService.GetObjectTypeData("0", searchText); + Drawings.Clear(); + if (resObjectTypeData != null) + { + Drawings = new ObservableCollection(resObjectTypeData); + } + + } + if (tag.Equals("设计浏览")) + { + if (string.IsNullOrEmpty(searchText)) + { + designTree.Clear(); + designTree = new ObservableCollection(GlobalObject.designTree); + return; + } + var resObjectTypeData = await objectTypeService.GetObjectTypeData("0", searchText); + designTree.Clear(); + if (resObjectTypeData != null) + { + designTree = new ObservableCollection(resObjectTypeData); + } } } @@ -629,9 +662,9 @@ namespace SWS.CAD.ViewModels /// 完整的节点 /// 带搜索的 /// - private ObservableCollection FilterTree(ObservableCollection nodes, string searchText) + private ObservableCollection FilterTree(ObservableCollection nodes, string searchText) { - ObservableCollection result = new ObservableCollection(); + ObservableCollection result = new ObservableCollection(); foreach (var node in nodes) { @@ -641,10 +674,10 @@ namespace SWS.CAD.ViewModels // 如果节点匹配,或者它有匹配的子节点,添加当前节点到结果 if (node.Text.ToUpper().Contains(searchText.ToUpper()) || filteredChildren.Any()) { - var dto = (TreeModel)node.Clone(); + var dto = (Model.TreeModel)node.Clone(); dto.ChildNodes = filteredChildren; result.Add(dto); - //result.Add(new TreeModel + //result.Add(new Model.TreeModel //{ // Text = node.Text, // ChildNodes = filteredChildren @@ -661,7 +694,7 @@ namespace SWS.CAD.ViewModels /// /// /// - private bool IsCanEdit(TreeModel node) + private bool IsCanEdit(Model.TreeModel node) { //超级管理员都有权限 if (GlobalObject.userInfo.userId.ToLower().Equals("system")) @@ -690,7 +723,7 @@ namespace SWS.CAD.ViewModels originDrawings.Clear(); } originDrawings = await _dwgService.GetDrawingCatalogue(); - Drawings = new ObservableCollection(originDrawings); + Drawings = new ObservableCollection(originDrawings); Drawings = CheckInOutStatus(Drawings); } #endregion @@ -700,9 +733,9 @@ namespace SWS.CAD.ViewModels /// 创建图纸 /// /// - private void onCreateDwg(TreeModel model) + private void onCreateDwg(Model.TreeModel model) { - IDialogParameters par = new Prism.Dialogs.DialogParameters(); + IDialogParameters par = new Prism.Services.Dialogs.DialogParameters(); par.Add(nameof(ec_drawing_file.DrawingCatalogueID), model); _dialogService.ShowDialog(nameof(NewDrawing), par, (result) => { @@ -720,7 +753,7 @@ namespace SWS.CAD.ViewModels /// 打开图纸 /// /// 图纸 - private async void onOpenDwg(TreeModel model) + private async void onOpenDwg(Model.TreeModel model) { string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(), model.Text); var msg = string.Empty; @@ -761,7 +794,7 @@ namespace SWS.CAD.ViewModels /// /// 自己检出,打开图纸编辑 /// - private async void OpenDwgByMyself(TreeModel model) + private async void OpenDwgByMyself(Model.TreeModel model) { string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(), model.Text); var dwgObj = JsonConvert.DeserializeObject(model.NodeExtData.ToString()); @@ -811,7 +844,7 @@ namespace SWS.CAD.ViewModels /// /// 下载图纸文件,只读打开 /// - private async void DownDwgByOpenReadOnly(TreeModel model) + private async void DownDwgByOpenReadOnly(Model.TreeModel model) { #region 下载文件,只读打开 string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(), model.Text); @@ -852,7 +885,7 @@ namespace SWS.CAD.ViewModels /// 删除图纸 /// /// 图纸 - private void onDeleteDwg(TreeModel model) + private void onDeleteDwg(Model.TreeModel model) { if (!IsCanEdit(model)) { @@ -868,11 +901,11 @@ namespace SWS.CAD.ViewModels /// 编辑属性 /// /// 图纸 - private async void onPropertyDwg(TreeModel model) + private async void onPropertyDwg(Model.TreeModel model) { //取旧的图纸数据 var oldDwgFile = await _dwgService.GetDrawingFile(model.ID); - IDialogParameters par = new Prism.Dialogs.DialogParameters(); + IDialogParameters par = new Prism.Services.Dialogs.DialogParameters(); par.Add(nameof(ec_drawing_file.DrawingCatalogueID), model); _dialogService.ShowDialog(nameof(NewDrawing), par, async (result) => { @@ -895,7 +928,7 @@ namespace SWS.CAD.ViewModels /// 浏览所在文件夹 /// /// 图纸 - private void onOpenDwgFileFolder(TreeModel model) + private void onOpenDwgFileFolder(Model.TreeModel model) { try { @@ -913,7 +946,7 @@ namespace SWS.CAD.ViewModels /// 检入 /// /// 图纸 - private async void onCheckInDwg(TreeModel model) + private async void onCheckInDwg(Model.TreeModel model) { if (!IsCanEdit(model)) { @@ -996,7 +1029,7 @@ namespace SWS.CAD.ViewModels } ec_drawing_file dwgFile = JsonConvert.DeserializeObject(model.NodeExtData.ToString()); - IDialogParameters par = new Prism.Dialogs.DialogParameters(); + IDialogParameters par = new Prism.Services.Dialogs.DialogParameters(); par.Add(GlobalObject.dialogPar.info.ToString(), dwgFile); par.Add(GlobalObject.dialogPar.para1.ToString(), listHandles); par.Add(GlobalObject.dialogPar.para2.ToString(), lines); @@ -1092,7 +1125,7 @@ namespace SWS.CAD.ViewModels /// 检出 /// /// 图纸 - private async void onCheckOutDwg(TreeModel model) + private async void onCheckOutDwg(Model.TreeModel model) { if (!IsCanEdit(model)) { @@ -1119,7 +1152,7 @@ namespace SWS.CAD.ViewModels /// /// 图纸节点 /// - private async Task CheckOut(TreeModel model) + private async Task CheckOut(Model.TreeModel model) { string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(), model.Text); if (File.Exists(filePath)) @@ -1177,7 +1210,7 @@ namespace SWS.CAD.ViewModels /// 释放 /// /// 图纸 - private async void onFreeDwg(TreeModel model) + private async void onFreeDwg(Model.TreeModel model) { if (!IsCanEdit(model)) { @@ -1205,7 +1238,7 @@ namespace SWS.CAD.ViewModels /// 上移 /// /// 图纸 - private async void onUpDwg(TreeModel node) + private async void onUpDwg(Model.TreeModel node) { //MessageBox.Show("功能开发中..."); //return; @@ -1237,7 +1270,7 @@ namespace SWS.CAD.ViewModels /// 下移 /// /// 图纸 - private async void onDownDwg(TreeModel node) + private async void onDownDwg(Model.TreeModel node) { //MessageBox.Show("功能开发中..."); //return; @@ -1270,7 +1303,7 @@ namespace SWS.CAD.ViewModels /// 获取当前节点的前一个节点 /// /// - private TreeModel GetPreviousNode(TreeModel node) + private Model.TreeModel GetPreviousNode(Model.TreeModel node) { if (string.IsNullOrEmpty(node.parentId)) return null; //根节点无上级节点 var dwgFile = drawings.FirstOrDefault(a => a.ID == node.parentId); @@ -1283,7 +1316,7 @@ namespace SWS.CAD.ViewModels /// 获取当前节点的后一个节点 /// /// - public TreeModel GetNextNode(TreeModel node) + public Model.TreeModel GetNextNode(Model.TreeModel node) { if (string.IsNullOrEmpty(node.parentId)) return null; //根节点无上级节点 var dwgFile = drawings.FirstOrDefault(a => a.ID == node.parentId); @@ -1300,9 +1333,9 @@ namespace SWS.CAD.ViewModels /// 目标集合 /// 要移动的元素 /// 移动步数(正数后移,负数前移) - public void MoveItem(ObservableCollection list, TreeModel item, int step) + public void MoveItem(ObservableCollection list, Model.TreeModel item, int step) { - TreeModel parentNode = list.FirstOrDefault(a => a.ID == item.parentId); + Model.TreeModel parentNode = list.FirstOrDefault(a => a.ID == item.parentId); if (parentNode == null) return; var listNodes = parentNode.ChildNodes; @@ -1324,7 +1357,7 @@ namespace SWS.CAD.ViewModels /// 生成文件材料表 /// /// 图纸 - private void onGenerateFileMaterialDwg(TreeModel model) + private void onGenerateFileMaterialDwg(Model.TreeModel model) { MessageBox.Show("功能开发中..."); } @@ -1335,7 +1368,7 @@ namespace SWS.CAD.ViewModels /// 修订 /// /// 图纸 - private void onReviseDwg(TreeModel model) + private void onReviseDwg(Model.TreeModel model) { if (!IsCanEdit(model)) { @@ -1343,7 +1376,7 @@ namespace SWS.CAD.ViewModels return; } ec_drawing_file dwgObj = JsonConvert.DeserializeObject(model.NodeExtData.ToString()); - Prism.Dialogs.DialogParameters x = new Prism.Dialogs.DialogParameters(); + IDialogParameters x = new Prism.Services.Dialogs.DialogParameters(); x.Add(GlobalObject.dialogPar.title.ToString(), $"[{dwgObj.DrawingFileName}] 文件版本号输入"); x.Add(GlobalObject.dialogPar.info.ToString(), "文件版本号:"); var _dialogService = GlobalObject._prismContainer.Resolve(); @@ -1374,7 +1407,7 @@ namespace SWS.CAD.ViewModels /// 发布 /// /// 图纸 - private void onPublishDwg(TreeModel model) + private void onPublishDwg(Model.TreeModel model) { if (!IsCanEdit(model)) { @@ -1382,7 +1415,7 @@ namespace SWS.CAD.ViewModels return; } ec_drawing_file dwgObj = JsonConvert.DeserializeObject(model.NodeExtData.ToString()); - Prism.Dialogs.DialogParameters x = new Prism.Dialogs.DialogParameters(); + IDialogParameters x = new Prism.Services.Dialogs.DialogParameters(); x.Add(GlobalObject.dialogPar.title.ToString(), $"[{dwgObj.DrawingFileName}] 文件发布"); x.Add(GlobalObject.dialogPar.info.ToString(), "注释:"); var _dialogService = GlobalObject._prismContainer.Resolve(); @@ -1415,10 +1448,10 @@ namespace SWS.CAD.ViewModels /// 检入记录 /// /// 图纸 - private void onCheckInRecordDwg(TreeModel model) + private void onCheckInRecordDwg(Model.TreeModel model) { var dwg = JsonConvert.DeserializeObject(model.NodeExtData.ToString()); - Prism.Dialogs.DialogParameters x = new Prism.Dialogs.DialogParameters(); + IDialogParameters x = new Prism.Services.Dialogs.DialogParameters(); x.Add(GlobalObject.dialogPar.info.ToString(), dwg); var _dialogService = GlobalObject._prismContainer.Resolve(); _dialogService.ShowDialog(nameof(DialogCheckInRecord), x, (RES) => @@ -1432,7 +1465,7 @@ namespace SWS.CAD.ViewModels /// 检入审核 /// /// 图纸 - private void onCheckInAuditDwg(TreeModel model) + private void onCheckInAuditDwg(Model.TreeModel model) { var view = GlobalObject.container.Resolve(); if (GlobalObject.userInfo != null) @@ -1447,10 +1480,10 @@ namespace SWS.CAD.ViewModels /// 发布记录 /// /// 图纸 - private void onPublishRecordDwg(TreeModel model) + private void onPublishRecordDwg(Model.TreeModel model) { var dwg = JsonConvert.DeserializeObject(model.NodeExtData.ToString()); - Prism.Dialogs.DialogParameters x = new Prism.Dialogs.DialogParameters(); + IDialogParameters x = new Prism.Services.Dialogs.DialogParameters(); x.Add(GlobalObject.dialogPar.info.ToString(), dwg); var _dialogService = GlobalObject._prismContainer.Resolve(); _dialogService.ShowDialog(nameof(DialogPublishRecord), x, (RES) => @@ -1464,10 +1497,10 @@ namespace SWS.CAD.ViewModels /// 操作记录 /// /// 图纸 - private void onOperateRecordDwg(TreeModel model) + private void onOperateRecordDwg(Model.TreeModel model) { var dwg = JsonConvert.DeserializeObject(model.NodeExtData.ToString()); - Prism.Dialogs.DialogParameters x = new Prism.Dialogs.DialogParameters(); + IDialogParameters x = new Prism.Services.Dialogs.DialogParameters(); x.Add(GlobalObject.dialogPar.info.ToString(), dwg); var _dialogService = GlobalObject._prismContainer.Resolve(); _dialogService.ShowDialog(nameof(DialogOperateRecord), x, (RES) => @@ -1477,7 +1510,7 @@ namespace SWS.CAD.ViewModels #endregion #region 获取并显示图元列表 - private ObservableCollection ListTagNumber = new ObservableCollection(); + private ObservableCollection ListTagNumber = new ObservableCollection(); /// /// 获取并显示图元列表 /// @@ -1534,7 +1567,7 @@ namespace SWS.CAD.ViewModels { continue; } if (ListTagNumber.FirstOrDefault(a => a.Key == item.TagNumber) != null) { continue; } - ListTagNumber.Add(new KeyValueModel() { Key = item.TagNumber, Value = item.EngineDataID }); + ListTagNumber.Add(new Model.KeyValueModel() { Key = item.TagNumber, Value = item.EngineDataID }); } } #endregion @@ -1551,61 +1584,61 @@ namespace SWS.CAD.ViewModels /// 选中的设计浏览树节点 /// /// 图纸 - private async void onDesignSelectedChange(TreeModel treeModel) + private async void onDesignSelectedChange(TreeModel reeModel) { - selectDesign = await InitDesignChildren(treeModel); + selectDesign = await InitDesignChildren(reeModel); //OnPropertyChanged(nameof(selectDesign)); } /// /// 获取对象类型下的所有现有位号清单(仅有位号) /// - /// + /// /// - private async Task InitDesignChildren(TreeModel treeModel) + private async Task InitDesignChildren(TreeModel TreeModel) { - if (treeModel == null) { return null; } - if (treeModel.ChildNodes.Count <= 0) + if (TreeModel == null) { return null; } + if (TreeModel.ChildNodes.Count <= 0) { - if (treeModel.NodeType == "91") + if (TreeModel.NodeType == "91") { - var pixel = JsonConvert.DeserializeObject(treeModel.NodeExtData.ToString()); + var pixel = JsonConvert.DeserializeObject(TreeModel.NodeExtData.ToString()); var dwgObj = await _dwgService.GetDrawingFile(pixel.DrawingFileID); //获取属性 eventAggregator.GetEvent().Publish(dwgObj); - return treeModel; + return TreeModel; } - else if (treeModel.NodeType == "9") + else if (TreeModel.NodeType == "9") { //获取位号的pixel对象 - var list = await _enginedataService.GetTagPixelsById(treeModel.ID); + var list = await _enginedataService.GetTagPixelsById(TreeModel.ID); if (list.Any()) { - ObservableCollection listTree = new ObservableCollection(); + ObservableCollection listTree = new ObservableCollection(); foreach (var item in list) { - var node = new TreeModel(); + var node = new Model.TreeModel(); node.ID = item.DrawingFileID; node.Text = item.DrawingFileName; node.ToolTipText = item.DrawingFileName; node.NodeType = "91"; //node.Glyph = ""; node.FontColor = new SolidColorBrush(Colors.DeepSkyBlue); //图纸名称字体颜色:蓝色 - node.ChildNodes = new ObservableCollection(); + node.ChildNodes = new ObservableCollection(); var dwgFile = await _dwgService.GetDrawingFile(item.DrawingFileID); UpdateNode(node, dwgFile); node.NodeExtData = JsonConvert.SerializeObject(item); listTree.Add(node); } - treeModel.ChildNodes = new ObservableCollection(listTree); - treeModel.isexpand = true; + TreeModel.ChildNodes = new ObservableCollection(listTree); + TreeModel.isexpand = true; } //获取属性 - eventAggregator.GetEvent().Publish(treeModel); + eventAggregator.GetEvent().Publish(TreeModel); } else { - var list = await objectTypeService.GetTagNumberById_Brief(treeModel.ID); + var list = await objectTypeService.GetTagNumberById_Brief(TreeModel.ID); if (list.Any()) { foreach (var item in list) @@ -1613,22 +1646,22 @@ namespace SWS.CAD.ViewModels item.NodeType = "9"; item.Glyph = ""; item.FontColor = new SolidColorBrush(Colors.DeepSkyBlue); //图纸名称字体颜色:蓝色 - item.ChildNodes = new ObservableCollection(); + item.ChildNodes = new ObservableCollection(); } - treeModel.ChildNodes = new ObservableCollection(list); - treeModel.isexpand = true; + TreeModel.ChildNodes = new ObservableCollection(list); + TreeModel.isexpand = true; } //获取属性 - eventAggregator.GetEvent().Publish(treeModel); + eventAggregator.GetEvent().Publish(TreeModel); } } else { //获取属性 - eventAggregator.GetEvent().Publish(treeModel); + eventAggregator.GetEvent().Publish(TreeModel); } - return treeModel; + return TreeModel; } #endregion @@ -1637,7 +1670,7 @@ namespace SWS.CAD.ViewModels /// 双击设计浏览树的图纸节点 /// /// - private async void onDesignDoubleClick(TreeModel model) + private async void onDesignDoubleClick(Model.TreeModel model) { if (model == null) return; if (model.NodeType != "91") return; @@ -1770,7 +1803,7 @@ namespace SWS.CAD.ViewModels /// /// 图纸选中元素,获取属性 /// - private void InitDrawingSelectedAdd(TreeModel dwgObj, bool isReadOnly = false) + private void InitDrawingSelectedAdd(Model.TreeModel dwgObj, bool isReadOnly = false) { //GlobalObject.drawingFileId = dwgObj.DrawingFileID; var doc = Application.DocumentManager.MdiActiveDocument; @@ -1927,29 +1960,29 @@ namespace SWS.CAD.ViewModels //FilterHistoryZero(historyDrawings); #region 历史树2 - historyDrawings = new ObservableCollection(); - for (int i = 0; i < GlobalObject.DwgStage().Count; i++) + historyDrawings = new ObservableCollection(); + for (int i = 0; i < GlobalObje.DwgStage().Count; i++) { - var stage = GlobalObject.DwgStage()[i]; - historyDrawings.Add(new TreeModel() { ID = i.ToString(), Text = stage.DataItemName, NodeType = "0", ChildNodes = new ObservableCollection() }); + var stage = GlobalObje.DwgStage()[i]; + historyDrawings.Add(new Model.TreeModel() { ID = i.ToString(), Text = stage.DataItemName, NodeType = "0", ChildNodes = new ObservableCollection() }); } foreach (var item in listHistory) { var stageNode = historyDrawings.FirstOrDefault(a => a.Text == item.FileVersion); if (stageNode != null) { - TreeModel node = null; + Model.TreeModel node = null; foreach (var dto in historyDrawingsTree) { //获取节点下的图纸 - node = TreeHelper.GetTreeModel(dto, item.DrawingFileID); + node = Helper.TreeHelper.GetTreeModel(dto, item.DrawingFileID); if (node != null) { break; } } if (node == null) { continue; } - var model = new TreeModel() + var model = new Model.TreeModel() { ID = item.DrawingFileID, Text = node.Text, @@ -1971,7 +2004,7 @@ namespace SWS.CAD.ViewModels /// /// 完整的节点 /// - private ObservableCollection FilterHistoryTree(ObservableCollection nodes, List listHistory) + private ObservableCollection FilterHistoryTree(ObservableCollection nodes, List listHistory) { foreach (var node in nodes) { @@ -1981,11 +2014,11 @@ namespace SWS.CAD.ViewModels if (list.Any()) { if (node.ChildNodes == null) - { node.ChildNodes = new ObservableCollection(); } + { node.ChildNodes = new ObservableCollection(); } foreach (var item in list) { var name = node.Text.Replace(".dwg", ""); - var model = new TreeModel() + var model = new Model.TreeModel() { ID = item.DrawingFileID, Text = $"{name}({item.FileVersion}).dwg", @@ -2013,7 +2046,7 @@ namespace SWS.CAD.ViewModels /// /// 完整的节点 /// - private ObservableCollection FilterHistoryTreeDwgZero(ObservableCollection nodes) + private ObservableCollection FilterHistoryTreeDwgZero(ObservableCollection nodes) { if (nodes == null) { return null; } @@ -2022,7 +2055,7 @@ namespace SWS.CAD.ViewModels var list = node.ChildNodes; if (list != null && list.Any()) { - ObservableCollection listRemove = new ObservableCollection(); + ObservableCollection listRemove = new ObservableCollection(); foreach (var item in list) { if (item.NodeType == "-1") @@ -2044,7 +2077,7 @@ namespace SWS.CAD.ViewModels /// /// 完整的节点 /// - private ObservableCollection FilterHistoryTreeFolderZero(ObservableCollection nodes) + private ObservableCollection FilterHistoryTreeFolderZero(ObservableCollection nodes) { if (nodes == null) { return null; } @@ -2053,7 +2086,7 @@ namespace SWS.CAD.ViewModels FilterHistoryTreeFolderZero(node.ChildNodes); if ((node.ChildNodes == null || !node.ChildNodes.Any()) && node.NodeType != "99") { node.NodeType = "-1"; } - ObservableCollection listRemove = new ObservableCollection(); + ObservableCollection listRemove = new ObservableCollection(); var list = node.ChildNodes; if (list != null && list.Any()) { @@ -2078,11 +2111,11 @@ namespace SWS.CAD.ViewModels /// 过滤没有下级历史图纸的节点 /// /// - private void FilterHistoryZero(ObservableCollection nodes) + private void FilterHistoryZero(ObservableCollection nodes) { FilterHistoryTreeDwgZero(nodes); FilterHistoryTreeFolderZero(nodes); - ObservableCollection listRemove = new ObservableCollection(); + ObservableCollection listRemove = new ObservableCollection(); foreach (var item in nodes) { @@ -2101,7 +2134,7 @@ namespace SWS.CAD.ViewModels /// 只读打开历史版次图纸 /// /// 图纸 - private async void onReadOnlyOpenDwg(TreeModel model) + private async void onReadOnlyOpenDwg(Model.TreeModel model) { #region 下载文件,只读打开 string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(), model.Text); @@ -2140,7 +2173,7 @@ namespace SWS.CAD.ViewModels /// 刷新历史版次图纸树 /// /// 图纸 - private void onRefreshHistoryDwg(TreeModel model) + private void onRefreshHistoryDwg(Model.TreeModel model) { InitHistoryDrawings(); } @@ -2170,7 +2203,7 @@ namespace SWS.CAD.ViewModels if (dwgFile == null) { return; } - Prism.Dialogs.DialogParameters x = new Prism.Dialogs.DialogParameters(); + IDialogParameters x = new Prism.Services.Dialogs.DialogParameters(); x.Add(GlobalObject.dialogPar.info.ToString(), ListTagNumber); x.Add(GlobalObject.dialogPar.id.ToString(), selectType.ID); var _dialogService = GlobalObject._prismContainer.Resolve(); @@ -2250,8 +2283,8 @@ namespace SWS.CAD.ViewModels if (string.IsNullOrEmpty(strRecentObjectType)) { //获取节点 - TreeModel node = TreeHelper.GetTreeModel(GlobalObject.objectTypeTree, selectType.ID); - var addNode = (TreeModel)node.Clone(); + Model.TreeModel node = Helper.TreeHelper.GetTreeModel(GlobalObject.objectTypeTree, selectType.ID); + var addNode = (Model.TreeModel)node.Clone(); var firstNode = objectTypeTree[0]; //UI添加到最近使用 firstNode.ChildNodes.Insert(0, addNode); @@ -2269,15 +2302,15 @@ namespace SWS.CAD.ViewModels listObjectTypeId.Remove(listObjectTypeId.Last()); firstNode.ChildNodes.Remove(firstNode.ChildNodes.Last()); } - listObjectTypeId.Insert(0,selectType.ID); + listObjectTypeId.Insert(0, selectType.ID); //获取节点 - TreeModel node = TreeHelper.GetTreeModel(GlobalObject.objectTypeTree, selectType.ID); - var addNode = (TreeModel)node.Clone(); + Model.TreeModel node = Helper.TreeHelper.GetTreeModel(GlobalObject.objectTypeTree, selectType.ID); + var addNode = (Model.TreeModel)node.Clone(); firstNode.ChildNodes.Insert(0, addNode);//UI添加到最近使用 ids = string.Join(",", listObjectTypeId); } //保存最近使用id到本地文件里 - _configService.Save("Project"+GlobalObject.curProject.ProjectId,nameof(ConfigIni.RecentObjectType), ids); + _configService.Save("Project" + GlobalObject.curProject.ProjectId, nameof(ConfigIni.RecentObjectType), ids); } #endregion @@ -2286,10 +2319,10 @@ namespace SWS.CAD.ViewModels /// 编辑目录属性 /// /// 图纸 - private void onEditDrawingCatalogue(TreeModel model) + private void onEditDrawingCatalogue(Model.TreeModel model) { var oldName = model.Text; - Prism.Dialogs.DialogParameters x = new Prism.Dialogs.DialogParameters(); + IDialogParameters x = new Prism.Services.Dialogs.DialogParameters(); x.Add(GlobalObject.dialogPar.id.ToString(), model.ID); var _dialogService = GlobalObject._prismContainer.Resolve(); _dialogService.ShowDialog(nameof(DialogDrawingCatalogue), x, (RES) => @@ -2328,7 +2361,7 @@ namespace SWS.CAD.ViewModels MessageBox.Show("请在系统打开的图纸上操作!"); return; } - Prism.Dialogs.DialogParameters x = new Prism.Dialogs.DialogParameters(); + IDialogParameters x = new Prism.Services.Dialogs.DialogParameters(); x.Add(GlobalObject.dialogPar.info.ToString(), ListTagNumber); x.Add(GlobalObject.dialogPar.id.ToString(), selectType.ID); var _dialogService = GlobalObject._prismContainer.Resolve(); @@ -2363,7 +2396,7 @@ namespace SWS.CAD.ViewModels { EngineDataPropertyID = dto.PropertyID, PropertyName = dto.PropertyName, - PropertyNameEN = dto.PropertyNameEN, + PropertyNameEN = dto.PropertyNameEN, PropertyValue = dto.DefaultValue, MeasuringUnit = dto.MeasuringUnitTypeName, PropertyGID = dto.PropertyGID, @@ -2391,10 +2424,10 @@ namespace SWS.CAD.ViewModels { MessageBox.Show("保存图元属性至图纸异常:" + msg); } - else + else { General.SetXdata(listHandles, tagNumber);//对空XData进行设置XData - General.SendMessage($"图元:{string.Join(",",listHandles)},成功转【{selectType.Text}】对象"); + General.SendMessage($"图元:{string.Join(",", listHandles)},成功转【{selectType.Text}】对象"); } isObjectTypeGuanlian = false; #endregion diff --git a/newFront/c#前端/SWS.CAD/ViewModels/LoginViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/LoginViewModel.cs index caca277e..70478749 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/LoginViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/LoginViewModel.cs @@ -1,28 +1,13 @@ using Bricscad.ApplicationServices; -using Bricscad.Windows; -using Bricscad.EditorInput; -using SWS.CAD.Services; using SWS.CAD.ViewModels.myViewModelBase; -using System; -using System.Windows.Input; -using Teigha.Runtime; using Telerik.Windows.Controls; -using System.IO; using SWS.CAD.CADFunc.Editor; using SWS.CAD.Views; -using System.ComponentModel; using Unity; using Prism.Events; -using SWS.CAD.Event; -using System.Diagnostics; -using SWS.CAD.Models.NoEntity; -using SWS.CAD.Helper; -using Teigha.GraphicsInterface; -using System.Linq; -using Prism.Dialogs; -using SWS.CAD.Models; -using Teigha.GraphicsSystem; -using System.Collections.Generic; +using SWS.Commons; +using SWS.Service; +using SWS.Model; namespace SWS.CAD.ViewModels { @@ -93,8 +78,8 @@ namespace SWS.CAD.ViewModels _configService = configService; this.eventAggregator1 = eventAggregator; - UserName = _configService.Read(nameof(SWS.CAD.Models.NoEntity.ConfigIni.UserName)); - sPASSWORD = _configService.Read(nameof(SWS.CAD.Models.NoEntity.ConfigIni.UserPs)); + UserName = _configService.Read(nameof(ConfigIni.UserName)); + sPASSWORD = _configService.Read(nameof(ConfigIni.UserPs)); if (string.IsNullOrEmpty(sPASSWORD)) { rememberPs = false; @@ -130,14 +115,14 @@ namespace SWS.CAD.ViewModels { EditorHelper.WriteInfo("登陆成功!"); - _configService.Save(nameof(SWS.CAD.Models.NoEntity.ConfigIni.UserName), UserName); + _configService.Save(nameof(ConfigIni.UserName), UserName); if (rememberPs) { - _configService.Save(nameof(SWS.CAD.Models.NoEntity.ConfigIni.UserPs), Userpass); + _configService.Save(nameof(ConfigIni.UserPs), Userpass); } else { - _configService.Save(nameof(SWS.CAD.Models.NoEntity.ConfigIni.UserPs), ""); + _configService.Save(nameof(ConfigIni.UserPs), ""); } #region 拿一些全局的东西 diff --git a/newFront/c#前端/SWS.CAD/ViewModels/NewDrawingViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/NewDrawingViewModel.cs index cd3ce906..72fc86f9 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/NewDrawingViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/NewDrawingViewModel.cs @@ -1,23 +1,13 @@ -using Newtonsoft.Json.Linq; -using Prism.Dialogs; -using Prism.Events; -using SWS.CAD.CADFunc.Editor; -using SWS.CAD.Event; -using SWS.CAD.Helper; -using SWS.CAD.Models; -using SWS.CAD.Services; +using Prism.Services.Dialogs; using SWS.CAD.ViewModels.myViewModelBase; +using SWS.Commons; +using SWS.Model; +using SWS.Service; using System; -using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows; -using System.Xml.Linq; -using Teigha.DatabaseServices; -using Teigha.GraphicsSystem; using Unity; namespace SWS.CAD.ViewModels @@ -25,11 +15,11 @@ namespace SWS.CAD.ViewModels public class NewDrawingViewModel : DialogBase, IDialogAware { #region 数据绑定 - private ObservableCollection _templates; + private ObservableCollection _templates; /// /// 图纸模板 /// - public ObservableCollection templates + public ObservableCollection templates { get { return _templates; } set @@ -38,11 +28,11 @@ namespace SWS.CAD.ViewModels } } - private ObservableCollection _dwgType; + private ObservableCollection _dwgType; /// /// 图纸类型 /// - public ObservableCollection dwgType + public ObservableCollection dwgType { get { return _dwgType; } set { _dwgType = value; RaisePropertyChanged(nameof(dwgType)); } @@ -57,78 +47,78 @@ namespace SWS.CAD.ViewModels set { _dwgObj = value; RaisePropertyChanged(nameof(dwgObj)); } } - private ObservableCollection _dwgMaterialRange; + private ObservableCollection _dwgMaterialRange; /// /// 材料范围 /// - public ObservableCollection dwgMaterialRange + public ObservableCollection dwgMaterialRange { get { return _dwgMaterialRange; } set { _dwgMaterialRange = value; RaisePropertyChanged(nameof(dwgMaterialRange)); } } - private ObservableCollection _dwgMaterialCensus; + private ObservableCollection _dwgMaterialCensus; /// /// 统计方式 /// - public ObservableCollection dwgMaterialCensus + public ObservableCollection dwgMaterialCensus { get { return _dwgMaterialCensus; } set { _dwgMaterialCensus = value; RaisePropertyChanged(nameof(dwgMaterialCensus)); } } - private ObservableCollection _dwgStage; + private ObservableCollection _dwgStage; /// /// 设计阶段 /// - public ObservableCollection dwgStage + public ObservableCollection dwgStage { get { return _dwgStage; } set { _dwgStage = value; RaisePropertyChanged(nameof(dwgStage)); } } - private ObservableCollection _dwgSystem; + private ObservableCollection _dwgSystem; /// /// 所属系统 /// - public ObservableCollection dwgSystem + public ObservableCollection dwgSystem { get { return _dwgSystem; } set { _dwgSystem = value; RaisePropertyChanged(nameof(dwgSystem)); } } - private ObservableCollection _dwgCatalogueID; + private ObservableCollection _dwgCatalogueID; /// /// 图纸目录树,不带图纸文件名,纯目录树 /// - public ObservableCollection dwgCatalogueID + public ObservableCollection dwgCatalogueID { get { return _dwgCatalogueID; } set { _dwgCatalogueID = value; RaisePropertyChanged(nameof(dwgCatalogueID)); } } - private ObservableCollection _tempCatalogueID; + private ObservableCollection _tempCatalogueID; /// /// 图纸目录树,带图纸文件名,用于新建图纸时,遍历判断目录下图纸是否有文件重名 /// - public ObservableCollection tempCatalogueID + public ObservableCollection tempCatalogueID { get { return _tempCatalogueID; } set { _tempCatalogueID = value; } } - private TreeModel _SelectedSystemItem; + private Model.TreeModel _SelectedSystemItem; /// /// 所属系统选中项 /// - public TreeModel SelectedSystemItem + public Model.TreeModel SelectedSystemItem { get { return _SelectedSystemItem; } set { _SelectedSystemItem = value; RaisePropertyChanged(nameof(SelectedSystemItem)); } } - private TreeModel _SelectedTemplateItem; + private Model.TreeModel _SelectedTemplateItem; /// /// 图纸模板选中项 /// - public TreeModel SelectedTemplateItem + public Model.TreeModel SelectedTemplateItem { get { return _SelectedTemplateItem; } set @@ -139,11 +129,11 @@ namespace SWS.CAD.ViewModels RaisePropertyChanged(nameof(SelectedTemplateItem)); } } - private TreeModel _SelectedCatalogueIDItem; + private Model.TreeModel _SelectedCatalogueIDItem; /// /// 图纸目录选中项 /// - public TreeModel SelectedCatalogueIDItem + public Model.TreeModel SelectedCatalogueIDItem { get { return _SelectedCatalogueIDItem; } set { _SelectedCatalogueIDItem = value; RaisePropertyChanged(nameof(SelectedCatalogueIDItem)); } @@ -162,24 +152,25 @@ namespace SWS.CAD.ViewModels DrawingServce _drawingServce; AnnexesService _annexesService; TemplateFileService _templateFileService; - TreeModel curTreeNode = null; + Model.TreeModel curTreeNode = null; string oldDwgFileName = string.Empty; /// /// 窗体模式 0:新建图纸,1:编辑属性 /// int mode = 0; - public DialogCloseListener RequestClose { get; } + public string Title => ""; + public event Action RequestClose; public NewDrawingViewModel() : base() { _drawingServce = GlobalObject.container.Resolve(); // 不要在构造函数里注入,免得报 No parameterless constructor defined for this object _annexesService = GlobalObject.container.Resolve(); _templateFileService = GlobalObject.container.Resolve(); dwgObj = new ec_drawing_file(); - templates = new ObservableCollection(); - dwgCatalogueID = new ObservableCollection(); - dwgMaterialRange = new ObservableCollection(); - dwgMaterialCensus = new ObservableCollection(); - dwgStage = new ObservableCollection(); + templates = new ObservableCollection(); + dwgCatalogueID = new ObservableCollection(); + dwgMaterialRange = new ObservableCollection(); + dwgMaterialCensus = new ObservableCollection(); + dwgStage = new ObservableCollection(); } @@ -209,22 +200,22 @@ namespace SWS.CAD.ViewModels public async void OnDialogOpened(IDialogParameters parameters) { IsBusy=true;BusyContent = "加载中..."; - curTreeNode = parameters.GetValue(nameof(ec_drawing_file.DrawingCatalogueID)); + curTreeNode = parameters.GetValue(nameof(ec_drawing_file.DrawingCatalogueID)); //初始化图纸目录树形下拉框 dwgCatalogueID = await _drawingServce.GetDrawingCatalogue("1");//参数给1,server返回的时候默认就没有.dwg的目录树了 tempCatalogueID = await _drawingServce.GetDrawingCatalogue(); //返回带.dwg文件的目录树,方便后续校验是否文件重名 //初始化图纸类型下拉框 - dwgType = new ObservableCollection(GlobalObject.DwgType()); + dwgType = new ObservableCollection(GlobalObje.DwgType()); //初始化材料范围下拉框 - dwgMaterialRange = new ObservableCollection(GlobalObject.DwgMaterialRange()); + dwgMaterialRange = new ObservableCollection(GlobalObje.DwgMaterialRange()); //初始化材料统计下拉框 - dwgMaterialCensus = new ObservableCollection(GlobalObject.DwgMaterialCensus()); + dwgMaterialCensus = new ObservableCollection(GlobalObje.DwgMaterialCensus()); //初始化设计阶段下拉框 - dwgStage = new ObservableCollection(GlobalObject.DwgStage()); + dwgStage = new ObservableCollection(GlobalObje.DwgStage()); //初始化所属系统下拉框 - dwgSystem = new ObservableCollection(GlobalObject.DwgSystem()); + dwgSystem = new ObservableCollection(GlobalObje.DwgSystem()); //判断窗体是新建图纸或编辑属性 if (curTreeNode.Text.ToLower().EndsWith(".dwg")) { @@ -249,7 +240,7 @@ namespace SWS.CAD.ViewModels //初始化图纸模板树形下拉框 var allTemplates = await _templateFileService.GetTemplateCatalogue(); allTemplates = allTemplates.Where(x => x.Text == GlobalObject.templateForDrawing).ToList(); - templates = new ObservableCollection(allTemplates); + templates = new ObservableCollection(allTemplates); } IsBusy = false; BusyContent = ""; OnPropertyChanged(nameof(dwgObj)); @@ -263,7 +254,7 @@ namespace SWS.CAD.ViewModels //所属系统下拉框 foreach (var item in dwgSystem) { - var node = TreeHelper.GetTreeModel(item, dwgFile.DrawingSystem); + var node = Helper.TreeHelper.GetTreeModel(item, dwgFile.DrawingSystem); if (node != null) { SelectedSystemItem = node; @@ -273,7 +264,7 @@ namespace SWS.CAD.ViewModels //图纸目录下拉框 foreach (var item in dwgCatalogueID) { - var node = TreeHelper.GetTreeModel(item, dwgFile.DrawingCatalogueID); + var node = Helper.TreeHelper.GetTreeModel(item, dwgFile.DrawingCatalogueID); if (node != null) { SelectedCatalogueIDItem = node; @@ -397,7 +388,8 @@ namespace SWS.CAD.ViewModels MessageBox.Show($"本地图纸文件:{dwgObj.DrawingFileName} 打开失败,信息:{msg}"); return; } - RequestClose.Invoke(ButtonResult.OK); + DialogResult res = new DialogResult(ButtonResult.OK); + RequestClose.Invoke(res); } #endregion @@ -433,7 +425,8 @@ namespace SWS.CAD.ViewModels File.Move(oldFilePath, newFilePath);//本地图纸重命名 } } - RequestClose.Invoke(ButtonResult.OK); + DialogResult res = new DialogResult(ButtonResult.OK); + RequestClose.Invoke(res); #endregion } } @@ -445,9 +438,9 @@ namespace SWS.CAD.ViewModels /// /// 完整的节点 /// - private ObservableCollection FilterTree(ObservableCollection nodes, string text) + private ObservableCollection FilterTree(ObservableCollection nodes, string text) { - ObservableCollection result = new ObservableCollection(); + ObservableCollection result = new ObservableCollection(); foreach (var node in nodes.Where(X => !X.Text.Contains("设计说明") && !X.Text.Contains("材料表"))) { @@ -457,7 +450,7 @@ namespace SWS.CAD.ViewModels // 如果节点匹配,或者它有匹配的子节点,添加当前节点到结果 if (!node.Text.ToUpper().EndsWith(text.ToUpper())) { - result.Add(new TreeModel + result.Add(new Model.TreeModel { ID = node.ID, Text = node.Text, @@ -475,15 +468,15 @@ namespace SWS.CAD.ViewModels /// /// /// - private bool CheckDwgName(TreeModel dwgNode, string name) + private bool CheckDwgName(Model.TreeModel dwgNode, string name) { if (tempCatalogueID == null) { return false; } - TreeModel node = null; + Model.TreeModel node = null; foreach (var catalogueId in tempCatalogueID) { //遍历获取当前节点数据 - node = TreeHelper.GetTreeModel(catalogueId, dwgNode.ID); + node = Helper.TreeHelper.GetTreeModel(catalogueId, dwgNode.ID); if (node != null) { break; } } diff --git a/newFront/c#前端/SWS.CAD/ViewModels/ProjectViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/ProjectViewModel.cs index f5867ed1..89b6459b 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/ProjectViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/ProjectViewModel.cs @@ -1,14 +1,12 @@ using Bricscad.ApplicationServices; -using Prism.Dialogs; using Prism.Events; using SWS.CAD.CADFunc.Editor; using SWS.CAD.Event; -using SWS.CAD.Helper; -using SWS.CAD.Models; -using SWS.CAD.Models.NoEntity; -using SWS.CAD.Services; using SWS.CAD.ViewModels.myViewModelBase; using SWS.CAD.Views; +using SWS.Commons; +using SWS.Model; +using SWS.Service; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; diff --git a/newFront/c#前端/SWS.CAD/ViewModels/RightPanelViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/RightPanelViewModel.cs index 1890a805..e315e341 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/RightPanelViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/RightPanelViewModel.cs @@ -1,37 +1,22 @@ -using Aspose.Cells.Tables; -using Bricscad.ApplicationServices; +using Bricscad.ApplicationServices; using Bricscad.EditorInput; -using Newtonsoft.Json; -using Prism.Dialogs; using Prism.Events; using Prism.Ioc; +using Prism.Services.Dialogs; using SWS.CAD.CADFunc; using SWS.CAD.Event; -using SWS.CAD.Helper; -using SWS.CAD.Models; -using SWS.CAD.Models.NoEntity; -using SWS.CAD.Services; using SWS.CAD.Views; -using SWS.CAD.Views.CustomControl; +using SWS.Commons; +using SWS.Model; +using SWS.Service; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; -using System.Data; -using System.Drawing; using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows; -using System.Windows.Controls; -using System.Windows.Forms; using System.Windows.Input; -using System.Windows.Markup; using System.Windows.Media; -using System.Windows.Threading; -using System.Xml.Linq; -using Teigha.DatabaseServices; -using Teigha.GraphicsSystem; using Telerik.Windows.Controls; using Unity; using AttributeCollection = System.ComponentModel.AttributeCollection; @@ -568,7 +553,7 @@ namespace SWS.CAD.ViewModels /// 左边列表选中元件类型,右边出现对应属性,左下方出现图元列表 /// /// - private async void onTypeChange(TreeModel node) + private async void onTypeChange(Model.TreeModel node) { if (node != null) { @@ -690,7 +675,7 @@ namespace SWS.CAD.ViewModels /// 左边列表选中Tag类型,右边出现对应属性 /// /// - private async void onTagChange(TreeModel node) + private async void onTagChange(Model.TreeModel node) { if (node != null) { @@ -722,7 +707,7 @@ namespace SWS.CAD.ViewModels /// 左边列表选中图纸,右边出现图纸对应属性 /// /// - private void onDrawingChange(ec_drawing_file dwgObj) + private void onDrawingChange(SWS.Model.ec_drawing_file dwgObj) { if (dwgObj != null) { @@ -806,7 +791,7 @@ namespace SWS.CAD.ViewModels /// /// /// 是否属性值改变后,返回事件更新到服务器 - private void ShowProperty(ec_objecttype item, bool isReturnChanged = false) + private void ShowProperty(SWS.Model.ec_objecttype item, bool isReturnChanged = false) { var listBasic = new ObservableCollection(); listEnginedata.Clear(); @@ -925,7 +910,7 @@ namespace SWS.CAD.ViewModels /// private async void onPropertyChange(propertyModel model) { - ec_enginedata dto = null; + SWS.Model.ec_enginedata dto = null; string strOldValue = ""; string strOldUnit = ""; if (SelectObject == null) @@ -949,7 +934,7 @@ namespace SWS.CAD.ViewModels } if (dto != null && (strOldValue != model.PropertyValue || strOldUnit != model.Unit)) { - var flag = await _objectTypeService.UpdatePixelAndPropBatch(new List() { dto }); + var flag = await _objectTypeService.UpdatePixelAndPropBatch(new List() { dto }); string strUnit = string.IsNullOrEmpty(model.Unit) ? "" : $",单位:{model.Unit}"; General.SendMessage($"属性:{model.DisplayText},值:{model.PropertyValue} {strUnit} 保存成功!"); @@ -984,7 +969,7 @@ namespace SWS.CAD.ViewModels { return; } if ( string.IsNullOrEmpty(CurrentPropertyName)) { return; } - Prism.Dialogs.DialogParameters x = new Prism.Dialogs.DialogParameters(); + IDialogParameters x = new Prism.Services.Dialogs.DialogParameters(); x.Add(GlobalObject.dialogPar.para1.ToString(), SelectObject.tagNumber); x.Add(GlobalObject.dialogPar.para2.ToString(), CurrentPropertyName); var _dialogService = GlobalObject._prismContainer.Resolve(); diff --git a/newFront/c#前端/SWS.CAD/ViewModels/UserNotificationViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/UserNotificationViewModel.cs index aec7fe92..36336327 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/UserNotificationViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/UserNotificationViewModel.cs @@ -1,11 +1,8 @@ using Newtonsoft.Json.Linq; using Newtonsoft.Json; using Prism.Commands; -using Prism.Dialogs; using Prism.Events; using SWS.CAD.Event; -using SWS.CAD.Models; -using SWS.CAD.Services; using SWS.CAD.ViewModels.myViewModelBase; using SWS.CAD.Views; using System; @@ -19,6 +16,9 @@ using System.Windows.Input; using System.Windows.Media; using Unity; using Teigha.GraphicsInterface; +using SWS.Commons; +using SWS.Model; +using SWS.Service; namespace SWS.CAD.ViewModels { diff --git a/newFront/c#前端/SWS.CAD/ViewModels/myViewModelBase/DialogBase.cs b/newFront/c#前端/SWS.CAD/ViewModels/myViewModelBase/DialogBase.cs index 070c968b..14555b53 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/myViewModelBase/DialogBase.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/myViewModelBase/DialogBase.cs @@ -1,9 +1,10 @@ using System; using System.Windows.Input; using Bricscad.ApplicationServices; -using Prism.Dialogs; using Prism.Ioc; +using Prism.Services.Dialogs; using SWS.CAD.Views; +using SWS.Commons; using Telerik.Windows.Controls; using Unity; diff --git a/newFront/c#前端/SWS.CAD/Views/CustomControl/MultiSelectSearchComboBox/CollectionToStringConverter.cs b/newFront/c#前端/SWS.CAD/Views/CustomControl/MultiSelectSearchComboBox/CollectionToStringConverter.cs index 7a0e386e..3150eb8b 100644 --- a/newFront/c#前端/SWS.CAD/Views/CustomControl/MultiSelectSearchComboBox/CollectionToStringConverter.cs +++ b/newFront/c#前端/SWS.CAD/Views/CustomControl/MultiSelectSearchComboBox/CollectionToStringConverter.cs @@ -1,13 +1,8 @@ using System; -using System.Collections.Generic; using System.Collections.ObjectModel; using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Data; -using SWS.CAD.Models; -using SWS.CAD.ViewModels; +using SWS.Model; namespace SWS.CAD.Views.CustomControl { diff --git a/newFront/c#前端/SWS.CAD/Views/CustomControl/PropertyGrid/LsPropertyGridAttribute.cs b/newFront/c#前端/SWS.CAD/Views/CustomControl/PropertyGrid/LsPropertyGridAttribute.cs index 5a30c4ee..3e984aa9 100644 --- a/newFront/c#前端/SWS.CAD/Views/CustomControl/PropertyGrid/LsPropertyGridAttribute.cs +++ b/newFront/c#前端/SWS.CAD/Views/CustomControl/PropertyGrid/LsPropertyGridAttribute.cs @@ -11,7 +11,7 @@ namespace SWS.CAD.Views.CustomControl /// /// 生成的控件类型 /// - public PROPERTYType TypeName; + public SWS.Model.PROPERTYType TypeName; /// /// 对应的板块 /// @@ -28,7 +28,7 @@ namespace SWS.CAD.Views.CustomControl /// 预留Tag 携带数据对象 /// public object Tag; - public LsPropertyGridAttribute(PROPERTYType type, string plate, string showName, object tag = null) + public LsPropertyGridAttribute(SWS.Model.PROPERTYType type, string plate, string showName, object tag = null) { TypeName = type; Tag = tag; diff --git a/newFront/c#前端/SWS.CAD/Views/CustomControl/PropertyGrid/PropertyGrid.cs b/newFront/c#前端/SWS.CAD/Views/CustomControl/PropertyGrid/PropertyGrid.cs index fe226755..06d435cd 100644 --- a/newFront/c#前端/SWS.CAD/Views/CustomControl/PropertyGrid/PropertyGrid.cs +++ b/newFront/c#前端/SWS.CAD/Views/CustomControl/PropertyGrid/PropertyGrid.cs @@ -4,22 +4,20 @@ using System.Collections.ObjectModel; using System.ComponentModel; using System.Linq; using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; using System.Text.RegularExpressions; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Input; using System.Windows.Media; -using System.Xml.Linq; -using Prism.Dialogs; using Prism.Events; using Prism.Ioc; +using Prism.Services.Dialogs; using SWS.CAD.Event; -using SWS.CAD.Models; -using SWS.CAD.Services; -using SWS.CAD.Views.Dialog; +using SWS.Commons; +using SWS.Model; + + //using Teigha.DatabaseServices; using Teigha.GraphicsInterface; @@ -40,7 +38,7 @@ namespace SWS.CAD.Views.CustomControl /// /// 属性值 /// - public propertyModel Source { get; set; } + public SWS.Model.propertyModel Source { get; set; } /// /// 控件名称 /// @@ -140,7 +138,7 @@ namespace SWS.CAD.Views.CustomControl new PropertyMetadata(default(object), new PropertyChangedCallback((d, e) => { var sender = d as PropertyGrid; - ObservableCollection listPairs = (ObservableCollection)sender.ShowProp; + ObservableCollection listPairs = (ObservableCollection)sender.ShowProp; if (listPairs != null && listPairs.Any()) { sender.Children.Clear(); @@ -204,7 +202,7 @@ namespace SWS.CAD.Views.CustomControl //{ // CreatePropertyControl(sender, model); //} - var listPro = (ObservableCollection)newValue; + var listPro = (ObservableCollection)newValue; //foreach (propertyModel model in listPro) //{ // var isLast = listPro.Last() == model; @@ -239,7 +237,7 @@ namespace SWS.CAD.Views.CustomControl /// /// /// 是否最后一个 - private static void CreatePropertyControl(PropertyGrid sender, propertyModel model, int index, bool isLast) + private static void CreatePropertyControl(PropertyGrid sender, Model.propertyModel model, int index, bool isLast) { //获取编辑的属性特征 LsPropertyGridAttribute attr = new LsPropertyGridAttribute(model.ControlTypeName, model.GroupName, model.DisplayText, model.Item); @@ -281,7 +279,7 @@ namespace SWS.CAD.Views.CustomControl double positionLeft = 5;//距离左边 double positionTop = 10;//距离上 - propertyModel pro = (propertyModel)Source; + Model.propertyModel pro = (Model.propertyModel)Source; if (sender.IsBasicGroup) { attr.Plate = pro.IsBasicGroup ? "常用属性" : "不常用属性"; @@ -378,9 +376,9 @@ namespace SWS.CAD.Views.CustomControl private static void CreateControl(PropertyGrid sender, Grid grid, LsPropertyGridAttribute attr, object obj, int index, bool isLast) { //Control control = new Control(); - propertyModel Source = (propertyModel)obj; + SWS.Model.propertyModel Source = (SWS.Model.propertyModel)obj; string controlName = attr.Plate + index.ToString();// GlobalObject.ControlNameFilterSqcStr(Source.DisplayText); - if (attr.TypeName != PROPERTYType.Size) + if (attr.TypeName != SWS.Model.PROPERTYType.Size) { var row = new RowDefinition(); row.MinHeight = 10; @@ -436,7 +434,7 @@ namespace SWS.CAD.Views.CustomControl switch (attr.TypeName) { - case PROPERTYType.Folder: + case SWS.Model.PROPERTYType.Folder: #region Folder double tbFolderWidth = 100; var btnFolder = new WControls.Button(); @@ -489,11 +487,11 @@ namespace SWS.CAD.Views.CustomControl #endregion return; - case PROPERTYType.BoldItalic: + case SWS.Model.PROPERTYType.BoldItalic: return; - case PROPERTYType.Button: + case SWS.Model.PROPERTYType.Button: break; - case PROPERTYType.TextBox: + case SWS.Model.PROPERTYType.TextBox: var textBox = new WControls.TextBox(); textBox.Name = "txt" + controlName; textBox.Margin = new Thickness(0); @@ -526,7 +524,7 @@ namespace SWS.CAD.Views.CustomControl grid.Children.Add(textBox); break; - case PROPERTYType.Number: + case SWS.Model.PROPERTYType.Number: var txtNumber = new NumericBox(); txtNumber.Name = "txt" + controlName; txtNumber.Margin = new Thickness(0); @@ -561,7 +559,7 @@ namespace SWS.CAD.Views.CustomControl Grid.SetColumn(txtNumber, rightColumm); grid.Children.Add(txtNumber); break; - case PROPERTYType.CheckBox: + case SWS.Model.PROPERTYType.CheckBox: var checkBox = new CheckBox(); checkBox.Style = null; checkBox.Name = "checkBox" + controlName; @@ -592,10 +590,10 @@ namespace SWS.CAD.Views.CustomControl Grid.SetColumn(checkBox, rightColumm); grid.Children.Add(checkBox); break; - case PROPERTYType.Label: + case SWS.Model.PROPERTYType.Label: break; - case PROPERTYType.ComboBox: + case SWS.Model.PROPERTYType.ComboBox: var cbox = new RadComboBox(); cbox.Margin = new Thickness(0); cbox.Height = height - 1; @@ -627,7 +625,7 @@ namespace SWS.CAD.Views.CustomControl cbox.Items.Add(model); } } - cbox.TextBoxStyle = GlobalObject.WhiteStyle; + cbox.TextBoxStyle = GlobalObje.WhiteStyle; cbox.Foreground = new SolidColorBrush(Colors.Blue); cbox.Background = new SolidColorBrush(Color.FromRgb(45, 49, 53)); cbox.IsEditable = true; @@ -643,7 +641,7 @@ namespace SWS.CAD.Views.CustomControl Grid.SetColumn(cbox, rightColumm); grid.Children.Add(cbox); break; - case PROPERTYType.MultiSelectComboBox: + case SWS.Model.PROPERTYType.MultiSelectComboBox: var mscbox = new MultiSelectComboBox(); mscbox.IsEnabled = Source.IsEnable; mscbox.Margin = new Thickness(0); @@ -703,7 +701,7 @@ namespace SWS.CAD.Views.CustomControl var gridsource = btnFolde.Tag as GridSouce; var grid = gridsource.ProGrid; var source = gridsource.Source; - Prism.Dialogs.DialogParameters x = new Prism.Dialogs.DialogParameters(); + IDialogParameters x = new Prism.Services.Dialogs.DialogParameters(); x.Add(GlobalObject.dialogPar.unitTypeId.ToString(), source.UnitTypeId); x.Add(GlobalObject.dialogPar.textYes.ToString(), source.Unit); var _dialogService = GlobalObject._prismContainer.Resolve(); @@ -712,11 +710,11 @@ namespace SWS.CAD.Views.CustomControl if (RES.Result == ButtonResult.Yes) { - var unit = RES.Parameters.GetValue(GlobalObject.dialogPar.unit.ToString()); + var unit = RES.Parameters.GetValue(GlobalObject.dialogPar.unit.ToString()); var controlame = "lbl" + gridsource.ControlName; Label label = null; source.Unit = unit.UnitName; - label = GlobalObject.GetChildObject