Exemplo n.º 1
0
 private void CreateLightBoxes()
 {
     for (int row = 0; row < BlackboxConfig.GameBoardRow; row++)
     {
         for (int column = 0; column < BlackboxConfig.GameBoardColumn; column++)
         {
             if (((row == 0) && (column > 0 && column < BlackboxConfig.GameBoardColumn - 1)) ||
                 ((row == BlackboxConfig.GameBoardRow - 1) && (column > 0 && column < BlackboxConfig.GameBoardColumn - 1)) ||
                 ((column == 0) && (row > 0 && row < BlackboxConfig.GameBoardRow - 1)) ||
                 ((column == BlackboxConfig.GameBoardColumn - 1) && (row > 0 && row < BlackboxConfig.GameBoardRow - 1)))
             {
                 _boxs[row, column] = new LightBoxView();
                 _boxs[row, column].HorizontalAlignment = HorizontalAlignment.Left;
                 _boxs[row, column].VerticalAlignment   = VerticalAlignment.Top;
                 _boxs[row, column].Width  = BlackboxConfig.BoxWidth;
                 _boxs[row, column].Height = BlackboxConfig.BoxHeight;
                 _boxs[row, column].Margin =
                     new Thickness(row * BlackboxConfig.BoxWidth,
                                   column * BlackboxConfig.BoxHeight, 0, 0);
                 _boxs[row, column].Projection  = new PlaneProjection();
                 _boxs[row, column].DataContext = _model.Boxes[row, column];
                 Binding binding = new Binding();
                 binding.Source = _model.Boxes[row, column];
                 binding.Path   = new PropertyPath("BaseData");
                 binding.Mode   = BindingMode.OneWay;
                 _boxs[row, column].SetBinding(BoxView.StateValueProperty, binding);
                 _boxs[row, column].image.Tap += new EventHandler <GestureEventArgs>(_model.OnTap);
                 this.LayoutRoot.Children.Add(_boxs[row, column]);
             }
         }
     }
 }
Exemplo n.º 2
0
 private void CreateLightBoxes()
 {
     for (int row = 0; row < BlackboxConfig.GameBoardRow; row++)
     {
         for (int column = 0; column < BlackboxConfig.GameBoardColumn; column++)
         {
             if (((row == 0) && (column > 0 && column < BlackboxConfig.GameBoardColumn - 1)) ||
                 ((row == BlackboxConfig.GameBoardRow - 1) && (column > 0 && column < BlackboxConfig.GameBoardColumn - 1)) ||
                 ((column == 0) && (row > 0 && row < BlackboxConfig.GameBoardRow - 1)) ||
                 ((column == BlackboxConfig.GameBoardColumn - 1) && (row > 0 && row < BlackboxConfig.GameBoardRow - 1)))
             {
                 _boxs[row, column] = new LightBoxView();
                 _boxs[row, column].HorizontalAlignment = HorizontalAlignment.Left;
                 _boxs[row, column].VerticalAlignment = VerticalAlignment.Top;
                 _boxs[row, column].Width = BlackboxConfig.BoxWidth;
                 _boxs[row, column].Height = BlackboxConfig.BoxHeight;
                 _boxs[row, column].Margin =
                     new Thickness(row * BlackboxConfig.BoxWidth,
                         column * BlackboxConfig.BoxHeight, 0, 0);
                 _boxs[row, column].Projection = new PlaneProjection();
                 _boxs[row, column].DataContext = _model.Boxes[row, column];
                 Binding binding = new Binding();
                 binding.Source = _model.Boxes[row, column];
                 binding.Path = new PropertyPath("BaseData");
                 binding.Mode = BindingMode.OneWay;
                 _boxs[row, column].SetBinding(BoxView.StateValueProperty, binding);
                 _boxs[row, column].image.Tap += new EventHandler<GestureEventArgs>(_model.OnTap);
                 this.LayoutRoot.Children.Add(_boxs[row, column]);
             }
         }
     }
 }