コード例 #1
0
 /// <summary>
 /// Invoke the 'UpdateTable' event handler if it is set.
 /// </summary>
 /// <param name="arg">The event hadler argumentum.</param>
 private void OnUpdateTable(ReversiUpdateTableEventArgs arg)
 {
     if (UpdateTable != null)
     {
         UpdateTable(this, arg);
     }
 }
コード例 #2
0
        /// <summary>
        /// Model invoked this. The table needs update.
        /// </summary>
        /// <param name="sender">The model. We do not use this.</param>
        /// <param name="e">The data we need to update the talbe.</param>
        private void Model_UpdateTable(object sender, ReversiUpdateTableEventArgs e)
        {
            _saved = false;
            _saveMenuItemEnabled = true;
            OnPropertyChanged("SaveMenuItemEnabled");

            _gamePoints = "Player 1: " + e.Player1Points + " -- Player 2: " + e.Player2Points;
            OnPropertyChanged("GamePoints");

            _isPlayer1TurnOn = e.IsPlayer1TurnOn;

            _passButtonEnabled = e.IsPassingTurnOn;
            OnPropertyChanged("PassButtonEnabled");

            if (e.UpdatedFieldsCount == 0)
            {
                _pauseButtonEnabled = true;
                OnPropertyChanged("PauseButtonEnabled");

                _pauseText = "Pause";
                OnPropertyChanged("PauseText");

                SetButtonGridUp();

                Int32 index = 0;
                for (Int32 x = 0; x < _model.ActiveTableSize; ++x)
                {
                    for (Int32 y = 0; y < _model.ActiveTableSize; ++y)
                    {
                        UpdateCell(x, y, e.UpdatedFieldsDatas[index]);
                        ++index;
                    }
                }
            }
            else
            {
                for (Int32 i = 0; i < e.UpdatedFieldsCount; i += 3)
                {
                    UpdateCell(e.UpdatedFieldsDatas[i], e.UpdatedFieldsDatas[i + 1], e.UpdatedFieldsDatas[i + 2]);
                }
            }
        }
コード例 #3
0
        private void model_UpdateTable(Object sender, ReversiUpdateTableEventArgs e)
        {
            _eventUpdateTableInvoked = true;

            if (!_simpleEvents)
            {
                _lastUpdateArg = e;
                updateStepsArray();
            }
        }