private void performMove(GameManager.Direction direction) { if (gameManager.Move(direction)) { gameManager.UpdateGame(true); GameBoardPanel.Items.Refresh(); } }
private void Page_Loaded(object sender, System.Windows.RoutedEventArgs e) { const int BOARD_SIZE = 4; Grid grid = new Grid(BOARD_SIZE); gameManager = new GameManager(grid); this.DataContext = gameManager; GameBoardPanel.ItemsSource = gameManager.Board.TileCollection; System.Windows.Application.Current.MainWindow.KeyDown += new KeyEventHandler(Page_KeyUp); framesHandler = new GameSignNumPlayFramesHandler(this, GameBoardPanel); framesHandler.RegisterCallbackToSensor(KinectState.Instance.CurrentKinectSensor); }