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;
        }
Пример #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;
        }
Пример #3
0
        private void Init()
        {
            if (_sourceBlock != null)
            {
                _sourceBlock.Complete();
            }

            Data = new DataflowVisitor();

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

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

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

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

            //_toolbar.DataContext = this;
        }
Пример #4
0
        public void Init()
        {
            Data = new DataflowVisitor();

            _blockFull = new BufferBlock <int>(BLOCK_OPTIONS)
                         .Hook("Full", Data, 10, 10, Colors.SteelBlue);

            _blockEmpty = new BufferBlock <int>(BLOCK_OPTIONS)
                          .Hook("Empty", Data, 10, 450, Color.FromRgb(0x3D, 0x04, 0x60));

            _blockTarget = new ActionBlock <int>(i =>
            {
                ReflectBlockExtensions.ProcessItem(i, _sync, _blockTarget.BlockInfo);
            }, BLOCK_OPTIONS)
                           .Hook("Target", Data, 400, 200);

            _blockEmpty.AddCommand("Offer Empty", OfferEmptyCommand);
            _blockFull.AddCommand("Offer Full", OfferFullCommand);
            _blockTarget.AddCommand("Release One", ReleaseSingleProcessingTaskCommand);

            //_toolbar.DataContext = this;
        }
Пример #5
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;
        }