Exemple #1
0
 protected virtual void OnCellChanged(CellChangedEventArgs e)
 {
     // check if someone is listening
     if (CellChanged != null)
     {
         // raise the event:
         CellChanged.Invoke(this, e);
     }
 }
Exemple #2
0
 // When cell in the logic parts changes, this function updates the relevant cells in gui
 private void m_CheckersBoard_CellChanged(object sender, CellChangedEventArgs e)
 {
     Button buttonToBeChanged = positionStringToButton(e.CellPosition.ToAlphabetString());
     CheckersGameBoard.eCellMode newMode = e.NewCellMode;
     if (buttonToBeChanged != null)
     {
         switch (newMode)
         {
             case CheckersGameBoard.eCellMode.Empty:
                 buttonToBeChanged.Text = sr_CellSymbols[(int)CheckersGameBoard.eCellMode.Empty];
                 break;
             case CheckersGameBoard.eCellMode.Player1Piece:
                 buttonToBeChanged.Text = sr_CellSymbols[(int)CheckersGameBoard.eCellMode.Player1Piece];
                 break;
             case CheckersGameBoard.eCellMode.Player2Piece:
                 buttonToBeChanged.Text = sr_CellSymbols[(int)CheckersGameBoard.eCellMode.Player2Piece];
                 break;
             case CheckersGameBoard.eCellMode.Player1King:
                 buttonToBeChanged.Text = sr_CellSymbols[(int)CheckersGameBoard.eCellMode.Player1King];
                 break;
             case CheckersGameBoard.eCellMode.Player2King:
                 buttonToBeChanged.Text = sr_CellSymbols[(int)CheckersGameBoard.eCellMode.Player2King];
                 break;
             default:
                 throw new ArgumentException("Invalid Enum value : eCellMode");
         }
     }
 }
 protected virtual void OnCellChanged(CellChangedEventArgs e)
 {
     // check if someone is listening
     if (CellChanged != null)
     {
         // raise the event:
         CellChanged.Invoke(this, e);
     }
 }