添加了@Dtc(数据类型转换)、@Data(获取全局数据)表达式

This commit is contained in:
fengjiayi
2024-12-09 22:57:06 +08:00
parent 8c54b9a014
commit 0f46b7ef63
27 changed files with 628 additions and 97 deletions

View File

@@ -15,13 +15,14 @@ namespace Serein.Workbench
{
#if DEBUG
if (1 == 1)
if (1 == 0 )
{
string filePath;
filePath = @"F:\临时\project\linux\project.dnf";
filePath = @"F:\临时\project\linux\http\project.dnf";
filePath = @"F:\临时\project\yolo flow\project.dnf";
filePath = @"F:\临时\project\data\project.dnf";
filePath = @"C:\Users\Az\source\repos\CLBanyunqiState\CLBanyunqiState\bin\Release\net8.0\PLCproject.dnf";
string content = System.IO.File.ReadAllText(filePath); // 读取整个文件内容
App.FlowProjectData = JsonConvert.DeserializeObject<SereinProjectData>(content);
App.FileDataPath = System.IO.Path.GetDirectoryName(filePath)!; // filePath;//

View File

@@ -578,7 +578,7 @@ namespace Serein.Workbench
NodeControlType.Action => CreateNodeControl<ActionNodeControl, ActionNodeControlViewModel>(nodeModelBase), //typeof(ActionNodeControl),
NodeControlType.Flipflop => CreateNodeControl<FlipflopNodeControl, FlipflopNodeControlViewModel>(nodeModelBase),
NodeControlType.ExpCondition => CreateNodeControl<ConditionNodeControl, ConditionNodeControlViewModel>(nodeModelBase),
NodeControlType.ExpOp => CreateNodeControl<ExpOpNodeControl, ExpOpNodeViewModel>(nodeModelBase),
NodeControlType.ExpOp => CreateNodeControl<ExpOpNodeControl, ExpOpNodeControlViewModel>(nodeModelBase),
NodeControlType.ConditionRegion => CreateNodeControl<ConditionRegionControl, ConditionRegionNodeControlViewModel>(nodeModelBase),
_ => null,
};
@@ -2504,7 +2504,7 @@ namespace Serein.Workbench
NodeLibraryInfo? library = projectData.Librarys[index];
try
{
string targetPath = System.IO.Path.Combine(librarySavePath, library.FileName); // 目标文件夹
string targetPath = System.IO.Path.Combine(librarySavePath, library.FilePath); // 目标文件夹
#if WINDOWS
string sourceFile = library.FilePath; // 源文件夹
#else

View File

@@ -15,8 +15,10 @@
<!--<BooleanToVisibilityConverter x:Key="BoolToVisConverter" />-->
<converters:InvertableBooleanToVisibilityConverter x:Key="InvertedBoolConverter"/>
<!--<ResourceDictionary Source="/Serein.Workbench;Node/View/NodeExecuteJunctionControl.xaml" x:Key="NodeExecuteJunctionControl"/>-->
</UserControl.Resources>
<Border BorderBrush="#8DE9FD" BorderThickness="4">
<Grid>
<Grid.ToolTip>
@@ -24,7 +26,10 @@
</Grid.ToolTip>
<!--<TextBlock Text="{Binding NodelModel.DebugSetting.IsInterrupt}}"></TextBlock>-->
<Border x:Name="InterruptBorder" DataContext="{Binding}">
<!--DataContext="{Binding}-->
<Border x:Name="InterruptBorder" Tag="{Binding NodeModel.DebugSetting.IsInterrupt}">
<Border.Style>
<Style TargetType="Border">
<!--默认无边框-->
@@ -32,9 +37,9 @@
<Setter Property="BorderThickness" Value="0" />
<Style.Triggers>
<!--NodeModel.DebugSetting.IsInterrupt-->
<!--<DataTrigger Binding="{Binding DataContext.NodeModel.DebugSetting.IsInterrup, RelativeSource={RelativeSource AncestorType=UserControl}}" Value="True">-->
<DataTrigger Binding="{Binding IsInterrupt,Mode=OneTime}" Value="True">
<!--<DataTrigger Binding="{Binding NodeModel.DebugSetting.IsInterrup}" Value="True">-->
<!--<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:ActionNodeControl}}, Path=DataContext.DebugSetting.IsInterrupt}" Value="True">-->
<!--<DataTrigger Binding="{Binding DebugSetting.IsInterrupt, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Value="True">-->
<DataTrigger Binding="{Binding Path=Tag,RelativeSource={RelativeSource Mode=Self}}" Value="True">
<Setter Property="BorderBrush" Value="Red" />
<Setter Property="BorderThickness" Value="2" />
<Setter Property="Background" Value="#80000000" />
@@ -42,8 +47,12 @@
</Style.Triggers>
</Style>
</Border.Style>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>

View File

@@ -16,7 +16,11 @@ namespace Serein.Workbench.Node.View
{
DataContext = viewModel;
InitializeComponent();
if(ExecuteJunctionControl.MyNode != null)
{
ExecuteJunctionControl.MyNode.Guid = viewModel.NodeModel.Guid;
}
}
/// <summary>

View File

@@ -21,6 +21,7 @@ namespace Serein.Workbench.Node.View
DataContext = viewModel;
InitializeComponent();
}
/// <summary>
/// 入参控制点(可能有,可能没)
/// </summary>

View File

@@ -26,8 +26,6 @@ namespace Serein.Workbench.Node.View
/// <summary>
/// 添加条件控件
/// </summary>

View File

@@ -11,11 +11,11 @@ namespace Serein.Workbench.Node.View
public ExpOpNodeControl() : base()
{
// 窗体初始化需要
ViewModel = new ExpOpNodeViewModel(new SingleExpOpNode(null));
ViewModel = new ExpOpNodeControlViewModel(new SingleExpOpNode(null));
DataContext = ViewModel;
InitializeComponent();
}
public ExpOpNodeControl(ExpOpNodeViewModel viewModel) :base(viewModel)
public ExpOpNodeControl(ExpOpNodeControlViewModel viewModel) :base(viewModel)
{
DataContext = viewModel;
InitializeComponent();

View File

@@ -1,26 +0,0 @@
using Serein.NodeFlow.Model;
using Serein.Workbench.Node.View;
namespace Serein.Workbench.Node.ViewModel
{
public class ExpOpNodeViewModel: NodeControlViewModelBase
{
public new SingleExpOpNode NodeModel { get; }
//public string Expression
//{
// get => node.Expression;
// set
// {
// node.Expression = value;
// OnPropertyChanged();
// }
//}
public ExpOpNodeViewModel(SingleExpOpNode nodeModel) : base(nodeModel)
{
this.NodeModel = nodeModel;
}
}
}

View File

@@ -55,6 +55,11 @@
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<!--<PackageReference Include="MySqlConnector" Version="2.4.0" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.170" />
<PackageReference Include="SqlSugarCoreNoDrive" Version="5.1.4.171" />-->
<!--<PackageReference Include="LivetCask2" Version="4.0.2" />-->
<!--<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" />-->
</ItemGroup>

View File

@@ -46,6 +46,7 @@
Visibility="{Binding IsParams, Mode=OneWay,
Converter={StaticResource InvertedBoolConverter},ConverterParameter=Normal}"
/>
<ContentControl Content="{Binding}" Grid.Column="4" VerticalAlignment="Center">
<ContentControl.Style>
<Style TargetType="ContentControl">