using Serein.Library.Api; using Serein.NodeFlow.Model; using Serein.Workbench.Api; using Serein.Workbench.Node.ViewModel; namespace Serein.Workbench.Node.View { /// /// UserControl1.xaml 的交互逻辑 /// public partial class GlobalDataControl : NodeControlBase, INodeJunction, INodeContainerControl { public GlobalDataControl() : base() { // 窗体初始化需要 var env = App.GetService(); base.ViewModel = new GlobalDataNodeControlViewModel(new SingleGlobalDataNode(env)); base.ViewModel.IsEnabledOnView = false; base.ViewModel.NodeModel.DisplayName = "[全局数据]"; DataContext = ViewModel; InitializeComponent(); } public GlobalDataControl(GlobalDataNodeControlViewModel viewModel) : base(viewModel) { DataContext = viewModel; viewModel.NodeModel.DisplayName = "[全局数据]"; InitializeComponent(); } /// /// 入参控制点(可能有,可能没) /// JunctionControlBase INodeJunction.ExecuteJunction => this.ExecuteJunctionControl; /// /// 下一个调用方法控制点(可能有,可能没) /// JunctionControlBase INodeJunction.NextStepJunction => this.NextStepJunctionControl; /// /// 返回值控制点(可能有,可能没) /// JunctionControlBase INodeJunction.ReturnDataJunction => throw new NotImplementedException(); /// /// 方法入参控制点(可能有,可能没) /// JunctionControlBase[] INodeJunction.ArgDataJunction => throw new NotImplementedException(); public bool PlaceNode(NodeControlBase nodeControl) { if (GlobalDataPanel.Children.Contains(nodeControl)) { return false; } GlobalDataPanel.Children.Add(nodeControl); return true; } public bool TakeOutNode(NodeControlBase nodeControl) { if (!GlobalDataPanel.Children.Contains(nodeControl)) { return false; } GlobalDataPanel.Children.Remove(nodeControl); return true; } public void TakeOutAll() { GlobalDataPanel.Children.Clear(); } } }