mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-04-13 03:16:35 +08:00
设计了流程接口节点,能够切换本节点数据、目标节点数据,目前还有数据来源相关操作没有实现
This commit is contained in:
@@ -14,6 +14,7 @@ using System.Windows.Documents;
|
||||
using System.Threading;
|
||||
using Serein.Workbench.Services;
|
||||
using Serein.Workbench.Tool;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Serein.Workbench.Node.View
|
||||
{
|
||||
@@ -169,15 +170,24 @@ namespace Serein.Workbench.Node.View
|
||||
private readonly FlowNodeService flowNodeService;
|
||||
protected JunctionControlBase()
|
||||
{
|
||||
flowNodeService = App.GetService<FlowNodeService>();
|
||||
|
||||
|
||||
this.Width = 25;
|
||||
this.Height = 20;
|
||||
this.MouseDown += JunctionControlBase_MouseDown;
|
||||
this.MouseMove += JunctionControlBase_MouseMove;
|
||||
this.MouseLeave += JunctionControlBase_MouseLeave; ;
|
||||
this.MouseLeave += JunctionControlBase_MouseLeave;
|
||||
#if DEBUG
|
||||
|
||||
if (DesignerProperties.GetIsInDesignMode(new DependencyObject()))
|
||||
return;
|
||||
|
||||
#endif
|
||||
flowNodeService = App.GetService<FlowNodeService>();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region 控件属性,所在的节点
|
||||
public static readonly DependencyProperty NodeProperty =
|
||||
DependencyProperty.Register(nameof(MyNode), typeof(NodeModelBase), typeof(JunctionControlBase), new PropertyMetadata(default(NodeModelBase)));
|
||||
@@ -238,7 +248,11 @@ namespace Serein.Workbench.Node.View
|
||||
{
|
||||
if(_isMouseOver != value)
|
||||
{
|
||||
flowNodeService.ConnectingData.CurrentJunction = this;
|
||||
if(flowNodeService is not null)
|
||||
{
|
||||
|
||||
flowNodeService.ConnectingData.CurrentJunction = this;
|
||||
}
|
||||
_isMouseOver = value;
|
||||
InvalidateVisual();
|
||||
}
|
||||
@@ -261,6 +275,10 @@ namespace Serein.Workbench.Node.View
|
||||
/// <returns></returns>
|
||||
protected Brush GetBackgrounp()
|
||||
{
|
||||
if(flowNodeService is null)
|
||||
{
|
||||
return Brushes.Transparent;
|
||||
}
|
||||
var cd = flowNodeService.ConnectingData;
|
||||
if(!cd.IsCreateing)
|
||||
{
|
||||
|
||||
@@ -8,9 +8,6 @@ namespace Serein.Workbench.Node.View
|
||||
{
|
||||
public class ExecuteJunctionControl : JunctionControlBase
|
||||
{
|
||||
|
||||
|
||||
|
||||
public ExecuteJunctionControl()
|
||||
{
|
||||
base.JunctionType = JunctionType.Execute;
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Serein.Workbench.Node.View
|
||||
/// <summary>
|
||||
/// 节点控件基类(控件)
|
||||
/// </summary>
|
||||
public abstract class NodeControlBase : UserControl, IDynamicFlowNode
|
||||
public abstract class NodeControlBase : UserControl //, IDynamicFlowNode
|
||||
{
|
||||
/// <summary>
|
||||
/// 节点所在的画布(以后需要将画布封装出来,实现多画布的功能)
|
||||
|
||||
@@ -4,10 +4,11 @@ using System.Runtime.CompilerServices;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace Serein.Workbench.Node.ViewModel
|
||||
{
|
||||
public abstract class NodeControlViewModelBase
|
||||
public abstract partial class NodeControlViewModelBase : ObservableObject
|
||||
{
|
||||
|
||||
///// <summary>
|
||||
@@ -21,30 +22,14 @@ namespace Serein.Workbench.Node.ViewModel
|
||||
|
||||
}
|
||||
|
||||
|
||||
private bool isInterrupt;
|
||||
private bool isReadonlyOnView = true;
|
||||
|
||||
///// <summary>
|
||||
///// 控制中断状态的视觉效果
|
||||
///// </summary>
|
||||
public bool IsInterrupt
|
||||
{
|
||||
get => NodeModel.DebugSetting.IsInterrupt;
|
||||
set
|
||||
{
|
||||
NodeModel.DebugSetting.IsInterrupt = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工作台预览基本节点时,避免其中的文本框响应拖拽事件导致卡死
|
||||
/// </summary>
|
||||
public bool IsEnabledOnView { get => isReadonlyOnView; set
|
||||
{
|
||||
OnPropertyChanged(); isReadonlyOnView = value;
|
||||
}
|
||||
}
|
||||
[ObservableProperty]
|
||||
private bool isEnabledOnView = true;
|
||||
|
||||
|
||||
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Serein.Workbench.Node.View"
|
||||
xmlns:vm="clr-namespace:Serein.Workbench.Node.ViewModel"
|
||||
xmlns:converters="clr-namespace:Serein.Workbench.Tool.Converters"
|
||||
xmlns:converter="clr-namespace:Serein.Workbench.Converters"
|
||||
xmlns:themes="clr-namespace:Serein.Workbench.Themes"
|
||||
d:DataContext="{d:DesignInstance vm:ActionNodeControlViewModel}"
|
||||
mc:Ignorable="d"
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
<UserControl.Resources>
|
||||
<!--<BooleanToVisibilityConverter x:Key="BoolToVisConverter" />-->
|
||||
<converters:InvertableBooleanToVisibilityConverter x:Key="InvertedBoolConverter"/>
|
||||
<converter:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
|
||||
<!--<ResourceDictionary Source="/Serein.Workbench;Node/View/NodeExecuteJunctionControl.xaml" x:Key="NodeExecuteJunctionControl"/>-->
|
||||
|
||||
</UserControl.Resources>
|
||||
@@ -69,10 +69,13 @@
|
||||
<local:NextStepJunctionControl Grid.Column="2" MyNode="{Binding NodeModel}" x:Name="NextStepJunctionControl" HorizontalAlignment="Right" Grid.RowSpan="2"/>
|
||||
|
||||
</Grid>
|
||||
|
||||
<themes:MethodDetailsControl Grid.Row="2" x:Name="MethodDetailsControl" MethodDetails="{Binding NodeModel.MethodDetails}"/>
|
||||
<Border Grid.Row="2" x:Name="ParameterProtectionMask" Background="LightBlue" Opacity="0.5" BorderThickness="0"
|
||||
Visibility="{Binding NodeModel.MethodDetails.IsProtectionParameter, Mode=TwoWay,
|
||||
Converter={StaticResource InvertedBoolConverter}, ConverterParameter=Normal}" />
|
||||
|
||||
<Border Grid.Row="2" x:Name="ParameterProtectionMask" Background="#40508D" Opacity="0.5" BorderThickness="0"
|
||||
Visibility="{Binding NodeModel.DebugSetting.IsProtectionParameter, Mode=TwoWay,
|
||||
Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter=Normal}" />
|
||||
|
||||
<Grid Grid.Row="3" Background="#D5F0FC" >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="50"/>
|
||||
@@ -105,7 +108,7 @@
|
||||
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<CheckBox IsChecked="{Binding NodeModel.MethodDetails.IsProtectionParameter, Mode=TwoWay}"/>
|
||||
<CheckBox IsChecked="{Binding NodeModel.DebugSetting.IsProtectionParameter, Mode=TwoWay}"/>
|
||||
<TextBlock Text="参数保护"/>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
@@ -18,8 +18,7 @@ namespace Serein.Workbench.Node.View
|
||||
InitializeComponent();
|
||||
if(ExecuteJunctionControl.MyNode != null)
|
||||
{
|
||||
|
||||
ExecuteJunctionControl.MyNode.Guid = viewModel.NodeModel.Guid;
|
||||
ExecuteJunctionControl.MyNode.Guid = viewModel.NodeModel.Guid;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,46 +37,40 @@ namespace Serein.Workbench.Node.View
|
||||
/// </summary>
|
||||
JunctionControlBase INodeJunction.ReturnDataJunction => this.ResultJunctionControl;
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 方法入参控制点(可能有,可能没)
|
||||
/// </summary>
|
||||
JunctionControlBase[] INodeJunction.ArgDataJunction
|
||||
{
|
||||
get
|
||||
{
|
||||
// 获取 MethodDetailsControl 实例
|
||||
var methodDetailsControl = this.MethodDetailsControl;
|
||||
var itemsControl = FindVisualChild<ItemsControl>(methodDetailsControl); // 查找 ItemsControl
|
||||
if (itemsControl != null)
|
||||
{
|
||||
var argDataJunction = new JunctionControlBase[base.ViewModel.NodeModel.MethodDetails.ParameterDetailss.Length];
|
||||
var controls = new List<JunctionControlBase>();
|
||||
JunctionControlBase[] INodeJunction.ArgDataJunction => GetArgJunction();
|
||||
|
||||
for (int i = 0; i < itemsControl.Items.Count; i++)
|
||||
private JunctionControlBase[] GetArgJunction()
|
||||
{
|
||||
// 获取 MethodDetailsControl 实例
|
||||
var methodDetailsControl = this.MethodDetailsControl;
|
||||
var itemsControl = FindVisualChild<ItemsControl>(methodDetailsControl); // 查找 ItemsControl
|
||||
if (itemsControl != null)
|
||||
{
|
||||
var argDataJunction = new JunctionControlBase[base.ViewModel.NodeModel.MethodDetails.ParameterDetailss.Length];
|
||||
var controls = new List<JunctionControlBase>();
|
||||
|
||||
for (int i = 0; i < itemsControl.Items.Count; i++)
|
||||
{
|
||||
var container = itemsControl.ItemContainerGenerator.ContainerFromIndex(i) as FrameworkElement;
|
||||
if (container != null)
|
||||
{
|
||||
var container = itemsControl.ItemContainerGenerator.ContainerFromIndex(i) as FrameworkElement;
|
||||
if (container != null)
|
||||
var argControl = FindVisualChild<ArgJunctionControl>(container);
|
||||
if (argControl != null)
|
||||
{
|
||||
var argControl = FindVisualChild<ArgJunctionControl>(container);
|
||||
if (argControl != null)
|
||||
{
|
||||
controls.Add(argControl); // 收集 ArgJunctionControl 实例
|
||||
}
|
||||
controls.Add(argControl); // 收集 ArgJunctionControl 实例
|
||||
}
|
||||
}
|
||||
return argDataJunction = controls.ToArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
return [];
|
||||
}
|
||||
return argDataJunction = controls.ToArray();
|
||||
}
|
||||
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Serein.NodeFlow.Model;
|
||||
using Serein.Library.Api;
|
||||
using Serein.NodeFlow.Model;
|
||||
using Serein.Workbench.Node.ViewModel;
|
||||
|
||||
namespace Serein.Workbench.Node.View
|
||||
@@ -10,8 +11,10 @@ namespace Serein.Workbench.Node.View
|
||||
{
|
||||
public ConditionNodeControl() : base()
|
||||
{
|
||||
|
||||
// 窗体初始化需要
|
||||
base.ViewModel = new ConditionNodeControlViewModel (new SingleConditionNode(null));
|
||||
var env = App.GetService<IFlowEnvironment>();
|
||||
base.ViewModel = new ConditionNodeControlViewModel (new SingleConditionNode(env));
|
||||
base.ViewModel.IsEnabledOnView = false;
|
||||
DataContext = ViewModel;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Serein.Workbench.Node.View"
|
||||
xmlns:vm="clr-namespace:Serein.Workbench.Node.ViewModel"
|
||||
d:DataContext="{d:DesignInstance vm:ExpOpNodeViewModel}"
|
||||
d:DataContext="{d:DesignInstance vm:ExpOpNodeControlViewModel}"
|
||||
mc:Ignorable="d"
|
||||
MaxWidth="300">
|
||||
<Grid>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Serein.NodeFlow.Model;
|
||||
using Serein.Library.Api;
|
||||
using Serein.NodeFlow.Model;
|
||||
using Serein.Workbench.Node.ViewModel;
|
||||
|
||||
namespace Serein.Workbench.Node.View
|
||||
@@ -11,7 +12,8 @@ namespace Serein.Workbench.Node.View
|
||||
public ExpOpNodeControl() : base()
|
||||
{
|
||||
// 窗体初始化需要
|
||||
ViewModel = new ExpOpNodeControlViewModel(new SingleExpOpNode(null));
|
||||
var env = App.GetService<IFlowEnvironment>();
|
||||
ViewModel = new ExpOpNodeControlViewModel(new SingleExpOpNode(env));
|
||||
base.ViewModel.IsEnabledOnView = false;
|
||||
DataContext = ViewModel;
|
||||
InitializeComponent();
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:Converters="clr-namespace:Serein.Workbench.Tool.Converters"
|
||||
xmlns:converter="clr-namespace:Serein.Workbench.Converters"
|
||||
xmlns:local="clr-namespace:Serein.Workbench.Node.View"
|
||||
xmlns:vm="clr-namespace:Serein.Workbench.Node.ViewModel"
|
||||
xmlns:themes="clr-namespace:Serein.Workbench.Themes"
|
||||
@@ -14,12 +14,10 @@
|
||||
<UserControl.Resources>
|
||||
<vm:TypeToStringConverter x:Key="TypeToStringConverter"/>
|
||||
<!--<themes:ConditionControl x:Key="ConditionControl"/>-->
|
||||
<Converters:InvertableBooleanToVisibilityConverter x:Key="InvertedBoolConverter"/>
|
||||
<converter:InvertableBooleanToVisibilityConverter x:Key="InvertedBoolConverter"/>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Border BorderBrush="#FCB334" BorderThickness="1">
|
||||
|
||||
|
||||
<Grid>
|
||||
<Grid.ToolTip>
|
||||
<ToolTip Background="LightYellow" Foreground="#071042" Content="{Binding NodeModel.MethodDetails, UpdateSourceTrigger=PropertyChanged}" />
|
||||
@@ -53,17 +51,11 @@
|
||||
|
||||
</Grid>
|
||||
|
||||
<!--<StackPanel Grid.Row="0" Orientation="Horizontal" Background="#FCB334">
|
||||
<CheckBox IsChecked="{Binding NodeModel.DebugSetting.IsEnable, Mode=TwoWay}" VerticalContentAlignment="Center"/>
|
||||
<CheckBox IsChecked="{Binding NodeModel.MethodDetails.IsProtectionParameter, Mode=TwoWay}" VerticalContentAlignment="Center"/>
|
||||
|
||||
<TextBlock Text="{Binding NodeModel.MethodDetails.MethodTips, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</StackPanel>-->
|
||||
|
||||
<!--方法描述-->
|
||||
<themes:MethodDetailsControl x:Name="MethodDetailsControl" Grid.Row="1" MethodDetails="{Binding NodeModel.MethodDetails}" />
|
||||
|
||||
<Border Grid.Row="2" x:Name="ParameterProtectionMask" Background="LightBlue" Opacity="0.5" BorderBrush="#0A4651" BorderThickness="0"
|
||||
Visibility="{Binding NodeModel.MethodDetails.IsProtectionParameter, Converter={StaticResource InvertedBoolConverter},ConverterParameter=Normal}" />
|
||||
<Border Grid.Row="2" x:Name="ParameterProtectionMask" Background="#40508D" Opacity="0.5" BorderBrush="#0A4651" BorderThickness="0"
|
||||
Visibility="{Binding NodeModel.DebugSetting.IsProtectionParameter, Converter={StaticResource InvertedBoolConverter},ConverterParameter=Normal}" />
|
||||
<!--<Border Grid.Row="0" Background="#FCB334" >
|
||||
|
||||
</Border>-->
|
||||
@@ -94,7 +86,7 @@
|
||||
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="2,1,2,1">
|
||||
<CheckBox IsChecked="{Binding NodeModel.MethodDetails.IsProtectionParameter, Mode=TwoWay}"/>
|
||||
<CheckBox IsChecked="{Binding NodeModel.DebugSetting.IsProtectionParameter, Mode=TwoWay}"/>
|
||||
<TextBlock Text="参数保护" HorizontalAlignment="Left" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
@@ -34,37 +34,33 @@ namespace Serein.Workbench.Node.View
|
||||
/// <summary>
|
||||
/// 方法入参控制点(可能有,可能没)
|
||||
/// </summary>
|
||||
JunctionControlBase[] INodeJunction.ArgDataJunction
|
||||
{
|
||||
get
|
||||
{
|
||||
// 获取 MethodDetailsControl 实例
|
||||
var methodDetailsControl = this.MethodDetailsControl;
|
||||
var itemsControl = FindVisualChild<ItemsControl>(methodDetailsControl); // 查找 ItemsControl
|
||||
if (itemsControl != null)
|
||||
{
|
||||
var argDataJunction = new JunctionControlBase[base.ViewModel.NodeModel.MethodDetails.ParameterDetailss.Length];
|
||||
var controls = new List<JunctionControlBase>();
|
||||
JunctionControlBase[] INodeJunction.ArgDataJunction => GetArgJunction();
|
||||
|
||||
for (int i = 0; i < itemsControl.Items.Count; i++)
|
||||
private JunctionControlBase[] GetArgJunction()
|
||||
{
|
||||
// 获取 MethodDetailsControl 实例
|
||||
var methodDetailsControl = this.MethodDetailsControl;
|
||||
var itemsControl = FindVisualChild<ItemsControl>(methodDetailsControl); // 查找 ItemsControl
|
||||
if (itemsControl != null)
|
||||
{
|
||||
var argDataJunction = new JunctionControlBase[base.ViewModel.NodeModel.MethodDetails.ParameterDetailss.Length];
|
||||
var controls = new List<JunctionControlBase>();
|
||||
|
||||
for (int i = 0; i < itemsControl.Items.Count; i++)
|
||||
{
|
||||
var container = itemsControl.ItemContainerGenerator.ContainerFromIndex(i) as FrameworkElement;
|
||||
if (container != null)
|
||||
{
|
||||
var container = itemsControl.ItemContainerGenerator.ContainerFromIndex(i) as FrameworkElement;
|
||||
if (container != null)
|
||||
var argControl = FindVisualChild<ArgJunctionControl>(container);
|
||||
if (argControl != null)
|
||||
{
|
||||
var argControl = FindVisualChild<ArgJunctionControl>(container);
|
||||
if (argControl != null)
|
||||
{
|
||||
controls.Add(argControl); // 收集 ArgJunctionControl 实例
|
||||
}
|
||||
controls.Add(argControl); // 收集 ArgJunctionControl 实例
|
||||
}
|
||||
}
|
||||
return argDataJunction = controls.ToArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
return [];
|
||||
}
|
||||
return argDataJunction = controls.ToArray();
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,16 +1,152 @@
|
||||
<local:NodeControlBase x:Class="Serein.Workbench.Node.View.FlowCallNodeControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Serein.Workbench.Node.View"
|
||||
xmlns:vm="clr-namespace:Serein.Workbench.Node.ViewModel"
|
||||
xmlns:themes="clr-namespace:Serein.Workbench.Themes"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800"
|
||||
d:DataContext="{d:DesignInstance vm:FlipflopNodeControlViewModel}">
|
||||
<Grid>
|
||||
<!--选择画布-->
|
||||
<!--选择公开的节点-->
|
||||
</Grid>
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Serein.Workbench.Node.View"
|
||||
xmlns:vm="clr-namespace:Serein.Workbench.Node.ViewModel"
|
||||
xmlns:converter="clr-namespace:Serein.Workbench.Converters"
|
||||
xmlns:themes="clr-namespace:Serein.Workbench.Themes"
|
||||
mc:Ignorable="d"
|
||||
MaxWidth="300"
|
||||
|
||||
d:DataContext="{d:DesignInstance vm:FlowCallNodeControlViewModel}">
|
||||
|
||||
<UserControl.Resources>
|
||||
<converter:CountToVisibilityConverter x:Key="CountToVisibilityConverter"/>
|
||||
<converter:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
|
||||
<converter:MethodDetailsSelectorConverter x:Key="MethodDetailsSelector"/>
|
||||
<converter:InvertableBooleanToVisibilityConverter x:Key="InvertedBoolConverter"/>
|
||||
</UserControl.Resources>
|
||||
|
||||
|
||||
<Border BorderBrush="#C7FFE7" BorderThickness="1">
|
||||
<Grid>
|
||||
<Grid.ToolTip>
|
||||
<ToolTip Background="LightYellow" Foreground="#071042" Content="{Binding NodeModel.MethodDetails}" />
|
||||
</Grid.ToolTip>
|
||||
|
||||
|
||||
|
||||
|
||||
<!--<TextBlock Text="{Binding NodeModel.DebugSetting.IsInterrupt}}"></TextBlock>-->
|
||||
<!--DataContext="{Binding}-->
|
||||
|
||||
<Border x:Name="InterruptBorder" Tag="{Binding NodeModel.DebugSetting.IsInterrupt}">
|
||||
<Border.Style>
|
||||
<Style TargetType="Border">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Path=Tag,RelativeSource={RelativeSource Mode=Self}}" Value="True">
|
||||
<Setter Property="BorderBrush" Value="Red" />
|
||||
<Setter Property="BorderThickness" Value="2" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Path=Tag,RelativeSource={RelativeSource Mode=Self}}" Value="False">
|
||||
<Setter Property="BorderBrush" Value="Transparent" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
|
||||
|
||||
<Grid Background="#C7FFE7" >
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Grid.Row="0" >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<local:ExecuteJunctionControl Grid.Column="0" MyNode="{Binding NodeModel}" x:Name="ExecuteJunctionControl" HorizontalAlignment="Left" Grid.RowSpan="2"/>
|
||||
<StackPanel Grid.Column="1" Grid.RowSpan="2" Orientation="Horizontal">
|
||||
<TextBlock Text="[流程接口]" HorizontalAlignment="Center"/>
|
||||
<TextBlock Text="{Binding NodeModel.DisplayName, Mode=TwoWay}" HorizontalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
|
||||
<Grid x:Name="MethodInfoGrid" Grid.Row="2" Margin="10,0,10,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="60" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Text="画布" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Center" Width="40"/>
|
||||
<ComboBox Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
DisplayMemberPath="Model.Name"
|
||||
SelectedItem="{Binding SelectCanvas}"
|
||||
ItemsSource="{Binding Canvass}"
|
||||
HorizontalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
IsEnabled="{Binding IsEnabledOnView}"/>
|
||||
|
||||
<TextBlock Text="节点" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Center" Width="40" Visibility="{Binding SelectCanvas.Model.PublicNodes, Converter={StaticResource CountToVisibilityConverter}}"/>
|
||||
<ComboBox DisplayMemberPath="DisplayName"
|
||||
Grid.Row="1" Grid.Column="1"
|
||||
SelectedItem="{Binding SelectNode}"
|
||||
ItemsSource="{Binding SelectCanvas.Model.PublicNodes, Mode=TwoWay}"
|
||||
HorizontalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
IsEnabled="{Binding IsEnabledOnView}"
|
||||
Visibility="{Binding SelectCanvas.Model.PublicNodes, Converter={StaticResource CountToVisibilityConverter}}">
|
||||
</ComboBox>
|
||||
|
||||
<themes:MethodDetailsControl Grid.Row="2" Grid.ColumnSpan="2" x:Name="MethodDetailsControl">
|
||||
<themes:MethodDetailsControl.MethodDetails>
|
||||
<MultiBinding Converter="{StaticResource MethodDetailsSelector}">
|
||||
<Binding Path="FlowCallNode.IsShareParam" UpdateSourceTrigger="PropertyChanged"/>
|
||||
<Binding Path="SelectNode.MethodDetails" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged"/>
|
||||
<Binding Path="FlowCallNode.MethodDetails" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged"/>
|
||||
</MultiBinding>
|
||||
</themes:MethodDetailsControl.MethodDetails>
|
||||
</themes:MethodDetailsControl>
|
||||
</Grid>
|
||||
|
||||
<Border Grid.Row="2" x:Name="ParameterProtectionMask"
|
||||
|
||||
Background="#40508D" Opacity="0.5" BorderThickness="0"
|
||||
Visibility="{Binding NodeModel.DebugSetting.IsProtectionParameter, Mode=TwoWay, Converter={StaticResource BoolToVisibilityConverter }}" />
|
||||
|
||||
<StackPanel Grid.Row="3" Background="Azure" Orientation="Horizontal" Margin="3">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<CheckBox IsChecked="{Binding FlowCallNode.IsShareParam, Mode=TwoWay}"/>
|
||||
<TextBlock Text="共享参数"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<CheckBox IsChecked="{Binding NodeModel.DebugSetting.IsEnable, Mode=TwoWay}"/>
|
||||
<TextBlock Text="是否使能"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<CheckBox IsChecked="{Binding NodeModel.DebugSetting.IsProtectionParameter, Mode=TwoWay}"/>
|
||||
<TextBlock Text="参数保护"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<CheckBox IsChecked="{Binding NodeModel.DebugSetting.IsInterrupt, Mode=TwoWay}"/>
|
||||
<TextBlock Text="中断节点"/>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
</local:NodeControlBase>
|
||||
|
||||
@@ -1,17 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Serein.Library;
|
||||
using Serein.Library.Api;
|
||||
using Serein.NodeFlow.Model;
|
||||
using Serein.Workbench.Node.ViewModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace Serein.Workbench.Node.View
|
||||
{
|
||||
@@ -20,17 +12,79 @@ namespace Serein.Workbench.Node.View
|
||||
/// </summary>
|
||||
public partial class FlowCallNodeControl : NodeControlBase, INodeJunction
|
||||
{
|
||||
private new FlowCallNodeControlViewModel ViewModel { get; set; }
|
||||
public FlowCallNodeControl()
|
||||
{
|
||||
var env = App.GetService<IFlowEnvironment>();
|
||||
base.ViewModel = new FlowCallNodeControlViewModel(new SingleFlowCallNode(env));
|
||||
base.ViewModel.IsEnabledOnView = false;
|
||||
DataContext = base.ViewModel;
|
||||
InitializeComponent();
|
||||
}
|
||||
public FlowCallNodeControl(FlowCallNodeControlViewModel viewModel) : base(viewModel)
|
||||
{
|
||||
DataContext = viewModel;
|
||||
ViewModel = viewModel;
|
||||
InitializeComponent();
|
||||
ViewModel.UploadMethodDetailsControl = UploadMethodDetailsControl;
|
||||
|
||||
public JunctionControlBase ExecuteJunction => throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public JunctionControlBase NextStepJunction => throw new NotImplementedException();
|
||||
private void UploadMethodDetailsControl(MethodDetails methodDetails)
|
||||
{
|
||||
//MethodDetailsControl.MethodDetails = methodDetails;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 入参控制点(可能有,可能没)
|
||||
/// </summary>
|
||||
JunctionControlBase INodeJunction.ExecuteJunction => this.ExecuteJunctionControl;
|
||||
|
||||
/// <summary>
|
||||
/// 下一个调用方法控制点(可能有,可能没)
|
||||
/// </summary>
|
||||
JunctionControlBase INodeJunction.NextStepJunction => throw new NotImplementedException("不存在下一个调用控制点");
|
||||
|
||||
/// <summary>
|
||||
/// 返回值控制点(可能有,可能没)
|
||||
/// </summary>
|
||||
JunctionControlBase INodeJunction.ReturnDataJunction => throw new NotImplementedException("不存在返回值控制点");
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 方法入参控制点(可能有,可能没)
|
||||
/// </summary>
|
||||
JunctionControlBase[] INodeJunction.ArgDataJunction => GetArgJunction();
|
||||
|
||||
private JunctionControlBase[] GetArgJunction()
|
||||
{
|
||||
// 获取 MethodDetailsControl 实例
|
||||
//var methodDetailsControl = ViewModel.NodeModel.IsShareParam ? this.SelectMethodDetailsControl : this.MyMethodDetailsControl;
|
||||
var methodDetailsControl = this.MethodDetailsControl;
|
||||
var itemsControl = FindVisualChild<ItemsControl>(methodDetailsControl); // 查找 ItemsControl
|
||||
if (itemsControl != null)
|
||||
{
|
||||
var argDataJunction = new JunctionControlBase[base.ViewModel.NodeModel.MethodDetails.ParameterDetailss.Length];
|
||||
var controls = new List<JunctionControlBase>();
|
||||
|
||||
for (int i = 0; i < itemsControl.Items.Count; i++)
|
||||
{
|
||||
var container = itemsControl.ItemContainerGenerator.ContainerFromIndex(i) as FrameworkElement;
|
||||
if (container != null)
|
||||
{
|
||||
var argControl = FindVisualChild<ArgJunctionControl>(container);
|
||||
if (argControl != null)
|
||||
{
|
||||
controls.Add(argControl); // 收集 ArgJunctionControl 实例
|
||||
}
|
||||
}
|
||||
}
|
||||
return argDataJunction = controls.ToArray();
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
public JunctionControlBase[] ArgDataJunction => throw new NotImplementedException();
|
||||
|
||||
public JunctionControlBase ReturnDataJunction => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Serein.NodeFlow.Model;
|
||||
using Serein.Library.Api;
|
||||
using Serein.NodeFlow.Model;
|
||||
using Serein.Workbench.Api;
|
||||
using Serein.Workbench.Node.ViewModel;
|
||||
|
||||
@@ -12,7 +13,8 @@ namespace Serein.Workbench.Node.View
|
||||
public GlobalDataControl() : base()
|
||||
{
|
||||
// 窗体初始化需要
|
||||
base.ViewModel = new GlobalDataNodeControlViewModel(new SingleGlobalDataNode(null));
|
||||
var env = App.GetService<IFlowEnvironment>();
|
||||
base.ViewModel = new GlobalDataNodeControlViewModel(new SingleGlobalDataNode(env));
|
||||
base.ViewModel.IsEnabledOnView = false;
|
||||
DataContext = ViewModel;
|
||||
InitializeComponent();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Serein.NodeFlow.Model;
|
||||
using Serein.Library.Api;
|
||||
using Serein.NodeFlow.Model;
|
||||
using Serein.Workbench.Node.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -24,7 +25,9 @@ namespace Serein.Workbench.Node.View
|
||||
{
|
||||
public NetScriptNodeControl()
|
||||
{
|
||||
base.ViewModel = new NetScriptNodeControlViewModel(new SingleNetScriptNode(null));
|
||||
|
||||
var env = App.GetService<IFlowEnvironment>();
|
||||
base.ViewModel = new NetScriptNodeControlViewModel(new SingleNetScriptNode(env));
|
||||
base.ViewModel.IsEnabledOnView = false;
|
||||
base.DataContext = ViewModel;
|
||||
InitializeComponent();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Serein.NodeFlow.Model;
|
||||
using Serein.Library.Api;
|
||||
using Serein.NodeFlow.Model;
|
||||
using Serein.Workbench.Node.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -29,7 +30,9 @@ namespace Serein.Workbench.Node.View
|
||||
|
||||
public ScriptNodeControl()
|
||||
{
|
||||
base.ViewModel = new ScriptNodeControlViewModel(null);
|
||||
|
||||
var env = App.GetService<IFlowEnvironment>();
|
||||
base.ViewModel = new ScriptNodeControlViewModel(new SingleScriptNode(env));
|
||||
base.ViewModel.IsEnabledOnView = false;
|
||||
base.DataContext = viewModel;
|
||||
InitializeComponent();
|
||||
@@ -68,39 +71,33 @@ namespace Serein.Workbench.Node.View
|
||||
/// <summary>
|
||||
/// 方法入参控制点(可能有,可能没)
|
||||
/// </summary>
|
||||
JunctionControlBase[] INodeJunction.ArgDataJunction
|
||||
{
|
||||
get
|
||||
{
|
||||
// 获取 MethodDetailsControl 实例
|
||||
var methodDetailsControl = this.MethodDetailsControl;
|
||||
var itemsControl = FindVisualChild<ItemsControl>(methodDetailsControl); // 查找 ItemsControl
|
||||
if (itemsControl != null && base.ViewModel.NodeModel.MethodDetails.ParameterDetailss != null)
|
||||
{
|
||||
var argDataJunction = new JunctionControlBase[base.ViewModel.NodeModel.MethodDetails.ParameterDetailss.Length];
|
||||
var controls = new List<JunctionControlBase>();
|
||||
JunctionControlBase[] INodeJunction.ArgDataJunction => GetArgJunction();
|
||||
|
||||
for (int i = 0; i < itemsControl.Items.Count; i++)
|
||||
private JunctionControlBase[] GetArgJunction()
|
||||
{
|
||||
// 获取 MethodDetailsControl 实例
|
||||
var methodDetailsControl = this.MethodDetailsControl;
|
||||
var itemsControl = FindVisualChild<ItemsControl>(methodDetailsControl); // 查找 ItemsControl
|
||||
if (itemsControl != null)
|
||||
{
|
||||
var argDataJunction = new JunctionControlBase[base.ViewModel.NodeModel.MethodDetails.ParameterDetailss.Length];
|
||||
var controls = new List<JunctionControlBase>();
|
||||
|
||||
for (int i = 0; i < itemsControl.Items.Count; i++)
|
||||
{
|
||||
var container = itemsControl.ItemContainerGenerator.ContainerFromIndex(i) as FrameworkElement;
|
||||
if (container != null)
|
||||
{
|
||||
var container = itemsControl.ItemContainerGenerator.ContainerFromIndex(i) as FrameworkElement;
|
||||
if (container != null)
|
||||
var argControl = FindVisualChild<ArgJunctionControl>(container);
|
||||
if (argControl != null)
|
||||
{
|
||||
var argControl = FindVisualChild<ArgJunctionControl>(container);
|
||||
if (argControl != null)
|
||||
{
|
||||
controls.Add(argControl); // 收集 ArgJunctionControl 实例
|
||||
}
|
||||
controls.Add(argControl); // 收集 ArgJunctionControl 实例
|
||||
}
|
||||
}
|
||||
return argDataJunction = controls.ToArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
return [];
|
||||
}
|
||||
return argDataJunction = controls.ToArray();
|
||||
}
|
||||
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,16 @@
|
||||
using Serein.NodeFlow.Model;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Serein.Library;
|
||||
using Serein.NodeFlow.Model;
|
||||
using Serein.Workbench.Api;
|
||||
using Serein.Workbench.Services;
|
||||
using Serein.Workbench.ViewModels;
|
||||
using Serein.Workbench.Views;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Security.Permissions;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -9,10 +18,101 @@ namespace Serein.Workbench.Node.ViewModel
|
||||
{
|
||||
public partial class FlowCallNodeControlViewModel : NodeControlViewModelBase
|
||||
{
|
||||
public new SingleFlowCallNode NodelModel { get; }
|
||||
/// <summary>
|
||||
/// 刷新方法控件
|
||||
/// </summary>
|
||||
public Action<MethodDetails> UploadMethodDetailsControl;
|
||||
|
||||
|
||||
[ObservableProperty]
|
||||
private SingleFlowCallNode flowCallNode;
|
||||
|
||||
/// <summary>
|
||||
/// 当前所选画布
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private FlowCanvasViewModel _selectCanvas;
|
||||
|
||||
/// <summary>
|
||||
/// 当前所选节点
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private NodeModelBase _selectNode;
|
||||
|
||||
|
||||
[ObservableProperty]
|
||||
private FlowCanvasViewModel[] canvass;
|
||||
|
||||
|
||||
|
||||
private readonly FlowNodeService flowNodeService;
|
||||
private readonly IFlowEEForwardingService flowEEForwardingService;
|
||||
|
||||
public FlowCallNodeControlViewModel(SingleFlowCallNode node) : base(node)
|
||||
{
|
||||
this.NodelModel = node;
|
||||
this.FlowCallNode = node;
|
||||
flowNodeService = App.GetService<FlowNodeService>();
|
||||
flowEEForwardingService = App.GetService<IFlowEEForwardingService>();
|
||||
RershCanvass(); // 首次加载
|
||||
InitNodeData();
|
||||
InitEvent();
|
||||
}
|
||||
private void InitNodeData()
|
||||
{
|
||||
if (string.IsNullOrEmpty(FlowCallNode.TargetNodeGuid))
|
||||
{
|
||||
return;
|
||||
}
|
||||
var targetNodeControl = flowNodeService.FlowNodeControls.FirstOrDefault(n => n.ViewModel.NodeModel.Guid.Equals(FlowCallNode.TargetNodeGuid));
|
||||
if (targetNodeControl is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (targetNodeControl.FlowCanvas is FlowCanvasView view
|
||||
&& view.DataContext is FlowCanvasViewModel viewModel)
|
||||
{
|
||||
SelectCanvas = viewModel;
|
||||
SelectNode = targetNodeControl.ViewModel.NodeModel;
|
||||
}
|
||||
}
|
||||
|
||||
private void InitEvent()
|
||||
{
|
||||
flowEEForwardingService.OnCanvasCreate += (e) => RershCanvass(); // 画布创建了
|
||||
flowEEForwardingService.OnCanvasRemove += (e) => RershCanvass(); // 画布移除了
|
||||
}
|
||||
|
||||
partial void OnSelectCanvasChanged(FlowCanvasViewModel value)
|
||||
{
|
||||
FlowCallNode.ResetTargetNode();
|
||||
}
|
||||
|
||||
partial void OnSelectNodeChanged(NodeModelBase value)
|
||||
{
|
||||
FlowCallNode.SetTargetNode(value);
|
||||
}
|
||||
|
||||
private void RershCanvass()
|
||||
{
|
||||
var canvass = flowNodeService.FlowCanvass.Select(f => (FlowCanvasViewModel)f.DataContext).ToArray(); // .Where(f => f.Model.PublicNodes.Count > 0)
|
||||
Canvass = canvass;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*private void RershMds()
|
||||
{
|
||||
if (NodeModel.IsShareParam && SelectNode is not null)
|
||||
{
|
||||
UploadMethodDetailsControl?.Invoke(SelectNode.MethodDetails);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
UploadMethodDetailsControl?.Invoke(base.NodeModel.MethodDetails);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user