Пример #1
0
        private void _canvas_DragLineCompleted(object sender, CanvasDragLineCompletedEventArgs e)
        {
            var source = BlockControl.GetBlockControl(e.Source);
            var sink   = BlockControl.GetBlockControl(e.Sink);

            var relation = new BlockRelation
            {
                FromBlock = source.TypeFullName,
                ToBlock   = sink.TypeFullName
            };

            this.Relations.Insert(0, relation);

            this.OnRelationAdded(relation);
        }
Пример #2
0
 /// <summary>
 /// 绑定 From、To
 /// </summary>
 /// <param name="from"></param>
 /// <param name="to"></param>
 private void BindBlocks()
 {
     ResetSource();
     ResetSink();
     _connection.SourceChanged += (o, e) =>
     {
         var sourceBlock = BlockControl.GetBlockControl(_connection.Source);
         this.FromBlock = sourceBlock.TypeFullName;
     };
     _connection.SinkChanged += (o, e) =>
     {
         var sinkBlock = BlockControl.GetBlockControl(_connection.Sink);
         this.ToBlock = sinkBlock.TypeFullName;
     };
 }