定义嵌入式流程的编辑逻辑

This commit is contained in:
zengwenjie
2025-09-17 11:54:04 +08:00
parent 0f616421ec
commit 1df6b8862a
9 changed files with 174 additions and 3 deletions

View File

@@ -46,7 +46,7 @@ namespace Deedy.Activity
{ {
ToolTipService.SetInitialShowDelay(this, 0); ToolTipService.SetInitialShowDelay(this, 0);
ToolTipService.SetBetweenShowDelay(this, 0); ToolTipService.SetBetweenShowDelay(this, 0);
this.LogInfos = new LogInfoCollection(); this.LogInfos = new();
} }
public override void OnApplyTemplate() public override void OnApplyTemplate()
{ {
@@ -72,6 +72,7 @@ namespace Deedy.Activity
/// <returns>字段中的值</returns> /// <returns>字段中的值</returns>
protected virtual T GetField<T>(ref T field, [CallerMemberName] string? propertyName = null) protected virtual T GetField<T>(ref T field, [CallerMemberName] string? propertyName = null)
{ {
//TODO这里处理内部属性获取逻辑包括运行时参数映射逻辑
return field; return field;
} }
/// <summary> /// <summary>
@@ -85,6 +86,7 @@ namespace Deedy.Activity
protected virtual bool SetField<T>(ref T field, T value, [CallerMemberName] string? propertyName = null) protected virtual bool SetField<T>(ref T field, T value, [CallerMemberName] string? propertyName = null)
{ {
if (EqualityComparer<T>.Default.Equals(field, value)) return false; if (EqualityComparer<T>.Default.Equals(field, value)) return false;
//TODO这里处理内部属性变更逻辑包括运行时参数映射逻辑
field = value; field = value;
OnPropertyChanged(propertyName); OnPropertyChanged(propertyName);
return true; return true;
@@ -294,8 +296,28 @@ namespace Deedy.Activity
protected internal set { SetValue(IsSelectedPropertyKey, value); } protected internal set { SetValue(IsSelectedPropertyKey, value); }
} }
public static readonly DependencyPropertyKey IsSelectedPropertyKey = public static readonly DependencyPropertyKey IsSelectedPropertyKey =
DependencyProperty.RegisterReadOnly("IsSelected", typeof(bool), typeof(ActionViewer), new PropertyMetadata(false)); DependencyProperty.RegisterReadOnly("IsSelected", typeof(bool), typeof(ActionViewer), new PropertyMetadata(false,
(d, e) => (d as ActionViewer)?.IsSelected_PropertyChangedCallback(e)));
public static readonly DependencyProperty IsSelectedProperty = IsSelectedPropertyKey.DependencyProperty; public static readonly DependencyProperty IsSelectedProperty = IsSelectedPropertyKey.DependencyProperty;
/// <summary>
/// 处理「ActionViewer.IsSelected」属性变更
/// </summary>
protected virtual void IsSelected_PropertyChangedCallback(DependencyPropertyChangedEventArgs e)
{
if ((bool)e.NewValue)
{
//TODO发送节点选中事件
if (this.ActionElement is IContainerForFunction container)
{
if (container.IsEmbedded) this.IsExpanded = true;
else
{
//TODO发送打开辅助编辑器事件
}
}
}
this.RefreshViewerState();
}
/// <summary> /// <summary>
/// 是否可被展开 /// 是否可被展开
@@ -546,7 +568,7 @@ namespace Deedy.Activity
if (newValue.IsLockedElement) if (newValue.IsLockedElement)
{ {
this.IsDraggable = false; this.IsDraggable = false;
this.IsSelectable = false; this.IsSelectable = newValue is IContainerForFunction;
} }
else else
{ {
@@ -577,6 +599,7 @@ namespace Deedy.Activity
// 新元素被托管渲染后调整子元素退出线位置 // 新元素被托管渲染后调整子元素退出线位置
withExitline.AdjustExitlinePosition(); withExitline.AdjustExitlinePosition();
} }
if (newValue is ILogicController logicController) if (newValue is ILogicController logicController)
{ {
switch (logicController.LogicalBehavior) switch (logicController.LogicalBehavior)

View File

@@ -55,6 +55,7 @@ namespace Deedy.Activity
/// <returns>字段中的值</returns> /// <returns>字段中的值</returns>
protected virtual T GetField<T>(ref T field, [CallerMemberName] string? propertyName = null) protected virtual T GetField<T>(ref T field, [CallerMemberName] string? propertyName = null)
{ {
//TODO这里处理内部属性获取逻辑包括运行时参数映射逻辑
return field; return field;
} }
/// <summary> /// <summary>
@@ -68,6 +69,7 @@ namespace Deedy.Activity
protected virtual bool SetField<T>(ref T field, T value, [CallerMemberName] string? propertyName = null) protected virtual bool SetField<T>(ref T field, T value, [CallerMemberName] string? propertyName = null)
{ {
if (EqualityComparer<T>.Default.Equals(field, value)) return false; if (EqualityComparer<T>.Default.Equals(field, value)) return false;
//TODO这里处理内部属性变更逻辑包括运行时参数映射逻辑
field = value; field = value;
OnPropertyChanged(propertyName); OnPropertyChanged(propertyName);
return true; return true;

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows;
namespace Deedy.Activity namespace Deedy.Activity
{ {
@@ -10,5 +11,7 @@ namespace Deedy.Activity
{ {
public DragDropData() { } public DragDropData() { }
public DropPlacement Placement { get; set; } public DropPlacement Placement { get; set; }
public DragDropEffects DragEffect { get; set; }
public DragDropEffects DropEffects { get; set; }
} }
} }

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Deedy.Activity
{
public interface IContainerForFunction : IContainerElement
{
/// <summary>
/// 是否为嵌入式功能容器
/// <para>True不需要打开独立编辑器选中时展开手动折叠</para>
/// <para>False选中时需要打开独立编辑器手动关闭有多个选项卡可以同时打开多个编辑器</para>
/// </summary>
public bool IsEmbedded { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Deedy.Activity
{
public interface IFunctionAction : IElement
{
//TODO这里需要定义信道延迟执行与定时执行等参数
}
}

View File

@@ -0,0 +1,12 @@
<UserControl x:Class="Deedy.Activity.ActionDesigner"
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:Deedy.Activity"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
</Grid>
</UserControl>

View File

@@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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 Deedy.Activity
{
/// <summary>
/// ActionDesigner.xaml 的交互逻辑
/// </summary>
public partial class ActionDesigner : UserControl
{
private bool _PassthroughOpenDesignerEvent;
public ActionDesigner()
{
InitializeComponent();
}
public ActionDesigner(IActionElement actionElement, bool passthroughOpenEvent = false) : this()
{
this.ActionElement = actionElement;
this._PassthroughOpenDesignerEvent = passthroughOpenEvent;
}
/// <summary>
/// 被托管的动作元素
/// </summary>
public IActionElement ActionElement
{
get { return (IActionElement)GetValue(ActionElementProperty); }
set { SetValue(ActionElementProperty, value); }
}
public static readonly DependencyProperty ActionElementProperty =
DependencyProperty.Register("ActionElement", typeof(IActionElement), typeof(ActionDesigner), new PropertyMetadata(null,
(d, e) => (d as ActionDesigner)?.ActionElement_PropertyChangedCallback(e)));
/// <summary>
/// 处理「ActionDesigner.ActionElement」属性变更
/// </summary>
protected virtual void ActionElement_PropertyChangedCallback(DependencyPropertyChangedEventArgs e)
{
if (e.OldValue == e.NewValue) return;
if (e.OldValue is IActionElement oldValue)
{
//TODO解绑事件监听器
}
if (e.NewValue is IActionElement newValue)
{
//TODO绑定事件监听器
}
}
}
}

View File

@@ -0,0 +1,12 @@
<UserControl x:Class="Deedy.Activity.VisualDesigner"
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:Deedy.Activity"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
</Grid>
</UserControl>

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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 Deedy.Activity
{
/// <summary>
/// VisualDesigner.xaml 的交互逻辑
/// </summary>
public partial class VisualDesigner : UserControl
{
public VisualDesigner()
{
InitializeComponent();
}
}
}