public void Do(IDocumentAction action) { if (subtitle == null) { throw new InvalidOperationException($"{nameof(Subtitle)} is null"); } action.Do(subtitle); while (actionList.First.Next != currentAction) { actionList.Remove(actionList.First.Next); } actionList.AddAfter(actionList.First, action); currentAction = actionList.First.Next; modified(); }
public bool TryDo(IDocumentAction action) { if (subtitle == null) { return(false); } try { action.Do(subtitle); } catch (Exception) { return(false); } while (actionList.First.Next != currentAction) { actionList.Remove(actionList.First.Next); } actionList.AddAfter(actionList.First, action); currentAction = actionList.First.Next; modified(); return(true); }