diff --git a/BPASmartClient.Compiler/BPASmartClient.Compiler.csproj b/BPASmartClient.Compiler/BPASmartClient.Compiler.csproj index aa52b3a8..60f4f992 100644 --- a/BPASmartClient.Compiler/BPASmartClient.Compiler.csproj +++ b/BPASmartClient.Compiler/BPASmartClient.Compiler.csproj @@ -1,11 +1,15 @@  - net6.0 - enable + net6.0-windows + enable enable + + + + DLL\Antlr3.Runtime.dll diff --git a/BPASmartClient.Compiler/IExecutable.cs b/BPASmartClient.Compiler/IExecutable.cs index 836f89f7..063f0540 100644 --- a/BPASmartClient.Compiler/IExecutable.cs +++ b/BPASmartClient.Compiler/IExecutable.cs @@ -1,5 +1,7 @@ -using System; +using BPASmartClient.MessageName.接收消息Model; +using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -20,5 +22,9 @@ namespace BPASmartClient.Compiler /// 控件类型 /// string ControlType { get; } + ///// + ///// 消息名称 + ///// + //ObservableCollection EventNameList { get; } } } diff --git a/BPASmartClient.MessageName/BPASmartClient.MessageName.csproj b/BPASmartClient.MessageName/BPASmartClient.MessageName.csproj index 6b7aa59a..40bdbea1 100644 --- a/BPASmartClient.MessageName/BPASmartClient.MessageName.csproj +++ b/BPASmartClient.MessageName/BPASmartClient.MessageName.csproj @@ -1,13 +1,16 @@ - net6.0 + net6.0-windows enable enable + true + true - + + diff --git a/BPASmartClient.MessageName/DataName.cs b/BPASmartClient.MessageName/DataName.cs deleted file mode 100644 index ba02420f..00000000 --- a/BPASmartClient.MessageName/DataName.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BPASmartClient.MessageName -{ - /// - /// 数据订阅主题管理中心 - /// - public class DataName - { - #region XX数据 - /// - /// xxx消息 - /// - [Category("测试"), Description("消息备注"), Browsable(true)] - public static string xxx = "xxx"; - /// - /// xxx消息 - /// - [Category("测试"), Description("消息备注1"), Browsable(true)] - public static string 测试 = "测试"; - #endregion - - } -} diff --git a/BPASmartClient.MessageName/EnumHelp/EnumExtensions.cs b/BPASmartClient.MessageName/EnumHelp/EnumExtensions.cs new file mode 100644 index 00000000..9edd2d53 --- /dev/null +++ b/BPASmartClient.MessageName/EnumHelp/EnumExtensions.cs @@ -0,0 +1,105 @@ +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 Type 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};"); + //} + } + + + /// + /// 根据枚举int值获取枚举名称 + /// + /// 枚举类型 + /// 枚举值 + /// + public static string GetEnumName(this int status) + { + return Enum.GetName(typeof(T), status); + } + + + /// + /// 获取枚举变量值的 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/Enum/运行状态/RunEnum.cs b/BPASmartClient.MessageName/EnumHelp/RunEnum.cs similarity index 93% rename from BPASmartClient.MessageName/Enum/运行状态/RunEnum.cs rename to BPASmartClient.MessageName/EnumHelp/RunEnum.cs index 1e3134d4..63f10656 100644 --- a/BPASmartClient.MessageName/Enum/运行状态/RunEnum.cs +++ b/BPASmartClient.MessageName/EnumHelp/RunEnum.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace BPASmartClient.MessageName.Enum.运行状态 +namespace BPASmartClient.MessageName.EnumHelp { /// /// 运行状态-枚举 diff --git a/BPASmartClient.MessageName/MessageName.cs b/BPASmartClient.MessageName/MessageName.cs index 33688c83..6e79e11b 100644 --- a/BPASmartClient.MessageName/MessageName.cs +++ b/BPASmartClient.MessageName/MessageName.cs @@ -1,4 +1,6 @@ using System.ComponentModel; +using System.Reflection; +using System.Reflection.Emit; namespace BPASmartClient.MessageName { @@ -71,9 +73,39 @@ namespace BPASmartClient.MessageName /// ConveyorBeltRunStatus, + } + /// + /// 消息基类 + /// + 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 new file mode 100644 index 00000000..1c2804cb --- /dev/null +++ b/BPASmartClient.MessageName/发送消息Model/EventSendMessage.cs @@ -0,0 +1,61 @@ +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 ControlEventType EventType { get; set; } + /// + /// 控件名称 + /// + public object ControlName { get; set; } + /// + /// 控件标题 + /// + public string ControlTitle { get; set; } + /// + /// 控件触发源 + /// + public string ControlSource { get; set; } + /// + /// 控件状态 + /// + public string ControlStatus { get; set; } + } + /// + /// 控件类型 + /// + public enum ControlEventType + { + /// + /// 单击 + /// + Click, + /// + /// 左键按下 + /// + MouseLeftButtonDown, + /// + /// 文本改变事件 + /// + TextChanged, + /// + /// 选中 + /// + Checked, + /// + /// 取消选中 + /// + Unchecked, + } +} diff --git a/BPASmartClient.MessageName/接收消息Model/EventReceiveMessage.cs b/BPASmartClient.MessageName/接收消息Model/EventReceiveMessage.cs index 934ef95c..498a2d39 100644 --- a/BPASmartClient.MessageName/接收消息Model/EventReceiveMessage.cs +++ b/BPASmartClient.MessageName/接收消息Model/EventReceiveMessage.cs @@ -7,43 +7,17 @@ using System.Threading.Tasks; namespace BPASmartClient.MessageName.接收消息Model { /// - /// 事件消息Model:配置 + /// 事件消息[接收端]Model:配置 /// - public class EventReceiveMessage + public class EventReceiveMessage: MessageBase { - /// - /// 消息号 - /// - public string MeaageID { get; set; } - /// - /// 消息名称:枚举 - /// - public MessageNameEnum Name { get; set; } /// /// 空:保留 /// public string Value { get; set; } /// - /// 消息标题 + /// 消息标题:标志控件说明 /// public string Title { get; set; } - - public EventReceiveMessage() - { - MeaageID=GetMessageID.GetID(); - } - } - - /// - /// 四位消息号 - /// - public static class GetMessageID - { - public static int i = 0; - public static string GetID() - { - i++; - return ((Convert.ToInt32(i) + 1).ToString().PadLeft(4, '0')); - } } } diff --git a/BPASmartClient.SCADAControl/BPASmartClient.SCADAControl.csproj b/BPASmartClient.SCADAControl/BPASmartClient.SCADAControl.csproj index a47eae6c..731a66c4 100644 --- a/BPASmartClient.SCADAControl/BPASmartClient.SCADAControl.csproj +++ b/BPASmartClient.SCADAControl/BPASmartClient.SCADAControl.csproj @@ -3,11 +3,14 @@ net6.0-windows enable - true + true + true + + @@ -32,7 +35,9 @@ + + diff --git a/BPASmartClient.SCADAControl/Images/借出.png b/BPASmartClient.SCADAControl/Images/借出.png new file mode 100644 index 00000000..e0fcd5c7 Binary files /dev/null and b/BPASmartClient.SCADAControl/Images/借出.png differ diff --git a/BPASmartClient.SCADAControl/Images/退出.png b/BPASmartClient.SCADAControl/Images/退出.png new file mode 100644 index 00000000..87657298 Binary files /dev/null and b/BPASmartClient.SCADAControl/Images/退出.png differ diff --git a/BPASmartClient.SCADAControl/NewConveyorBelt.xaml.cs b/BPASmartClient.SCADAControl/NewConveyorBelt.xaml.cs index 6f3685cb..137f84d0 100644 --- a/BPASmartClient.SCADAControl/NewConveyorBelt.xaml.cs +++ b/BPASmartClient.SCADAControl/NewConveyorBelt.xaml.cs @@ -2,7 +2,7 @@ using BPASmartClient.MessageCommunication; using BPASmartClient.MessageCommunication.MsgControl; using BPASmartClient.MessageName; -using BPASmartClient.MessageName.Enum.运行状态; +using BPASmartClient.MessageName.EnumHelp; using BPASmartClient.MessageName.接收消息Model; using BPASmartClient.MessageName.接收消息Model.滚动线; using Newtonsoft.Json; @@ -347,7 +347,7 @@ namespace BPASmartClient.SCADAControl { EventNameList?.ToList().ForEach(x => { - Class_InnerMessageBus.GetInstance().ListenMessage(this, x.Name.ToString(), "EventHandler"); + Class_InnerMessageBus.GetInstance().ListenMessage(this, x.MeaageName.ToString(), "EventHandler"); }); } } @@ -361,7 +361,7 @@ namespace BPASmartClient.SCADAControl if (e.obj_MessageObj is RunEnumModel)//接收到运行消息 { RunEnumModel mode = (RunEnumModel)e.obj_MessageObj; - var msg = EventNameList?.ToList().Find(par => par.Name.ToString() == e.str_MessageStr && par.MeaageID == mode.MessageID); + var msg = EventNameList?.ToList().Find(par => par.MeaageName.ToString() == e.str_MessageStr && par.MeaageID == mode.MessageID); //必对消息号: if (msg != null) { @@ -371,7 +371,7 @@ namespace BPASmartClient.SCADAControl else if (e.obj_MessageObj is ConveyorBeltMessageModel)//接收到数据模型 { ConveyorBeltMessageModel mode = (ConveyorBeltMessageModel)e.obj_MessageObj; - var msg = EventNameList?.ToList().Find(par => par.Name.ToString() == e.str_MessageStr && par.MeaageID == mode.MessageID); + var msg = EventNameList?.ToList().Find(par => par.MeaageName.ToString() == e.str_MessageStr && par.MeaageID == mode.MessageID); //必对消息号: if (msg != null) { diff --git a/BPASmartClient.SCADAControl/Silos.xaml b/BPASmartClient.SCADAControl/Silos.xaml index 9adb8355..636294e9 100644 --- a/BPASmartClient.SCADAControl/Silos.xaml +++ b/BPASmartClient.SCADAControl/Silos.xaml @@ -5,7 +5,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:BPASmartClient.SCADAControl" mc:Ignorable="d" -d:DesignHeight="270" d:DesignWidth="180" > + d:DesignHeight="270" d:DesignWidth="180" > @@ -18,7 +18,7 @@ d:DesignHeight="270" d:DesignWidth="180" > FontSize="20" Foreground="#FF1FD622" Tag="出料控制" - Text="出料中..." Visibility="Collapsed" /> + Text="出料中..." Visibility="Collapsed"/> @@ -37,6 +37,8 @@ d:DesignHeight="270" d:DesignWidth="180" > + + Grid.RowSpan="2" Source="/BPASmartClient.SCADAControl;component/Images/光柱.png" Stretch="Fill" /> - + + + + + + + diff --git a/BPASmartClient.SCADAControl/Silos.xaml.cs b/BPASmartClient.SCADAControl/Silos.xaml.cs index b13ee9ed..216463e2 100644 --- a/BPASmartClient.SCADAControl/Silos.xaml.cs +++ b/BPASmartClient.SCADAControl/Silos.xaml.cs @@ -2,7 +2,8 @@ using BPASmartClient.MessageCommunication; using BPASmartClient.MessageCommunication.MsgControl; using BPASmartClient.MessageName; -using BPASmartClient.MessageName.Enum.运行状态; +using BPASmartClient.MessageName.EnumHelp; +using BPASmartClient.MessageName.发送消息Model; using BPASmartClient.MessageName.接收消息Model; using BPASmartClient.MessageName.接收消息Model.物料仓; using Newtonsoft.Json; @@ -11,6 +12,7 @@ using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; +using System.Drawing.Design; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -42,6 +44,8 @@ namespace BPASmartClient.SCADAControl Ellipse ellipseControl = null; Storyboard storyboard = new Storyboard(); + + object typeName; #endregion public Silos() @@ -53,10 +57,27 @@ namespace BPASmartClient.SCADAControl this.Loaded += Silos_Loaded; } + private void Silos_Loaded(object sender, RoutedEventArgs e) { - Silos_SizeChanged(null, null); + Loading(); EventNameList.CollectionChanged += EventNameList_CollectionChanged; + EventSendNameList.CollectionChanged += EventSendNameList_CollectionChanged; + } + + private void EventSendNameList_CollectionChanged(object? sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) + { + if (EventSendNameList.Count > 0) + { + try + { + EventSendNameListStr = JsonConvert.SerializeObject(EventSendNameList); + + } + catch (Exception ex) + { + } + } } private void EventNameList_CollectionChanged(object? sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) @@ -97,7 +118,7 @@ namespace BPASmartClient.SCADAControl /// /// /// - private void Silos_SizeChanged(object sender, SizeChangedEventArgs e) + public void Loading() { //查找 if (ellipseControl == null) @@ -136,6 +157,39 @@ namespace BPASmartClient.SCADAControl } } } + + foreach (StackPanel tb in FindVisualChildren(this)) + { + // do something with tb here + if (tb.Tag != null) + { + if (tb.Tag.ToString() == "ControlEvent") + { + foreach (var item in tb.Children) + { + if (item is Image) + { + (item as Image).MouseLeftButtonDown += Image_MouseLeftButtonDown; + } + else if (item is Button) + { + (item as Button).Click += Button_Click; + } + else if (item is TextBox) + { + (item as TextBox).TextChanged += TextBox_TextChanged; + } + else if (item is CheckBox) + { + (item as CheckBox).Checked += CheckBox_Checked; + (item as CheckBox).Unchecked += CheckBox_Unchecked; + } + } + //Type _typeName =EnumExtensions.CreatEnumType(tb.Children); + //typeName = _typeName.Assembly.CreateInstance(_typeName.FullName); + } + } + } } storyboard.RepeatBehavior = RepeatBehavior.Forever; DoubleAnimationUsingKeyFrames animation = new DoubleAnimationUsingKeyFrames(); @@ -146,6 +200,8 @@ namespace BPASmartClient.SCADAControl animation.KeyFrames.Add(new EasingDoubleKeyFrame(360, KeyTime.FromTimeSpan(TimeSpan.FromSeconds(2)))); storyboard.Children.Add(animation); } + + public static IEnumerable FindVisualChildren(DependencyObject depObj) where T : DependencyObject { if (depObj != null) @@ -196,16 +252,16 @@ namespace BPASmartClient.SCADAControl public static readonly DependencyProperty TitleProperty = DependencyProperty.Register("Title", typeof(string), typeof(Silos), new PropertyMetadata(new PropertyChangedCallback(onTargetChanged))); - [Category("消息名称")] - public string EventNameListStr + [Category("名称[自动生成]")] + private string EventNameListStr { get { return (string)GetValue(EventNameListStrProperty); } set { SetValue(EventNameListStrProperty, value); } } - public static readonly DependencyProperty EventNameListStrProperty = + private static readonly DependencyProperty EventNameListStrProperty = DependencyProperty.Register("EventNameListStr", typeof(string), typeof(Silos), new PropertyMetadata(string.Empty)); - [Category("消息名称集合")] + [Category("消息接收名称集合")] public ObservableCollection EventNameList { get { return (ObservableCollection)GetValue(EventNameListProperty); } @@ -215,6 +271,24 @@ namespace BPASmartClient.SCADAControl DependencyProperty.Register("EventNameList", typeof(ObservableCollection), typeof(Silos), new PropertyMetadata(new ObservableCollection(), new PropertyChangedCallback(onEventNameListChanged))); private static void onEventNameListChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => (d as Silos)?.DataNameRefresh(); + [Category("名称[自动生成]")] + private string EventSendNameListStr + { + get { return (string)GetValue(EventSendNameListStrProperty); } + set { SetValue(EventSendNameListStrProperty, value); } + } + private static readonly DependencyProperty EventSendNameListStrProperty = + DependencyProperty.Register("EventSendNameListStr", typeof(string), typeof(Silos), new PropertyMetadata(string.Empty)); + + [Category("消息发送名称集合")] + public ObservableCollection EventSendNameList + { + get { return (ObservableCollection)GetValue(EventSendNameListProperty); } + set { SetValue(EventSendNameListProperty, value); } + } + public static readonly DependencyProperty EventSendNameListProperty = + DependencyProperty.Register("EventSendNameList", typeof(ObservableCollection), typeof(Silos), new PropertyMetadata(new ObservableCollection(), new PropertyChangedCallback(onEventNameListChanged))); + [Category("值设定")] public int Direction { @@ -244,7 +318,6 @@ namespace BPASmartClient.SCADAControl } } - /// /// 值变化刷新 /// @@ -309,9 +382,21 @@ namespace BPASmartClient.SCADAControl { EventNameList?.ToList().ForEach(x => { - Class_InnerMessageBus.GetInstance().ListenMessage(this, x.Name.ToString(), "EventHandler"); + Class_InnerMessageBus.GetInstance().ListenMessage(this, x.MeaageName.ToString(), "EventHandler"); }); } + + if (!string.IsNullOrEmpty(EventSendNameListStr)) + { + try + { + EventSendNameList = JsonConvert.DeserializeObject>(EventSendNameListStr); + } + catch (Exception ex) + { + + } + } } /// /// 统一事件消息处理中心 @@ -327,7 +412,7 @@ namespace BPASmartClient.SCADAControl if (e.obj_MessageObj is RunEnumModel)//接收到运行消息 { RunEnumModel mode = (RunEnumModel)e.obj_MessageObj; - var msg = EventNameList?.ToList().Find(par => par.Name.ToString() == e.str_MessageStr && par.MeaageID == mode.MessageID); + var msg = EventNameList?.ToList().Find(par => par.MeaageName.ToString() == e.str_MessageStr && par.MeaageID == mode.MessageID); //必对消息号: if (msg!=null) { @@ -336,7 +421,7 @@ namespace BPASmartClient.SCADAControl }else if (e.obj_MessageObj is SilosMessageModel)//接收到数据模型 { SilosMessageModel mode = (SilosMessageModel)e.obj_MessageObj; - var msg = EventNameList?.ToList().Find(par => par.Name.ToString() == e.str_MessageStr && par.MeaageID == mode.MessageID); + var msg = EventNameList?.ToList().Find(par => par.MeaageName.ToString() == e.str_MessageStr && par.MeaageID == mode.MessageID); //必对消息号: if (msg != null) { @@ -353,6 +438,67 @@ namespace BPASmartClient.SCADAControl } #endregion - } + #region 发送消息事件 + /// + /// 按钮按下 + /// + /// + /// + private void Image_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + try + { + Image image = sender as Image; + + } + catch (Exception ex) + { + + } + } + + /// + /// 按钮类型 + /// + /// + /// + private void Button_Click(object sender, RoutedEventArgs e) + { + + } + + /// + /// 值改变 + /// + /// + /// + private void TextBox_TextChanged(object sender, TextChangedEventArgs e) + { + + + } + + /// + /// 选中 + /// + /// + /// + private void CheckBox_Checked(object sender, RoutedEventArgs e) + { + } + + /// + /// 取消选中 + /// + /// + /// + private void CheckBox_Unchecked(object sender, RoutedEventArgs e) + { + + } + #endregion + + + } } diff --git a/SCADA.Test/MainWindow.xaml.cs b/SCADA.Test/MainWindow.xaml.cs index c75ccf8e..dece296e 100644 --- a/SCADA.Test/MainWindow.xaml.cs +++ b/SCADA.Test/MainWindow.xaml.cs @@ -1,6 +1,7 @@ using BPASmartClient.MessageCommunication; using BPASmartClient.MessageName; -using BPASmartClient.MessageName.Enum.运行状态; +using BPASmartClient.MessageName.EnumHelp; +using BPASmartClient.MessageName.接收消息Model; using BPASmartClient.MessageName.接收消息Model.物料仓; using Microsoft.Win32; using System; @@ -27,7 +28,14 @@ namespace SCADA.Test /// public partial class MainWindow : Window { + /// + /// 控件集合 + /// List Children = new List(); + /// + /// 接收消息集合 + /// + List eventReceiveMessages = new List(); public MainWindow() { @@ -61,7 +69,7 @@ namespace SCADA.Test } if (Children.Count > 0) { - runCanvas.Run(Children); + eventReceiveMessages = runCanvas.Run(Children); } } diff --git a/SCADA.Test/RunCanvas.xaml.cs b/SCADA.Test/RunCanvas.xaml.cs index c5d8e247..f3501b62 100644 --- a/SCADA.Test/RunCanvas.xaml.cs +++ b/SCADA.Test/RunCanvas.xaml.cs @@ -1,4 +1,5 @@ using BPASmartClient.Compiler; +using BPASmartClient.MessageName.接收消息Model; using System; using System.Collections.Generic; using System.Linq; @@ -41,8 +42,9 @@ namespace SCADA.Test } } - public void Run(List canvas) + public List Run(List canvas) { + List messages=new List(); RootCanvas.Children.Clear(); foreach (FrameworkElement element in canvas) { @@ -52,11 +54,17 @@ namespace SCADA.Test } if (element is IExecutable executable) + { executable.IsExecuteState = true; - + //if (executable.EventNameList != null && executable.EventNameList.Count > 0) + //{ + // messages.AddRange(executable.EventNameList); + //} + } RootCanvas.Children.Add(element); RegisterJsName(element); } + return messages; } // 注册名称到Js diff --git a/SmartClient.sln b/SmartClient.sln index 71061217..a6787323 100644 --- a/SmartClient.sln +++ b/SmartClient.sln @@ -152,7 +152,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.Compiler", " EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "4.界面加载实例", "4.界面加载实例", "{309D579E-DDA8-4B01-A0AA-0F381BC37801}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SCADA.Test", "SCADA.Test\SCADA.Test.csproj", "{1696D557-C908-4136-A5F2-FF59D69E642C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SCADA.Test", "SCADA.Test\SCADA.Test.csproj", "{1696D557-C908-4136-A5F2-FF59D69E642C}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution