fyf пре 2 година
родитељ
комит
130de75a12
15 измењених фајлова са 0 додато и 579 уклоњено
  1. +0
    -17
      BPASmartClient.MessageName/BPASmartClient.MessageName.csproj
  2. +0
    -39
      BPASmartClient.MessageName/EnumHelp/DataTypeEnum.cs
  3. +0
    -184
      BPASmartClient.MessageName/EnumHelp/EnumExtensions.cs
  4. +0
    -18
      BPASmartClient.MessageName/EnumHelp/InterfaceModeEnum.cs
  5. +0
    -41
      BPASmartClient.MessageName/EnumHelp/RunEnum.cs
  6. +0
    -119
      BPASmartClient.MessageName/MessageName.cs
  7. +0
    -62
      BPASmartClient.MessageName/发送消息Model/EventSendMessage.cs
  8. +0
    -35
      BPASmartClient.MessageName/接收消息Model/EventReceiveMessage.cs
  9. +0
    -23
      BPASmartClient.MessageName/接收消息Model/滚动线/ConveyorBeltMessageModel.cs
  10. +0
    -31
      BPASmartClient.MessageName/接收消息Model/物料仓/SilosMessageModel.cs
  11. +0
    -3
      BeDesignerSCADA/BeDesignerSCADA.csproj
  12. +0
    -1
      BeDesignerSCADA/Controls/CanvasPanelNew.xaml.cs
  13. +0
    -1
      BeDesignerSCADA/Controls/MainCanvasPanel.xaml.cs
  14. +0
    -1
      BeDesignerSCADA/MainWindow.xaml.cs
  15. +0
    -4
      BeDesignerSCADA/ViewModel/MainViewModelNew.cs

+ 0
- 17
BPASmartClient.MessageName/BPASmartClient.MessageName.csproj Прегледај датотеку

@@ -1,17 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Reflection" Version="4.3.0" />
<PackageReference Include="System.Reflection.Emit" Version="4.7.0" />
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.7.0" />
</ItemGroup>

</Project>

+ 0
- 39
BPASmartClient.MessageName/EnumHelp/DataTypeEnum.cs Прегледај датотеку

@@ -1,39 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MessageName.EnumHelp
{
/// <summary>
/// 数据来源类型
/// </summary>
public enum DataTypeEnum
{
/// <summary>
/// POST接口,GET接口
/// </summary>
API接口,
/// <summary>
/// 接收主题MQTT数据
/// </summary>
MQTT,
/// <summary>
/// Redis拉取数据
/// </summary>
Redis,
/// <summary>
/// 本地数据推送
/// </summary>
本地源,
/// <summary>
/// 特定服务推送数据
/// </summary>
服务推送,
/// <summary>
/// 静态数据
/// </summary>
静态数据
}
}

+ 0
- 184
BPASmartClient.MessageName/EnumHelp/EnumExtensions.cs Прегледај датотеку

@@ -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
{
/// <summary>
/// 枚举
/// </summary>
public static class EnumExtensions
{
public static int jishu = 0;
/// <summary>
/// 根据控件-》创建枚举类型
/// </summary>
/// <returns></returns>
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};");
//}
}


/// <summary>
/// 动态创建枚举
/// </summary>
/// <param name="enumDictionary">枚举元素列表</param>
/// <param name="enumName">枚举名</param>
/// <returns>Enum枚举</returns>
public static Enum CreateEnum(Dictionary<string,int> 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;
}

/// <summary>
/// 动态创建枚举
/// </summary>
/// <param name="enumDictionary">枚举元素列表</param>
/// <param name="enumName">枚举名</param>
/// <returns>Enum枚举</returns>
public static Enum CreateEnum(List<string> 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;
}

/// <summary>
/// 根据枚举int值获取枚举名称
/// </summary>
/// <typeparam name="T">枚举类型</typeparam>
/// <param name="status">枚举值</param>
/// <returns></returns>
public static string GetEnumName<T>(this int status)
{
return Enum.GetName(typeof(T), status);
}

/// <summary>
/// 根据枚举名称获取枚举值
/// </summary>
public static T ToEnumValue<T>(string name)
{
return (T)Enum.Parse(typeof(T),name);
}


/// <summary>
/// 获取枚举变量值的 Description 属性
/// </summary>
/// <param name="obj">枚举变量</param>
/// <returns>如果包含 Description 属性,则返回 Description 属性的值,否则返回枚举变量值的名称</returns>
public static string GetDescription(this Enum obj)
{
return GetDescription(obj, false);
}

