public ICmd Exec() { ICmd inverse = new RestoreText(mCell, mCell.Text); mCell.Text = mText; return(inverse); }
//description: set to previous text and return inverse command //parameter: //return: public ICmd Exec() { RestoreText invCmd = new RestoreText(mCell); mCell.Text = mText; return(invCmd); }
/************************************************************* * Name: Exec(Spreadsheet ssheet) * Date Created: March 8, 2017 * Date Last Modified: March 8, 2017 * Description: Restores old text for a cell *************************************************************/ public IUndoRedoCmd Exec(Spreadsheet ssheet) { Cell cell = ssheet.GetCell(m_Name); string old = cell.Text; cell.Text = m_Text; RestoreText oldTextClass = new RestoreText(old, m_Name); return(oldTextClass); }
public void ExecuteRedo() { var pop = mRedoStack.Pop(); Cell currentCell = pop.GetCell(); ICmd current = new MultiCmd(); MultiCmd temp = current as MultiCmd; ICmd currentBGColor = new RestoreBGColor(currentCell, currentCell.BGColor); ICmd currentText = new RestoreText(currentCell, currentCell.Text); temp.Add(currentText); temp.Add(currentBGColor); AddUndo(current); ICmd command = pop.Exec(); }
public void ExecuteUndo() { var pop = mUndoStack.Pop(); //Get the top element of the stack Cell currentCell = pop.GetCell(); ICmd current = new MultiCmd(); MultiCmd temp = current as MultiCmd; ICmd currentBGColor = new RestoreBGColor(currentCell, currentCell.BGColor); ICmd currentText = new RestoreText(currentCell, currentCell.Text); temp.Add(currentText); temp.Add(currentBGColor); AddRedo(current); //Push the current cell to the redo stack ICmd command = pop.Exec(); //Get the inverse action and apply to the cell }