Example #1
0
        private List <Rectangle> UpdateBlobPostion(List <Rectangle> list)
        {
            if (BlobRects == null)
            {
                return(new List <Rectangle>());
            }

            MovingBlobCollection movingBlobs = new MovingBlobCollection(list, BlobRects.ToList());

            movingBlobs.OrderByDescending(x => x.Height * x.Width);

            // Clear Bindings

            left.DataBindings.Clear();
            top.DataBindings.Clear();
            width.DataBindings.Clear();
            height.DataBindings.Clear();

            motionX.DataBindings.Clear();
            motionY.DataBindings.Clear();
            direction.DataBindings.Clear();

            // Add new postion data to the repeater collection

            left.DataBindings.Add(new Binding("Text", movingBlobs, "Left"));
            top.DataBindings.Add(new Binding("Text", movingBlobs, "Top"));
            height.DataBindings.Add(new Binding("Text", movingBlobs, "Height"));
            width.DataBindings.Add(new Binding("Text", movingBlobs, "Width"));

            motionX.DataBindings.Add(new Binding("Text", movingBlobs, "MotionLeft"));
            motionY.DataBindings.Add(new Binding("Text", movingBlobs, "MotionTop"));
            direction.DataBindings.Add(new Binding("Text", movingBlobs, "Direction"));

            if (dataRepeater1.Enabled)
            {
                // databind the list as a datasource.

                dataRepeater1.Invoke((MethodInvoker) delegate { dataRepeater1.DataSource = movingBlobs; });
            }
            return(list);
        }
Example #2
0
        private List<Rectangle> UpdateBlobPostion(List<Rectangle> list)
        {
            if(BlobRects == null) return new List<Rectangle>();

            MovingBlobCollection movingBlobs = new MovingBlobCollection(list, BlobRects.ToList());

            movingBlobs.OrderByDescending(x => x.Height * x.Width);

            // Clear Bindings

            left.DataBindings.Clear();
            top.DataBindings.Clear();
            width.DataBindings.Clear();
            height.DataBindings.Clear();

            motionX.DataBindings.Clear();
            motionY.DataBindings.Clear();
            direction.DataBindings.Clear();

            // Add new postion data to the repeater collection

            left.DataBindings.Add(new Binding("Text", movingBlobs, "Left"));
            top.DataBindings.Add(new Binding("Text", movingBlobs, "Top"));
            height.DataBindings.Add(new Binding("Text", movingBlobs, "Height"));
            width.DataBindings.Add(new Binding("Text", movingBlobs, "Width"));

            motionX.DataBindings.Add(new Binding("Text", movingBlobs, "MotionLeft"));
            motionY.DataBindings.Add(new Binding("Text", movingBlobs, "MotionTop"));
            direction.DataBindings.Add(new Binding("Text", movingBlobs, "Direction"));

            if (dataRepeater1.Enabled)
            {
                // databind the list as a datasource.

                dataRepeater1.Invoke((MethodInvoker)delegate { dataRepeater1.DataSource = movingBlobs; });
            }
            return list;
        }