示例#1
0
        public void SetupPage()
        {
            //turn on the display of the board and models
            SharedGraphicsDeviceManager.Current.GraphicsDevice.SetSharingMode(true);

            //Run the detection separate from the update
            dispatcherTimer.Start();

            // Create a timer for this page
            timer.Start();

            //see if user was placed into check
            if ((GameStateManager.getInstance().getGameState().black.in_check&& GameStateManager.getInstance().getCurrentPlayer() == ChessPiece.Color.BLACK) || (GameStateManager.getInstance().getGameState().white.in_check&& GameStateManager.getInstance().getCurrentPlayer() == ChessPiece.Color.WHITE))
            {
                handleError("You have been placed into check by your opponent.");
            }

            //if the state of the game has not yet been loaded, load it now before displaying board
            if (!stateHasBeenLoaded)
            {
                GameState.getInstance().loadState(GameStateManager.getInstance().getGameState());
                stateHasBeenLoaded = true;
            }

            //Initialize the camera
            photoCamera              = new PhotoCamera();
            photoCamera.Initialized += new EventHandler <CameraOperationCompletedEventArgs>(photoCamera_Initialized);
            ViewFinderBrush.SetSource(photoCamera);

            setupFinished = true;
        }
示例#2
0
        private void InitializeView()
        {
            if (_cam.CameraType == CameraType.Primary)
            {
                ViewFinderBrush.RelativeTransform = new RotateTransform()
                {
                    Angle = 90, CenterX = 0.5, CenterY = 0.5
                }
            }
            ;
            else if (_cam.CameraType == CameraType.FrontFacing)
            {
                ViewFinderBrush.RelativeTransform = new RotateTransform()
                {
                    Angle = -90, CenterX = 0.5, CenterY = 0.5
                }
            }
            ;

            ViewFinderBrush.SetSource(_cam);
        }