public Move(int l,int c, Cell old,Cell newV) { line=l; column = c; oldValue = old; newValue = newV; }
public void Update(int line_p, int column_p, Cell value_p, bool commitAnyway) { Update(line_p, column_p, value_p, commitAnyway,true); }
public void Update(int line_p, int column_p, Cell value_p, bool commitAnyway,bool fireEvent) { if (line_p > m_line || column_p > m_col) throw new ArgumentOutOfRangeException(); int index = line_p * m_col + column_p; Cell old; old = m_sudokuGrid[index]; try { if (m_sudokuGrid[index].CellValeur == 0 || (m_sudokuGrid[index].CellType & CellFlag.SAISIE) == CellFlag.SAISIE) { m_sudokuGrid[index] = value_p; m_sudokuGrid[index].CellType |= CellFlag.SAISIE; } if (CellUpdated != null ) { CellUpdated(this, new SudokuMoveEvent( new Move(line_p, column_p, old, m_sudokuGrid[index]), true)); } } catch (IllegalSudokuMove) { } }
//public void Update(int line_p, int column_p, int value_p) //{ // Update(line_p, column_p, value_p, false); //} //public void Update(int line_p, int column_p, int value_p, bool verifieMove) //{ // if (line_p > m_line || column_p > m_col) // throw new ArgumentOutOfRangeException(); // if (verifieMove) // { // if (!IsValidUpdate(line_p, column_p, value_p)) // throw new IllegalSudokuMove(); // } // int index = line_p * m_col + column_p; // if (m_sudokuGrid[index].CellValeur == 0 || (m_sudokuGrid[index].CellType & CellFlag.SAISIE) == CellFlag.SAISIE) // { // m_sudokuGrid[index] = new Cell(); // m_sudokuGrid[index].CellType = CellFlag.SAISIE; // m_sudokuGrid[index].CellValeur = value_p; // hasChanged = true; // if (GridChanged!=null) // { // GridChanged(this, new SudokuMoveEvent(new Update(line_p,column_p,)); // } // } //} public void Update(int line_p, int column_p, Cell value_p) { Update(line_p, column_p, value_p, true); }