示例#1
0
        protected override async void OnNavigatedTo(NavigationEventArgs args)
        {
            await this.Authenticate();

            mobileServiceClient = new TicTacToeLibraryCSharp.TicTacToeMobileServiceClient(App.mobileClient,
                                                                                          TicTacToeMobile1000Push.Channel, mobileServiceUser);
            processor                = new TicTacToeLibraryCSharp.GameProcessor(mobileServiceClient);
            DataContext              = processor;
            processor.OnProcessTurn += this.UpdateBadge;
        }
        public Cell(int index, Windows.UI.Xaml.Media.Brush foregroundBrush, GameProcessor gameProcessor, char mark)
        {
            m_index = index;
            m_mark = mark;
            m_gameProcessor = new WeakReference(gameProcessor);

            ForegroundBrush = foregroundBrush;
            m_selectCommand = new DelegateCommand(new ExecuteDelegate(Select), null);

        }
 protected override async void OnNavigatedTo(NavigationEventArgs args)
 {
     await this.Authenticate();
     mobileServiceClient = new TicTacToeLibraryCSharp.TicTacToeMobileServiceClient(App.mobileClient, 
         TicTacToeMobile1000Push.Channel, mobileServiceUser);
     processor = new TicTacToeLibraryCSharp.GameProcessor(mobileServiceClient);
     DataContext = processor;
     processor.OnProcessTurn += this.UpdateBadge;
 }
 public Cell(int index, Windows.UI.Xaml.Media.Brush foregroundBrush, GameProcessor gameProcessor) 
     : this(index, foregroundBrush, gameProcessor, '\0')
 {}
 /// <summary>
 ///  Create the game object for an existing game
 /// </summary>
 /// <param name="gameInfo"></param>
 /// <param name="users"></param>
 /// <param name="userId"></param>
 public TicTacToeGame(GameProcessor processorIn, GameInfo gameInfo, List<User> users, string userId)
 {
     processor = processorIn;
     State = gameInfo.GameResult;
     Players = new List<IPlayer>();
     for (int index = 0; index < users.Count; index++)
     {
         if (String.Equals(users[index].id, userId))
         {
             Players.Add(new LocalPlayer(this, users[index], TicTacToeGame.pieces[index]));
             userPlayerIndex = index;
         }
         else
         {
             Players.Add(new RemotePlayer(this, users[index], TicTacToeGame.pieces[index]));
         }
     }
     gameBoard = new StringBuilder(gameInfo.GameBoard);
     CurrentPlayerIndex = gameInfo.CurrentPlayerIndex;
     ID = gameInfo.GameId;
 }