Example #1
0
 private void OpenGame(GameVM game)
 {
     NavigationService.Navigate(new Uri("/Pages/BantumiGamePage.xaml?game=" + game.Id, UriKind.Relative));
 }
Example #2
0
        public void Setup(object sender, EventArgs args)
        {
            var gameId = NavigationContext.QueryString["game"];
            var settings = IsolatedStorageSettings.ApplicationSettings;
            Player = settings["player"] as PlayerVM;

            Context.GetGame(gameId, game =>
                Dispatcher.BeginInvoke(() =>
                {
                    Game = new GameVM(game);

                    if (Game.Host == Player)
                        BindHost();
                    else
                        BindClient();

                    BindChangingProperties();
                    BindChangedProperties();
                })
            , () => { });
        }
Example #3
0
        public void JoinRandom(Object sender, EventArgs e)
        {
            if (Games.Count >= 10)
                MessageBox.Show("You are not allowed to play in more than ten games simultaneously. Please finish some games before starting new ones.");

            SystemTray.ProgressIndicator.IsVisible = true;
            Context.JoinGame(Player.Name, game =>
                Dispatcher.BeginInvoke(() =>
                {
                    var settings = IsolatedStorageSettings.ApplicationSettings;
                    var gameVm = new GameVM(game);
                    Games.Add(gameVm);

                    settings["games"] = Games.ToArray();
                    SystemTray.ProgressIndicator.IsVisible = false;
                    OpenGame(gameVm);
                })
            , () =>
                Dispatcher.BeginInvoke(() =>
                {
                    SystemTray.ProgressIndicator.IsVisible = false;
                    MessageBox.Show("Failed to join a challenge. Please try again.");
                })
            );
        }