public void Init()
        {
            if (_blockA != null)
            {
                _blockA.Complete();
            }

            Data = new DataflowVisitor();

            _blockA = new BufferBlock <int>(BLOCK_OPTIONS)
                      .Hook("Buffer", Data, 10, 10, Colors.SteelBlue);
            _blockA.AddCommand("Add Item", PostACommand);

            _blockB = new BufferBlock <int>(BLOCK_OPTIONS)
                      .Hook("Buffer", Data, 10, 400, Color.FromRgb(0x3D, 0x04, 0x60));
            _blockB.AddCommand("Add Item", PostBCommand);

            _block3 = new ActionBlock <int>(i =>
            {
                ReflectBlockExtensions.ProcessItem(i, _sync, _block3.BlockInfo);
            }, BLOCK_OPTIONS)
                      .Hook("Action", Data, 600, 200);
            _block3.AddCommand("Release One", ReleaseSingleProcessingTaskCommand);

            _blockA.LinkCandidate(_block3, LINK_OPTIONS);
            _blockB.LinkCandidate(_block3, LINK_OPTIONS);

            //_toolbar.DataContext = this;
        }
Example #2
0
        public void Init()
        {
            if (_sourceBlock != null)
            {
                _sourceBlock.Complete();
            }

            Data = new DataflowVisitor();

            _sourceBlock = new BufferBlock <int>()
                           .Hook("Buffer", Data, 10, 300, Colors.SteelBlue);
            _sourceBlock.AddCommand("Add Item", PostCommand);

            // TODO: know complete processing counter
            _block = new TransformBlock <int, string>(i =>
            {
                ReflectBlockExtensions.ProcessItem(i, _sync, _block.BlockInfo);
                return(new string('*', i));
            }, BLOCK_OPTIONS)
                     .Hook("Transform", Data, 500, 10);
            _block.AddCommand("Release One", ReleaseSingleProcessingTaskCommand);

            var nullTarget = DataflowBlock.NullTarget <int>()
                             .Hook("NullTarget", Data, 500, 500);

            _nullTarget = DataflowBlock.NullTarget <string>()
                          .Hook("NullTarget", Data, 900, 200);

            _sourceBlock.LinkTo(_block, LINK_OPTIONS);
            _unlinkGarbage = _sourceBlock.LinkTo(nullTarget, LINK_OPTIONS);

            _block.LinkCandidate(_nullTarget, LINK_OPTIONS);

            //_toolbar.DataContext = this;
        }
Example #3
0
        public void Init()
        {
            if (_source != null)
            {
                _source.Complete();
            }

            Data = new DataflowVisitor();

            _source = new BufferBlock <int>(BLOCK_OPTIONS)
                      .Hook("Buffer", Data, 100, 10, Colors.SteelBlue);
            _source.AddCommand("Add Item", PostCommand);

            _target = new ActionBlock <int>(i =>
            {
                ReflectBlockExtensions.ProcessItem(i, _sync, _target.BlockInfo);
            }, BLOCK_OPTIONS)
                      .Hook("Action", Data, 600, 200);
            _target.AddCommand("Release One", ReleaseSingleProcessingTaskCommand);

            _source.LinkCandidate(_target, LINK_OPTIONS);

            //_toolbar.DataContext = this;
        }