コード例 #1
0
ファイル: FlowChart.xaml.cs プロジェクト: ChrDald/Jab.NET1
        protected override void OnNodeAdded(Node node)
        {
            base.OnNodeAdded(node);
            MyNodeData data = node.Data as MyNodeData;

            if (data == null)
            {
                return;
            }
            // look at the node's Figure
            switch (data.Figure)
            {
            case NodeFigure.Input:
            case NodeFigure.Output:
            case NodeFigure.ManualOperation: {
                FrameworkElement leftport = node.FindPort("2", false);
                if (leftport != null)
                {
                    SpotPanel.SetSpot(leftport, new Spot(0.05, 0.5, 1, 0));
                }
                FrameworkElement rightport = node.FindPort("3", false);
                if (rightport != null)
                {
                    SpotPanel.SetSpot(rightport, new Spot(0.95, 0.5, -1, 0));
                }
                break;
            }

            default: break;
            }
        }
コード例 #2
0
ファイル: FlowChart.xaml.cs プロジェクト: ChrDald/Jab.NET1
        public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            Link link = value as Link;

            if (link != null && link.FromNode != null)
            {
                MyNodeData d = link.FromNode.Data as MyNodeData;
                if (d != null && d.Key.StartsWith("Conditional"))
                {
                    return(Visibility.Visible);
                }
            }
            return(Visibility.Collapsed);
        }
コード例 #3
0
ファイル: FlowChart.xaml.cs プロジェクト: ChrDald/Jab.NET1
        public override bool IsValidLink(Node fromnode, FrameworkElement fromport, Node tonode, FrameworkElement toport)
        {
            if (!base.IsValidLink(fromnode, fromport, tonode, toport))
            {
                return(false);
            }
            // don't allow a link directly from Start to End
            MyNodeData fromnodedata = fromnode.Data as MyNodeData;
            MyNodeData tonodedata   = tonode.Data as MyNodeData;

            if (fromnodedata != null && fromnodedata.Category == "Start" &&
                tonodedata != null && tonodedata.Category == "End")
            {
                return(false);
            }
            return(true);
        }