Beispiel #1
0
 public void JoinTo(Box box)
 {
     this._list.Add(box);
     box._list.Add(this);
 }
        private void init_Space()
        {
            for (int i = 0; i < rows; i++)
            {
                StackPanel sp = new StackPanel();
                sp.Orientation = System.Windows.Controls.Orientation.Horizontal;
                for (int j = 0; j < columns; j++)
                {
                    box_collections[i, j] = new Box();
                    box_collections[i, j].Tap += box_Tap;

                    sp.Children.Add(box_collections[i, j]);
                    if (i > 0)
                        box_collections[i - 1, j].JoinTo(box_collections[i, j]);
                    if (j > 0)
                        box_collections[i, j - 1].JoinTo(box_collections[i, j]);

                    _box_collections[i, j] = new Box();
                }
                panel.Children.Add(sp);
            }
        }