示例#1
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            cam = new PhotoCamera(CameraType.Primary);
            cam.Initialized += cam_Initialized;

            // Event is fired when the capture sequence is complete and an image is available.
            cam.CaptureImageAvailable += cam_CaptureImageAvailable;

            // The event is fired when the shutter button receives a half press.
            CameraButtons.ShutterKeyHalfPressed += OnButtonHalfPress;

            // The event is fired when the shutter button receives a full press.
            CameraButtons.ShutterKeyPressed += OnButtonFullPress;

            // The event is fired when the shutter button is released.
            CameraButtons.ShutterKeyReleased += OnButtonRelease;

            videobrush.SetSource(cam);
            videobrush.RelativeTransform =
                new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = 90 };

            if (NavigationContext.QueryString.ContainsKey("JoinGame"))
            {
                gameId = int.Parse(NavigationContext.QueryString["JoinGame"]);
                CurrentGame = Networking.GetGameById_Local(gameId);

                getName();
            }
            else if (NavigationContext.QueryString.ContainsKey("ContinueGame"))
            {
                gameId = int.Parse(NavigationContext.QueryString["ContinueGame"]);

                CurrentPlayer = Networking.GetPlayerByGameId_Local(gameId);
                CurrentGame = Networking.GetGameById_Local(gameId);

                lbl_MyName.Text = CurrentPlayer.name.ToString();
                lbl_MyScore.Text = CurrentPlayer.score.ToString();
                lbl_MyTime.Text = CurrentPlayer.time.ToString();
            }


            base.OnNavigatedTo(e);
        }
示例#2
0
 public bool Equals(Game game)
 {
     return this.id == game.id;
 }
        private void ShowGameDetails(Game selected)
        {
            //Now, check if the user is already playing
            string message;
            string query;


            bool isPlayingi = false;
            //Check if the user is playing this game
            for (int j = 0; j < Networking.LocalUser.joined_games.Count; j++)
            {
                if (Networking.LocalUser.joined_games[j].Equals(selected))
                    isPlayingi = true;
            }

            if (isPlayingi)
            {
                query = "?ContinueGame=" + selected.id;
                message = String.Format("\nCreator: {0}\nPlayers: {1}/{2}\nStarted: {3}\nGame Type: {4}\n\n                   {5}",
                    "Me",
                    selected.players.Count,
                    selected.maxplayers,
                    selected.time.ToString(),
                    selected.gameType,
                    "Continue This Game?");
            }
            else
            {
                query = "?JoinGame=" + selected.id;
                message = String.Format("\nCreator: {0}\nPlayers: {1}/{2}\nStarted: {3}\nGame Type: {4}\n\n                   {5}",
                    selected.creator.name,
                    selected.players.Count,
                    selected.maxplayers,
                    selected.time.ToString(),
                    selected.gameType,
                    "Join This Game?");
            }


            if (MessageBox.Show(message, (string)selected.name, MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                NavigationService.Navigate(new Uri("/GamePage.xaml" + query, UriKind.Relative));
        }