public void Undo() { // Executes undo call, including menu refreshing call to form handle if (_undoStack.Count > 0) { Memento currentEvent = _undoStack.Pop(); currentEvent.Undo(); _redoStack.Push(currentEvent); _mainForm.RefreshMementoMenus(); /* This next line is not applicable for Picasso, because the forms with values and the main form (with * menus) are never the same. In other applications, though, it would be necessary. */ _mainForm.RefreshValues(); } }
private void redoMenuItem_Click(object sender, EventArgs e) { try { IMForm child = (IMForm)ActiveMdiChild; MementoManager manager = child.GetMementoManager(); manager.Redo(); child.RefreshValues(); } catch (NullReferenceException) { // There is no child form yet } catch (InvalidCastException) { // Mdi child is not an IMForm } }