diff --git a/BPASmartClient.MessageName/BPASmartClient.MessageName.csproj b/BPASmartClient.MessageName/BPASmartClient.MessageName.csproj deleted file mode 100644 index 87c7214c..00000000 --- a/BPASmartClient.MessageName/BPASmartClient.MessageName.csproj +++ /dev/null @@ -1,17 +0,0 @@ - - - - net6.0-windows - enable - enable - true - true - - - - - - - - - diff --git a/BPASmartClient.MessageName/EnumHelp/DataTypeEnum.cs b/BPASmartClient.MessageName/EnumHelp/DataTypeEnum.cs deleted file mode 100644 index e3b71c21..00000000 --- a/BPASmartClient.MessageName/EnumHelp/DataTypeEnum.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BPASmartClient.MessageName.EnumHelp -{ - /// - /// 数据来源类型 - /// - public enum DataTypeEnum - { - /// - /// POST接口,GET接口 - /// - API接口, - /// - /// 接收主题MQTT数据 - /// - MQTT, - /// - /// Redis拉取数据 - /// - Redis, - /// - /// 本地数据推送 - /// - 本地源, - /// - /// 特定服务推送数据 - /// - 服务推送, - /// - /// 静态数据 - /// - 静态数据 - } -} diff --git a/BPASmartClient.MessageName/EnumHelp/EnumExtensions.cs b/BPASmartClient.MessageName/EnumHelp/EnumExtensions.cs deleted file mode 100644 index 2919834e..00000000 --- a/BPASmartClient.MessageName/EnumHelp/EnumExtensions.cs +++ /dev/null @@ -1,184 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Reflection; -using System.Reflection.Emit; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Controls; - -namespace BPASmartClient.MessageName.EnumHelp -{ - /// - /// 枚举 - /// - public static class EnumExtensions - { - public static int jishu = 0; - /// - /// 根据控件-》创建枚举类型 - /// - /// - public static object CreatEnumType(UIElementCollection list) - { - var currentDomain = AppDomain.CurrentDomain; - var assembly = Assembly.GetExecutingAssembly(); - var assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(assembly!.GetName(), AssemblyBuilderAccess.Run); - var moduleBuilder = assemblyBuilder.DefineDynamicModule(assembly.GetName().Name!); - var em = moduleBuilder.DefineEnum($"Control_{((Convert.ToInt32(jishu) + 1).ToString().PadLeft(4, '0'))}", TypeAttributes.Public, typeof(string)); - foreach (var item in list) - { - if (item is System.Windows.Controls.Control e) - { - if (e.Tag != null) - { - em.DefineLiteral(e.Tag.ToString(), e.Tag.ToString()); - } - } - } - em.DefineLiteral("空", "空"); - Type finished = em.CreateType()!; - return finished; - //foreach (object o in Enum.GetValues(finished)) - //{ - // Console.WriteLine($"{finished}.{o} = {(int)o};"); - //} - } - - - /// - /// 动态创建枚举 - /// - /// 枚举元素列表 - /// 枚举名 - /// Enum枚举 - public static Enum CreateEnum(Dictionary enumDictionary,string enumName = "DefalutEnum") - { - if (enumDictionary == null || enumDictionary.Count <= 0) - return null; - - AppDomain currentDomain = AppDomain.CurrentDomain; - AssemblyName aName = new AssemblyName("TempAssembly"); - AssemblyBuilder ab = AssemblyBuilder.DefineDynamicAssembly(aName,AssemblyBuilderAccess.Run); - ModuleBuilder mb = ab.DefineDynamicModule(aName.Name); - if (string.IsNullOrEmpty(enumName)) - { - enumName = "DefalutEnum"; - } - EnumBuilder eb = mb.DefineEnum(enumName,TypeAttributes.Public,typeof(int)); - - foreach (var item in enumDictionary) - { - eb.DefineLiteral(item.Key,item.Value); - } - - Type finished = eb.CreateType(); - Enum eEnum = Activator.CreateInstance(finished) as Enum; - //foreach (object item in Enum.GetValues(eEnum.GetType())) - //{ - // Debug.LogError(string.Format("{0}.{1} = {2}", finished, item, ((int)item))); - //} - return eEnum; - } - - /// - /// 动态创建枚举 - /// - /// 枚举元素列表 - /// 枚举名 - /// Enum枚举 - public static Enum CreateEnum(List enumList,string enumName = "DefalutEnum") - { - if (enumList == null || enumList.Count <= 0) - return null; - - AppDomain currentDomain = AppDomain.CurrentDomain; - AssemblyName aName = new AssemblyName("TempAssembly"); - AssemblyBuilder ab = AssemblyBuilder.DefineDynamicAssembly(aName,AssemblyBuilderAccess.Run); - ModuleBuilder mb = ab.DefineDynamicModule(aName.Name); - if (string.IsNullOrEmpty(enumName)) - { - enumName = "DefalutEnum"; - } - EnumBuilder eb = mb.DefineEnum(enumName,TypeAttributes.Public,typeof(int)); - - for (int i = 0; i < enumList.Count; i++) - { - eb.DefineLiteral(enumList[i],i); - } - Type finished = eb.CreateType(); - Enum eEnum = Activator.CreateInstance(finished) as Enum; - //foreach (object item in Enum.GetValues(eEnum.GetType())) - //{ - // Debug.LogError(string.Format("{0}.{1} = {2}", finished, item, ((int)item))); - //} - return eEnum; - } - - /// - /// 根据枚举int值获取枚举名称 - /// - /// 枚举类型 - /// 枚举值 - /// - public static string GetEnumName(this int status) - { - return Enum.GetName(typeof(T), status); - } - - /// - /// 根据枚举名称获取枚举值 - /// - public static T ToEnumValue(string name) - { - return (T)Enum.Parse(typeof(T),name); - } - - - /// - /// 获取枚举变量值的 Description 属性 - /// - /// 枚举变量 - /// 如果包含 Description 属性,则返回 Description 属性的值,否则返回枚举变量值的名称 - public static string GetDescription(this Enum obj) - { - return GetDescription(obj, false); - } - - /// - /// 获取枚举变量值的 Description 属性 - /// - /// 枚举变量 - /// 是否改变为返回该类、枚举类型的头 Description 属性,而不是当前的属性或枚举变量值的 Description 属性 - /// 如果包含 Description 属性,则返回 Description 属性的值,否则返回枚举变量值的名称 - public static string GetDescription(this Enum obj, bool isTop) - { - if (obj == null) - { - return string.Empty; - } - Type enumType = obj.GetType(); - DescriptionAttribute dna; - - if (isTop) - { - dna = (DescriptionAttribute)Attribute.GetCustomAttribute(enumType, typeof(DescriptionAttribute)); - } - else - { - FieldInfo fi = enumType.GetField(System.Enum.GetName(enumType, obj)); - dna = (DescriptionAttribute)Attribute.GetCustomAttribute( - fi, typeof(DescriptionAttribute)); - } - if ((dna != null) - && (string.IsNullOrEmpty(dna.Description) == false)) - { - return dna.Description; - } - return obj.ToString(); - } - - - } -} diff --git a/BPASmartClient.MessageName/EnumHelp/InterfaceModeEnum.cs b/BPASmartClient.MessageName/EnumHelp/InterfaceModeEnum.cs deleted file mode 100644 index c6b8e80d..00000000 --- a/BPASmartClient.MessageName/EnumHelp/InterfaceModeEnum.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BPASmartClient.MessageName.EnumHelp -{ - /// - /// 运行状态-枚举 - /// - public enum InterfaceModeEnum - { - POST, - GET, - PUT - } -} diff --git a/BPASmartClient.MessageName/EnumHelp/RunEnum.cs b/BPASmartClient.MessageName/EnumHelp/RunEnum.cs deleted file mode 100644 index 63f10656..00000000 --- a/BPASmartClient.MessageName/EnumHelp/RunEnum.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BPASmartClient.MessageName.EnumHelp -{ - /// - /// 运行状态-枚举 - /// - public enum RunEnum - { - /// - /// 运行(滚动线默认右转) - /// - Run, - /// - /// 运行-左转(滚动线独有) - /// - Run_Left, - /// - /// 停止 - /// - Stop - } - /// - /// 运行状态Model - /// - public class RunEnumModel - { - /// - /// 消息id号:ID号 - /// - public string MessageID { get; set; } - /// - /// 运行状态 - /// - public RunEnum Run { get; set; } - } -} diff --git a/BPASmartClient.MessageName/MessageName.cs b/BPASmartClient.MessageName/MessageName.cs deleted file mode 100644 index eddffd36..00000000 --- a/BPASmartClient.MessageName/MessageName.cs +++ /dev/null @@ -1,119 +0,0 @@ -using System.ComponentModel; -using System.Reflection; -using System.Reflection.Emit; - -namespace BPASmartClient.MessageName -{ - /// - /// 消息名称管理中心---不在使用 - /// 特性:Category,消息分组 - /// Description,消息备注 - /// Browsable,是否使用 - /// 消息发送案例: - /// Class_InnerMessageBus.GetInstance().PostMessage(this, MessageName.xxx, "12321"); - /// 接收数据案例: - /// Class_InnerMessageBus.GetInstance().ListenMessage(this, MessageName.xxx, "xxnameHandler"); - /// public void xxnameHandler(object sender, InnerMessageEventArgs e) { } - /// - //public class MessageName - //{ - // #region XX消息 - // /// - // /// xxx消息 - // /// - // [Category("消息分组"),Description("消息备注"),Browsable(true)] - // public static string xxx = "xxx"; - // #endregion - - - // #region 滚动线消息事件管理中心 - // /// - // /// 滚动线控制滚动消息 - // /// - // [Category("滚动线"), Description("滚动线控制滚动"), Browsable(true)] - // public static string ConveyorBeltIsRun = "ConveyorBeltIsRun"; - // /// - // /// 滚动线控制左转 - // /// - // [Category("滚动线"), Description("滚动线控制左转"), Browsable(true)] - // public static string ConveyorBeltLeft = "ConveyorBeltLeft"; - // /// - // /// 滚动线控制右转 - // /// - // [Category("滚动线"), Description("滚动线控制右转"), Browsable(true)] - // public static string ConveyorBeltRight = "ConveyorBeltRight"; - // /// - // /// 滚动线控制停止 - // /// - // [Category("滚动线"), Description("滚动线控制停止"), Browsable(true)] - // public static string ConveyorBeltStop = "ConveyorBeltStop"; - // #endregion - //} - - /// - /// 消息名称管理中心-枚举 - /// - public enum MessageNameEnum - { - /// - /// 无 - /// - Null, - /// - /// 物料仓运行状态 - /// - SilosRunStatus, - /// - /// 物料仓数据设置 - /// - SilosSetData, - - /// - /// 滚动线运行状态 - /// - ConveyorBeltRunStatus, - - /// - /// 发送消息 - /// - SendMessageName, - /// - /// 接收消息 - /// - ReceiveMessageName, - } - - /// - /// 消息基类 - /// - public class MessageBase - { - /// - /// 消息号 - /// - public string MeaageID { get; set; } - // - /// 消息名称:枚举 - /// - public MessageNameEnum MeaageName { get; set; } - - public MessageBase() - { - MeaageID = GetMessageID.GetID(); - } - } - - /// - /// 四位消息号 - /// - public static class GetMessageID - { - public static int i = 0; - public static string GetID() - { - i++; - return ((Convert.ToInt32(i) + 1).ToString().PadLeft(8, '0')); - } - } - -} \ No newline at end of file diff --git a/BPASmartClient.MessageName/发送消息Model/EventSendMessage.cs b/BPASmartClient.MessageName/发送消息Model/EventSendMessage.cs deleted file mode 100644 index 4453e3ed..00000000 --- a/BPASmartClient.MessageName/发送消息Model/EventSendMessage.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BPASmartClient.MessageName.发送消息Model -{ - /// - /// 事件消息【发送端】Model配置 - /// - public class EventSendMessage: MessageBase - { - /// - /// 控件名称 - /// - public string ControlName { get; set; } - /// - /// 控件标题 - /// - public string ControlTitle { get; set; } - /// - /// 控件触发源 - /// - public object ControlSource { get; set; } - /// - /// 控件状态 - /// - public string ControlStatus { get; set; } - /// - /// 控件类型 - /// - public ControlEventType EventType { get; set; } - - } - /// - /// 控件类型 - /// - public enum ControlEventType - { - /// - /// 单击 - /// - Click, - /// - /// 左键按下 - /// - MouseLeftButtonDown, - /// - /// 文本改变事件 - /// - TextChanged, - /// - /// 选中 - /// - Checked, - /// - /// 取消选中 - /// - Unchecked, - } -} diff --git a/BPASmartClient.MessageName/接收消息Model/EventReceiveMessage.cs b/BPASmartClient.MessageName/接收消息Model/EventReceiveMessage.cs deleted file mode 100644 index 162ded4f..00000000 --- a/BPASmartClient.MessageName/接收消息Model/EventReceiveMessage.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BPASmartClient.MessageName.接收消息Model -{ - /// - /// 事件消息[接收端]Model:配置 - /// - public class EventReceiveMessage:MessageBase - { - ///// - ///// 消息号 - ///// - //public string MeaageID { get; set; } - //// - ///// 消息名称:枚举 - ///// - //public MessageNameEnum MeaageName { get; set; } - /// - /// 空:保留 - /// - public string Value { get; set; } - /// - /// 消息标题:标志控件说明 - /// - public string Title { get; set; } - //public EventReceiveMessage() - //{ - // MeaageID = GetMessageID.GetID(); - //} - } -} diff --git a/BPASmartClient.MessageName/接收消息Model/滚动线/ConveyorBeltMessageModel.cs b/BPASmartClient.MessageName/接收消息Model/滚动线/ConveyorBeltMessageModel.cs deleted file mode 100644 index 25bcd887..00000000 --- a/BPASmartClient.MessageName/接收消息Model/滚动线/ConveyorBeltMessageModel.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BPASmartClient.MessageName.接收消息Model.滚动线 -{ - /// - /// 滚动线数据设置-Model - /// - public class ConveyorBeltMessageModel - { - /// - /// 消息ID号:id 号 - /// - public string MessageID { get; set; } - /// - /// 滚动线:标题 - /// - public string Title { get; set; } - } -} diff --git a/BPASmartClient.MessageName/接收消息Model/物料仓/SilosMessageModel.cs b/BPASmartClient.MessageName/接收消息Model/物料仓/SilosMessageModel.cs deleted file mode 100644 index a6b45d05..00000000 --- a/BPASmartClient.MessageName/接收消息Model/物料仓/SilosMessageModel.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BPASmartClient.MessageName.接收消息Model.物料仓 -{ - /// - /// 物料仓数据设置-Model - /// - public class SilosMessageModel - { - /// - /// 消息ID号:id 号 - /// - public string MessageID { get; set; } - /// - /// 物料仓:标题 - /// - public string Title { get; set; } - /// - /// 物料仓:重量(G) 35.23 - /// - public string Value { get; set; } - /// - /// 物料仓:仓号说明 - /// - public string Text { get; set; } - } -} diff --git a/BeDesignerSCADA/BeDesignerSCADA.csproj b/BeDesignerSCADA/BeDesignerSCADA.csproj index 3346dd8d..33a3ec33 100644 --- a/BeDesignerSCADA/BeDesignerSCADA.csproj +++ b/BeDesignerSCADA/BeDesignerSCADA.csproj @@ -106,9 +106,6 @@ - - - diff --git a/BeDesignerSCADA/Controls/CanvasPanelNew.xaml.cs b/BeDesignerSCADA/Controls/CanvasPanelNew.xaml.cs index 15c618da..274ba5f5 100644 --- a/BeDesignerSCADA/Controls/CanvasPanelNew.xaml.cs +++ b/BeDesignerSCADA/Controls/CanvasPanelNew.xaml.cs @@ -4,7 +4,6 @@ using BeDesignerSCADA.ViewModel; using BPASmart.Model; using BPASmartClient.Compiler; using BPASmartClient.DATABUS; -using BPASmartClient.MessageName; using System; using System.Collections.Generic; using System.ComponentModel; diff --git a/BeDesignerSCADA/Controls/MainCanvasPanel.xaml.cs b/BeDesignerSCADA/Controls/MainCanvasPanel.xaml.cs index a262efad..d3092f43 100644 --- a/BeDesignerSCADA/Controls/MainCanvasPanel.xaml.cs +++ b/BeDesignerSCADA/Controls/MainCanvasPanel.xaml.cs @@ -4,7 +4,6 @@ using BeDesignerSCADA.ViewModel; using BPASmart.Model; using BPASmartClient.Compiler; using BPASmartClient.DATABUS; -using BPASmartClient.MessageName; using System; using System.Collections.Generic; using System.ComponentModel; diff --git a/BeDesignerSCADA/MainWindow.xaml.cs b/BeDesignerSCADA/MainWindow.xaml.cs index d5c5e2cb..416ad0e9 100644 --- a/BeDesignerSCADA/MainWindow.xaml.cs +++ b/BeDesignerSCADA/MainWindow.xaml.cs @@ -3,7 +3,6 @@ using BeDesignerSCADA.ViewModel; using BPASmart.Model; using BPASmartClient.Compiler; using BPASmartClient.DATABUS; -using BPASmartClient.MessageName; using System; using System.Collections.Generic; using System.ComponentModel; diff --git a/BeDesignerSCADA/ViewModel/MainViewModelNew.cs b/BeDesignerSCADA/ViewModel/MainViewModelNew.cs index dd57d6ec..e1879692 100644 --- a/BeDesignerSCADA/ViewModel/MainViewModelNew.cs +++ b/BeDesignerSCADA/ViewModel/MainViewModelNew.cs @@ -4,10 +4,6 @@ using BeDesignerSCADA.View; using BPASmart.Model; using BPASmartClient.Compiler; using BPASmartClient.DATABUS; -using BPASmartClient.MessageName; -using BPASmartClient.MessageName.EnumHelp; -using BPASmartClient.MessageName.发送消息Model; -using BPASmartClient.MessageName.接收消息Model; using BPASmartClient.SCADAControl.Converters; using ICSharpCode.AvalonEdit; using Microsoft.Toolkit.Mvvm.ComponentModel;