partial void InitConstruction() { Resources = new ResourceDictionary() { Source = new Uri("pack://application:,,,/CodeGenerateSystem;component/Themes/Generic.xaml", UriKind.Absolute), }; mPanel = new StackPanel() { Orientation = Orientation.Horizontal, Margin = new Thickness(0, 0, 8, 8), }; AddChild(mPanel); mElemPin = new CodeGenerateSystem.Controls.LinkOutControl() { HorizontalAlignment = HorizontalAlignment.Center, Direction = CodeGenerateSystem.Base.enBezierType.Right, PinType = CodeGenerateSystem.Base.LinkPinControl.enPinType.Exec, }; mPanel.Children.Add(mElemPin); mElemPin.NameString = "[0]"; mElemPin.OnCollectionContextMenus = (CodeGenerateSystem.Base.LinkPinControl linkControl) => { mElemPin.AddContextMenuItem("移除节点", "Sequence", (obj, arg) => { RemoveFromParent(); ((Sequence)ParentNode).UpdateElementIndexes(); }); }; }
partial void InitConstruction() { Resources = new ResourceDictionary() { Source = new Uri("pack://application:,,,/CodeGenerateSystem;component/Themes/Generic.xaml", UriKind.Absolute), }; NodeType = enNodeType.ChildNode; var grid = new Grid(); grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1.0f, GridUnitType.Auto) }); grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1.0f, GridUnitType.Auto) }); grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1.0f, GridUnitType.Star) }); AddChild(grid); mCasePin = new CodeGenerateSystem.Controls.LinkInControl() { Margin = new Thickness(8, 3, 3, 3), NameString = "case", HorizontalAlignment = HorizontalAlignment.Left, Direction = CodeGenerateSystem.Base.enBezierType.Left, }; mCasePin.OnCollectionContextMenus = (CodeGenerateSystem.Base.LinkPinControl linkControl) => { mCasePin.AddContextMenuItem("移除节点", "switch", (obj, arg) => { RemoveFromParent(); }); }; grid.Children.Add(mCasePin); Grid.SetColumn(mCasePin, 0); mValueGrid = new Grid(); grid.Children.Add(mValueGrid); Grid.SetColumn(mValueGrid, 1); mCaseMethod = new CodeGenerateSystem.Controls.LinkOutControl() { Margin = new Thickness(8, 3, 8, 3), HorizontalAlignment = HorizontalAlignment.Right, Direction = CodeGenerateSystem.Base.enBezierType.Right, PinType = CodeGenerateSystem.Base.LinkPinControl.enPinType.Exec, }; grid.Children.Add(mCaseMethod); Grid.SetColumn(mCaseMethod, 2); }
private void AddLink(int nIdx, string strType, string strName, string strAttribute) { // half在显示时使用float var showType = strType.Replace("half", "float"); //var splits = strAttribute.Split('|'); if (string.IsNullOrEmpty(strAttribute)) { var ellipse = new CodeGenerateSystem.Controls.LinkInControl() { Margin = new System.Windows.Thickness(8), BackBrush = Program.GetBrushFromValueType(strType, this), HorizontalAlignment = HorizontalAlignment.Left, Direction = enBezierType.Left, NameString = strName + "(" + showType + ")", }; AddLinkPinInfo(strType + "_" + strName, ellipse, null); StackPanel_InValue.Children.Add(ellipse); stParamData parData = new stParamData() { mPos = nIdx, mStrName = strName, mStrType = strType, mStrAttribute = "", mInElement = ellipse }; mInParamDataList.Add(parData); } else if (strAttribute == "out") { var rect = new CodeGenerateSystem.Controls.LinkOutControl() { Margin = new System.Windows.Thickness(8), BackBrush = Program.GetBrushFromValueType(strType, this), HorizontalAlignment = HorizontalAlignment.Right, Direction = enBezierType.Right, NameString = strName + "(" + showType + ")", }; AddLinkPinInfo(strType + "_" + strName, rect, rect.BackBrush); StackPanel_OutValue.Children.Add(rect); stParamData ovData = new stParamData() { mPos = nIdx, mStrName = strName, mStrType = strType, mStrAttribute = strAttribute, mOutElement = rect }; mInParamDataList.Add(ovData); mOnlyOutParamDataList.Add(ovData); mOutValueDataDictionary[rect] = ovData; } else if (strAttribute == "inout") { var ellipse = new CodeGenerateSystem.Controls.LinkInControl() { Margin = new System.Windows.Thickness(8), BackBrush = Program.GetBrushFromValueType(strType, this), HorizontalAlignment = HorizontalAlignment.Left, Direction = enBezierType.Left, NameString = strName + "(" + showType + ")", }; AddLinkPinInfo(strType + "_" + strName + "_in", ellipse, null); StackPanel_InValue.Children.Add(ellipse); var rect = new CodeGenerateSystem.Controls.LinkOutControl() { Margin = new System.Windows.Thickness(8), BackBrush = Program.GetBrushFromValueType(strType, this), HorizontalAlignment = HorizontalAlignment.Right, Direction = enBezierType.Right, NameString = strName + "(" + showType + ")", }; Grid.SetColumn(rect, 1); AddLinkPinInfo(strType + "_" + strName + "_out", rect, rect.BackBrush); StackPanel_OutValue.Children.Add(rect); stParamData parData = new stParamData() { mPos = nIdx, mStrName = strName, mStrType = strType, mStrAttribute = strAttribute, mInElement = ellipse, mOutElement = rect, }; mInParamDataList.Add(parData); stParamData ovData = new stParamData() { mPos = nIdx, mStrName = strName, mStrType = strType, mStrAttribute = strAttribute, mInElement = ellipse, mOutElement = rect }; mOutValueDataDictionary[rect] = ovData; } else if (strAttribute == "return") { var rect = new CodeGenerateSystem.Controls.LinkOutControl() { Margin = new System.Windows.Thickness(8), BackBrush = Program.GetBrushFromValueType(strType, this), HorizontalAlignment = HorizontalAlignment.Right, Direction = enBezierType.Right, NameString = "Return(" + showType + ")", }; Grid.SetColumn(rect, 1); AddLinkPinInfo(strType + "_" + strName, rect, rect.BackBrush); mReturnValueHandle = rect; StackPanel_OutValue.Children.Add(rect); stParamData ovData = new stParamData() { mPos = nIdx, mStrName = strName, mStrType = strType, mStrAttribute = strAttribute, mOutElement = rect }; mOutValueDataDictionary[rect] = ovData; } }