diff --git a/DeedyDesigner/Deedy.Activity/ActionViewer.cs b/DeedyDesigner/Deedy.Activity/ActionViewer.cs index 944f968..b02dad9 100644 --- a/DeedyDesigner/Deedy.Activity/ActionViewer.cs +++ b/DeedyDesigner/Deedy.Activity/ActionViewer.cs @@ -46,7 +46,7 @@ namespace Deedy.Activity { ToolTipService.SetInitialShowDelay(this, 0); ToolTipService.SetBetweenShowDelay(this, 0); - this.LogInfos = new LogInfoCollection(); + this.LogInfos = new(); } public override void OnApplyTemplate() { @@ -72,6 +72,7 @@ namespace Deedy.Activity /// 字段中的值 protected virtual T GetField(ref T field, [CallerMemberName] string? propertyName = null) { + //TODO:这里处理内部属性获取逻辑(包括运行时参数映射逻辑) return field; } /// @@ -85,6 +86,7 @@ namespace Deedy.Activity protected virtual bool SetField(ref T field, T value, [CallerMemberName] string? propertyName = null) { if (EqualityComparer.Default.Equals(field, value)) return false; + //TODO:这里处理内部属性变更逻辑(包括运行时参数映射逻辑) field = value; OnPropertyChanged(propertyName); return true; @@ -294,8 +296,28 @@ namespace Deedy.Activity protected internal set { SetValue(IsSelectedPropertyKey, value); } } 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; + /// + /// 处理「ActionViewer.IsSelected」属性变更 + /// + 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(); + } /// /// 是否可被展开 @@ -546,7 +568,7 @@ namespace Deedy.Activity if (newValue.IsLockedElement) { this.IsDraggable = false; - this.IsSelectable = false; + this.IsSelectable = newValue is IContainerForFunction; } else { @@ -577,6 +599,7 @@ namespace Deedy.Activity // 新元素被托管渲染后调整子元素退出线位置 withExitline.AdjustExitlinePosition(); } + if (newValue is ILogicController logicController) { switch (logicController.LogicalBehavior) diff --git a/DeedyDesigner/Deedy.Activity/BasalAction.cs b/DeedyDesigner/Deedy.Activity/BasalAction.cs index 518f3eb..0a07465 100644 --- a/DeedyDesigner/Deedy.Activity/BasalAction.cs +++ b/DeedyDesigner/Deedy.Activity/BasalAction.cs @@ -55,6 +55,7 @@ namespace Deedy.Activity /// 字段中的值 protected virtual T GetField(ref T field, [CallerMemberName] string? propertyName = null) { + //TODO:这里处理内部属性获取逻辑(包括运行时参数映射逻辑) return field; } /// @@ -68,6 +69,7 @@ namespace Deedy.Activity protected virtual bool SetField(ref T field, T value, [CallerMemberName] string? propertyName = null) { if (EqualityComparer.Default.Equals(field, value)) return false; + //TODO:这里处理内部属性变更逻辑(包括运行时参数映射逻辑) field = value; OnPropertyChanged(propertyName); return true; diff --git a/DeedyDesigner/Deedy.Activity/Contract/Entities/DragDropData.cs b/DeedyDesigner/Deedy.Activity/Contract/Entities/DragDropData.cs index f2d6491..4e0fe2e 100644 --- a/DeedyDesigner/Deedy.Activity/Contract/Entities/DragDropData.cs +++ b/DeedyDesigner/Deedy.Activity/Contract/Entities/DragDropData.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows; namespace Deedy.Activity { @@ -10,5 +11,7 @@ namespace Deedy.Activity { public DragDropData() { } public DropPlacement Placement { get; set; } + public DragDropEffects DragEffect { get; set; } + public DragDropEffects DropEffects { get; set; } } } diff --git a/DeedyDesigner/Deedy.Activity/Contract/Interface/IContainerForFunction.cs b/DeedyDesigner/Deedy.Activity/Contract/Interface/IContainerForFunction.cs new file mode 100644 index 0000000..66d679a --- /dev/null +++ b/DeedyDesigner/Deedy.Activity/Contract/Interface/IContainerForFunction.cs @@ -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 + { + /// + /// 是否为嵌入式功能容器 + /// True:不需要打开独立编辑器,选中时展开,手动折叠 + /// False:选中时需要打开独立编辑器,手动关闭(有多个选项卡;即,可以同时打开多个编辑器) + /// + public bool IsEmbedded { get; set; } + } +} diff --git a/DeedyDesigner/Deedy.Activity/Contract/Interface/IFunctionAction.cs b/DeedyDesigner/Deedy.Activity/Contract/Interface/IFunctionAction.cs new file mode 100644 index 0000000..620fdde --- /dev/null +++ b/DeedyDesigner/Deedy.Activity/Contract/Interface/IFunctionAction.cs @@ -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:这里需要定义信道,延迟执行与定时执行等参数 + } +} diff --git a/DeedyDesigner/Deedy.Activity/Designer/ActionDesigner.xaml b/DeedyDesigner/Deedy.Activity/Designer/ActionDesigner.xaml new file mode 100644 index 0000000..aa71c22 --- /dev/null +++ b/DeedyDesigner/Deedy.Activity/Designer/ActionDesigner.xaml @@ -0,0 +1,12 @@ + + + + + diff --git a/DeedyDesigner/Deedy.Activity/Designer/ActionDesigner.xaml.cs b/DeedyDesigner/Deedy.Activity/Designer/ActionDesigner.xaml.cs new file mode 100644 index 0000000..4c0a91e --- /dev/null +++ b/DeedyDesigner/Deedy.Activity/Designer/ActionDesigner.xaml.cs @@ -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 +{ + /// + /// ActionDesigner.xaml 的交互逻辑 + /// + 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; + } + /// + /// 被托管的动作元素 + /// + 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))); + /// + /// 处理「ActionDesigner.ActionElement」属性变更 + /// + 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:绑定事件监听器 + } + } + } +} diff --git a/DeedyDesigner/Deedy.Activity/Designer/VisualDesigner.xaml b/DeedyDesigner/Deedy.Activity/Designer/VisualDesigner.xaml new file mode 100644 index 0000000..198675e --- /dev/null +++ b/DeedyDesigner/Deedy.Activity/Designer/VisualDesigner.xaml @@ -0,0 +1,12 @@ + + + + + diff --git a/DeedyDesigner/Deedy.Activity/Designer/VisualDesigner.xaml.cs b/DeedyDesigner/Deedy.Activity/Designer/VisualDesigner.xaml.cs new file mode 100644 index 0000000..093b023 --- /dev/null +++ b/DeedyDesigner/Deedy.Activity/Designer/VisualDesigner.xaml.cs @@ -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 +{ + /// + /// VisualDesigner.xaml 的交互逻辑 + /// + public partial class VisualDesigner : UserControl + { + public VisualDesigner() + { + InitializeComponent(); + } + } +}