/// <summary>
/// 获取枚举变量值的 Description 属性
/// </summary>
/// <param name="obj">枚举变量</param>
/// <param name="isTop">是否改变为返回该类、枚举类型的头 Description 属性,而不是当前的属性或枚举变量值的 Description 属性</param>
/// <returns>如果包含 Description 属性,则返回 Description 属性的值,否则返回枚举变量值的名称</returns>
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();
}


}
}

+ 0
- 18
BPASmartClient.MessageName/EnumHelp/InterfaceModeEnum.cs Прегледај датотеку

@@ -1,18 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MessageName.EnumHelp
{
/// <summary>
/// 运行状态-枚举
/// </summary>
public enum InterfaceModeEnum
{
POST,
GET,
PUT
}
}

+ 0
- 41
BPASmartClient.MessageName/EnumHelp/RunEnum.cs Прегледај датотеку

@@ -1,41 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MessageName.EnumHelp
{
/// <summary>
/// 运行状态-枚举
/// </summary>
public enum RunEnum
{
/// <summary>
/// 运行(滚动线默认右转)
/// </summary>
Run,
/// <summary>
/// 运行-左转(滚动线独有)
/// </summary>
Run_Left,
/// <summary>
/// 停止
/// </summary>
Stop
}
/// <summary>
/// 运行状态Model
/// </summary>
public class RunEnumModel
{
/// <summary>
/// 消息id号:ID号
/// </summary>
public string MessageID { get; set; }
/// <summary>
/// 运行状态
/// </summary>
public RunEnum Run { get; set; }
}
}

+ 0
- 119
BPASmartClient.MessageName/MessageName.cs Прегледај датотеку

@@ -1,119 +0,0 @@
using System.ComponentModel;
using System.Reflection;
using System.Reflection.Emit;

namespace BPASmartClient.MessageName
{
/// <summary>
/// 消息名称管理中心---不在使用
/// 特性: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) { }
/// </summary>
//public class MessageName
//{
// #region XX消息
// /// <summary>
// /// xxx消息
// /// </summary>
// [Category("消息分组"),Description("消息备注"),Browsable(true)]
// public static string xxx = "xxx";
// #endregion


// #region 滚动线消息事件管理中心
// /// <summary>
// /// 滚动线控制滚动消息
// /// </summary>
// [Category("滚动线"), Description("滚动线控制滚动"), Browsable(true)]
// public static string ConveyorBeltIsRun = "ConveyorBeltIsRun";
// /// <summary>
// /// 滚动线控制左转
// /// </summary>
// [Category("滚动线"), Description("滚动线控制左转"), Browsable(true)]
// public static string ConveyorBeltLeft = "ConveyorBeltLeft";
// /// <summary>
// /// 滚动线控制右转
// /// </summary>
// [Category("滚动线"), Description("滚动线控制右转"), Browsable(true)]
// public static string ConveyorBeltRight = "ConveyorBeltRight";
// /// <summary>
// /// 滚动线控制停止
// /// </summary>
// [Category("滚动线"), Description("滚动线控制停止"), Browsable(true)]
// public static string ConveyorBeltStop = "ConveyorBeltStop";
// #endregion
//}

/// <summary>
/// 消息名称管理中心-枚举
/// </summary>
public enum MessageNameEnum
{
/// <summary>
/// 无
/// </summary>
Null,
/// <summary>
/// 物料仓运行状态
/// </summary>
SilosRunStatus,
/// <summary>
/// 物料仓数据设置
/// </summary>
SilosSetData,

/// <summary>
/// 滚动线运行状态
/// </summary>
ConveyorBeltRunStatus,

/// <summary>
/// 发送消息
/// </summary>
SendMessageName,
/// <summary>
/// 接收消息
/// </summary>
ReceiveMessageName,
}

/// <summary>
/// 消息基类
/// </summary>
public class MessageBase
{
/// <summary>
/// 消息号
/// </summary>
public string MeaageID { get; set; }
// <summary>
/// 消息名称:枚举
/// </summary>
public MessageNameEnum MeaageName { get; set; }

public MessageBase()
{
MeaageID = GetMessageID.GetID();
}
}

/// <summary>
/// 四位消息号
/// </summary>
public static class GetMessageID
{
public static int i = 0;
public static string GetID()
{
i++;
return ((Convert.ToInt32(i) + 1).ToString().PadLeft(8, '0'));
}
}

}

