Example #1
0
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            _engine = new Engine();
            _engine.ghostCreated += new Engine.GhostCreated(ghostCreated);
            _engine.worldObjectCreated += new Engine.WorldObjectCreated(worldObjectCreated);
            _engine.worldObjectRemoved += new Engine.WorldObjectRemoved(worldObjectRemoved);
            _engine.ghostsMoved += new Engine.GhostsMoved(ghostsMoved);
            _engine.gameStarted += new Engine.GameStarted(gameStarted);
            _engine.gameOver += new Engine.GameOver(gameOver);
            //_engine.Player.Position = new GeoCoordinate(0, 0);

            _watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High);
            _watcher.MovementThreshold = 0;
            _watcher.StatusChanged += new EventHandler<GeoPositionStatusChangedEventArgs>(watcher_StatusChanged);
            _watcher.PositionChanged += new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(watcher_PositionChanged);

            if (Compass.IsSupported)
            {
                _compass = new Compass();
                _compass.CurrentValueChanged += new EventHandler<SensorReadingEventArgs<CompassReading>>(compassChanged);
                _compass.Start();
            }

            gpsHideAnimation.Completed += new EventHandler(gpsHideAnimation_Completed);

            rect.Visibility = Visibility.Collapsed;
        }
Example #2
0
 private void endGameYesButton_Click(object sender, RoutedEventArgs e)
 {
     if (NavigationService.CanGoBack)
     {
         _watcher.Stop();
         _engine.Stop();
         _watcher = null;
         _engine = null;
         NavigationService.GoBack();
     }
 }