mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-04-03 23:06:34 +08:00
尝试使用源生成器规范NodeModel代码逻辑
This commit is contained in:
@@ -1,10 +1,5 @@
|
||||
using Net462DllTest.View;
|
||||
using Serein.Library.Attributes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Serein.Library;
|
||||
|
||||
namespace Net462DllTest.Signal
|
||||
{
|
||||
|
||||
@@ -1,17 +1,5 @@
|
||||
using IoTClient.Clients.PLC;
|
||||
using IoTClient.Enums;
|
||||
using Net462DllTest.Trigger;
|
||||
using IoTClient.Enums;
|
||||
using Net462DllTest.Signal;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection.Emit;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static Net462DllTest.Signal.PlcVarInfoAttribute;
|
||||
using Serein.Library.Attributes;
|
||||
using static Net462DllTest.Signal.PlcVarInfo;
|
||||
|
||||
namespace Net462DllTest.Enums
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
using Net462DllTest.Trigger;
|
||||
using Serein.Library;
|
||||
using Serein.Library.Api;
|
||||
using Serein.Library.Attributes;
|
||||
using Serein.Library.Enums;
|
||||
using Serein.Library.Ex;
|
||||
using Serein.Library.Framework.NodeFlow;
|
||||
using Serein.Library.NodeFlow.Tool;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
@@ -2,14 +2,9 @@
|
||||
using Net462DllTest.Enums;
|
||||
using Net462DllTest.Model;
|
||||
using Net462DllTest.Trigger;
|
||||
using Net462DllTest.Web;
|
||||
using Serein.Library;
|
||||
using Serein.Library.Api;
|
||||
using Serein.Library.Attributes;
|
||||
using Serein.Library.Enums;
|
||||
using Serein.Library.Ex;
|
||||
using Serein.Library.Framework.NodeFlow;
|
||||
using Serein.Library.NodeFlow.Tool;
|
||||
using Serein.Library.Web;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
|
||||
using Net462DllTest.Signal;
|
||||
using Net462DllTest.Trigger;
|
||||
using Net462DllTest.ViewModel;
|
||||
using Serein.Library;
|
||||
using Serein.Library.Api;
|
||||
using Serein.Library.Attributes;
|
||||
using Serein.Library.Enums;
|
||||
using Serein.Library.Ex;
|
||||
using Serein.Library.Framework.NodeFlow;
|
||||
using Serein.Library.NodeFlow.Tool;
|
||||
using Serein.Library.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -33,4 +34,12 @@ namespace Net462DllTest.Properties
|
||||
动态的配置事件触发的原因、过程与结果。
|
||||
|
||||
*/
|
||||
|
||||
public class My
|
||||
{
|
||||
public void Run()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
using Net462DllTest.Enums;
|
||||
using Net462DllTest.LogicControl;
|
||||
using Net462DllTest.Trigger;
|
||||
using Serein.Library.Attributes;
|
||||
using Serein.Library;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Net462DllTest.Model
|
||||
{
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Model\PlcVarModel.cs" />
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using IoTClient.Enums;
|
||||
using Net462DllTest.Enums;
|
||||
using Serein.Library.Attributes;
|
||||
using System;
|
||||
using static Net462DllTest.Signal.PlcVarInfoAttribute;
|
||||
using static Net462DllTest.Signal.PlcVarInfo;
|
||||
|
||||
namespace Net462DllTest.Signal
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
using Net462DllTest.LogicControl;
|
||||
using Serein.Library.Attributes;
|
||||
using Serein.Library.NodeFlow.Tool;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Serein.Library;
|
||||
|
||||
namespace Net462DllTest.Trigger
|
||||
{
|
||||
|
||||
@@ -3,21 +3,16 @@ using IoTClient.Clients.PLC;
|
||||
using IoTClient.Common.Enums;
|
||||
using IoTClient.Enums;
|
||||
using Net462DllTest.Enums;
|
||||
using Net462DllTest.Model;
|
||||
using Net462DllTest.Signal;
|
||||
using Net462DllTest.Utils;
|
||||
using Serein.Library.Attributes;
|
||||
using Serein.Library.NodeFlow.Tool;
|
||||
using Serein.Library;
|
||||
using Serein.Library.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection.Emit;
|
||||
using System.Reflection;
|
||||
using Net462DllTest.Model;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TrackBar;
|
||||
using System.Linq;
|
||||
using Serein.Library.Network.WebSocketCommunication;
|
||||
|
||||
namespace Net462DllTest.Trigger
|
||||
{
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
using Net462DllTest.Signal;
|
||||
using Serein.Library;
|
||||
using Serein.Library.Api;
|
||||
using Serein.Library.Attributes;
|
||||
using Serein.Library.NodeFlow.Tool;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Threading;
|
||||
using Serein.Library.Utils;
|
||||
|
||||
namespace Net462DllTest.Trigger
|
||||
{
|
||||
@@ -17,9 +18,10 @@ namespace Net462DllTest.Trigger
|
||||
[AutoRegister]
|
||||
public class ViewManagement : FlowTrigger<CommandSignal>
|
||||
{
|
||||
public ViewManagement(IFlowEnvironment environment)
|
||||
private readonly UIContextOperation uiContextOperation;
|
||||
public ViewManagement(UIContextOperation uiContextOperation)
|
||||
{
|
||||
|
||||
this.uiContextOperation = uiContextOperation;
|
||||
}
|
||||
public int Id = new Random().Next(1, 10000);
|
||||
private readonly List<Form> forms = new List<Form>();
|
||||
@@ -30,20 +32,53 @@ namespace Net462DllTest.Trigger
|
||||
/// <param name="isTop">是否置顶</param>
|
||||
public void OpenView(Form form, bool isTop)
|
||||
{
|
||||
form.TopMost = isTop;
|
||||
form.Show();
|
||||
//Application.Current.Dispatcher.
|
||||
forms.Add(form);
|
||||
|
||||
uiContextOperation.Invoke(() => {
|
||||
form.TopMost = isTop;
|
||||
form.Show();
|
||||
});
|
||||
|
||||
|
||||
|
||||
//environment.IOC.Run<SynchronizationContext>(uiContext =>
|
||||
//{
|
||||
// uiContext?.Post(state => {
|
||||
|
||||
// },null);
|
||||
//});
|
||||
|
||||
//var uiContext = SynchronizationContext.Current;
|
||||
//Task.Run(() =>
|
||||
//{
|
||||
// uiContext.Post(_ =>
|
||||
// {
|
||||
|
||||
// }, null);
|
||||
//});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void CloseView(Type formType)
|
||||
{
|
||||
var remoteForms = forms.Where(f => f.GetType() == formType).ToArray();
|
||||
foreach (Form f in remoteForms)
|
||||
|
||||
Dispatcher.CurrentDispatcher.Invoke(() =>
|
||||
{
|
||||
f.Close();
|
||||
f.Dispose();
|
||||
this.forms.Remove(f);
|
||||
}
|
||||
foreach (Form f in remoteForms)
|
||||
{
|
||||
f.Close();
|
||||
f.Dispose();
|
||||
this.forms.Remove(f);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
using System;
|
||||
using Serein.Library;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection.Emit;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Serein.Library.Attributes;
|
||||
using System.Reflection.Emit;
|
||||
|
||||
namespace Net462DllTest.Utils
|
||||
{
|
||||
|
||||
@@ -2,15 +2,7 @@
|
||||
using Net462DllTest.Signal;
|
||||
using Net462DllTest.ViewModel;
|
||||
using Serein.Library.Api;
|
||||
using Serein.Library.Attributes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Net462DllTest
|
||||
|
||||
@@ -1,21 +1,9 @@
|
||||
using IoTClient;
|
||||
using Net462DllTest.Trigger;
|
||||
using Net462DllTest.Model;
|
||||
using Net462DllTest.Signal;
|
||||
using Net462DllTest.Trigger;
|
||||
using Net462DllTest.Utils;
|
||||
using Serein.Library.Attributes;
|
||||
using Serein.Library.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using Net462DllTest.LogicControl;
|
||||
using Net462DllTest.Model;
|
||||
using Serein.Library.Network.WebSocketCommunication;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Diagnostics;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Net462DllTest.ViewModel
|
||||
{
|
||||
|
||||
@@ -2,14 +2,9 @@
|
||||
using Net462DllTest.Enums;
|
||||
using Net462DllTest.Signal;
|
||||
using Net462DllTest.Trigger;
|
||||
using Serein.Library.Attributes;
|
||||
using Serein.Library.Utils;
|
||||
using Serein.Library.Web;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Net462DllTest.Web
|
||||
{
|
||||
|
||||
@@ -2,12 +2,9 @@
|
||||
using Net462DllTest.Enums;
|
||||
using Net462DllTest.Model;
|
||||
using Net462DllTest.Trigger;
|
||||
using Serein.Library;
|
||||
using Serein.Library.Api;
|
||||
using Serein.Library.Attributes;
|
||||
using Serein.Library.Enums;
|
||||
using Serein.Library.Ex;
|
||||
using Serein.Library.Network.WebSocketCommunication;
|
||||
using Serein.Library.NodeFlow.Tool;
|
||||
using Serein.Library.Web;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
Reference in New Issue
Block a user