+ 0
- 62
BPASmartClient.MessageName/发送消息Model/EventSendMessage.cs Прегледај датотеку

@@ -1,62 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MessageName.发送消息Model
{
/// <summary>
/// 事件消息【发送端】Model配置
/// </summary>
public class EventSendMessage: MessageBase
{
/// <summary>
/// 控件名称
/// </summary>
public string ControlName { get; set; }
/// <summary>
/// 控件标题
/// </summary>
public string ControlTitle { get; set; }
/// <summary>
/// 控件触发源
/// </summary>
public object ControlSource { get; set; }
/// <summary>
/// 控件状态
/// </summary>
public string ControlStatus { get; set; }
/// <summary>
/// 控件类型
/// </summary>
public ControlEventType EventType { get; set; }
}
/// <summary>
/// 控件类型
/// </summary>
public enum ControlEventType
{
/// <summary>
/// 单击
/// </summary>
Click,
/// <summary>
/// 左键按下
/// </summary>
MouseLeftButtonDown,
/// <summary>
/// 文本改变事件
/// </summary>
TextChanged,
/// <summary>
/// 选中
/// </summary>
Checked,
/// <summary>
/// 取消选中
/// </summary>
Unchecked,
}
}

+ 0
- 35
BPASmartClient.MessageName/接收消息Model/EventReceiveMessage.cs Прегледај датотеку

@@ -1,35 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MessageName.接收消息Model
{
/// <summary>
/// 事件消息[接收端]Model:配置
/// </summary>
public class EventReceiveMessage:MessageBase
{
///// <summary>
///// 消息号
///// </summary>
//public string MeaageID { get; set; }
//// <summary>
///// 消息名称:枚举
///// </summary>
//public MessageNameEnum MeaageName { get; set; }
/// <summary>
/// 空:保留
/// </summary>
public string Value { get; set; }
/// <summary>
/// 消息标题:标志控件说明
/// </summary>
public string Title { get; set; }
//public EventReceiveMessage()
//{
// MeaageID = GetMessageID.GetID();
//}
}
}

+ 0
- 23
BPASmartClient.MessageName/接收消息Model/滚动线/ConveyorBeltMessageModel.cs Прегледај датотеку

@@ -1,23 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MessageName.接收消息Model.滚动线
{
/// <summary>
/// 滚动线数据设置-Model
/// </summary>
public class ConveyorBeltMessageModel
{
/// <summary>
/// 消息ID号:id 号
/// </summary>
public string MessageID { get; set; }
/// <summary>
/// 滚动线:标题
/// </summary>
public string Title { get; set; }
}
}

+ 0
- 31
BPASmartClient.MessageName/接收消息Model/物料仓/SilosMessageModel.cs Прегледај датотеку

@@ -1,31 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MessageName.接收消息Model.物料仓
{
/// <summary>
/// 物料仓数据设置-Model
/// </summary>
public class SilosMessageModel
{
/// <summary>
/// 消息ID号:id 号
/// </summary>
public string MessageID { get; set; }
/// <summary>
/// 物料仓:标题
/// </summary>
public string Title { get; set; }
/// <summary>
/// 物料仓:重量(G) 35.23
/// </summary>
public string Value { get; set; }
/// <summary>
/// 物料仓:仓号说明
/// </summary>
public string Text { get; set; }
}
}

+ 0
- 3
BeDesignerSCADA/BeDesignerSCADA.csproj Прегледај датотеку

@@ -106,9 +106,6 @@

<ItemGroup>
<ProjectReference Include="..\BPASmart.Model\BPASmart.Model.csproj" />
<ProjectReference Include="..\BPASmartClient.DATABUS\BPASmartClient.DATABUS.csproj" />
<ProjectReference Include="..\BPASmartClient.MessageCommunication\BPASmartClient.MessageCommunication.csproj" />
<ProjectReference Include="..\BPASmartClient.MessageName\BPASmartClient.MessageName.csproj" />
<ProjectReference Include="..\BPASmartClient.SCADAControl\BPASmartClient.SCADAControl.csproj" />
</ItemGroup>



+ 0
- 1
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;


+ 0
- 1
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;


+ 0
- 1
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;


+ 0
- 4
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;


Loading…
Откажи
Сачувај