public void Bind2D()
        {
            IMultiDimensionalArray array = new MultiDimensionalArray();
            array.Resize(2, 2);
            array[0, 0] = 5;
            array[1, 1] = 2;

            DataGridView gridView = new DataGridView();

            MultiDimensionalArrayBindingList multiDimensionalArrayBindingList = new MultiDimensionalArrayBindingList(array);
            gridView.DataSource = multiDimensionalArrayBindingList;

            Form form = new Form();
            gridView.Dock = DockStyle.Fill;
            form.Controls.Add(gridView);
            
            WindowsFormsTestHelper.ShowModal(form);
        }
        public void Bind3DArrayUsing2DView()
        {
            IMultiDimensionalArray array = new MultiDimensionalArray(3, 3, 3);
            array[0, 0, 0] = 1;
            array[1, 1, 1] = 2;

            IMultiDimensionalArrayView view = array.Select(0, 0, 0);
            view.Reduce[0] = true; // reduce 1st dimension

            DataGridView gridView = new DataGridView();

            MultiDimensionalArrayBindingList multiDimensionalArrayBindingList = new MultiDimensionalArrayBindingList(view);
            gridView.DataSource = multiDimensionalArrayBindingList;

            Form form = new Form();
            gridView.Dock = DockStyle.Fill;
            form.Controls.Add(gridView);
            
            WindowsFormsTestHelper.ShowModal(form);
        }
 internal MultiDimensionalArrayBindingListRow(MultiDimensionalArrayBindingList owner, int index, bool addingNew)
 {
     this.owner = owner;
     this.index = index;
     this.addingNew = addingNew;
 }
        public void RemoveRow()
        {
            int[] lengths = new[] { 2, 3 };
            IMultiDimensionalArray array = new MultiDimensionalArray(lengths);

            array[0, 0] = 1;
            array[0, 1] = 2;
            array[0, 2] = 3;

            array[1, 0] = 4;
            array[1, 1] = 5;
            array[1, 2] = 6;

            IMultiDimensionalArrayBindingList bindingList = new MultiDimensionalArrayBindingList(array);
            bindingList.RemoveAt(1);

            int expectedRowsCount = 2;
            Assert.AreEqual(expectedRowsCount, array.Shape[bindingList.RowDimension]);
        }
Ejemplo n.º 5
0
 internal MultiDimensionalArrayBindingListRow(MultiDimensionalArrayBindingList owner, int index, bool addingNew)
 {
     this.owner     = owner;
     this.index     = index;
     this.addingNew = addingNew;
 }