public void stateChanged() { _lastChange = DateTime.Now; Task.Delay(MILLISECONDS_BEFORE_CHANGE_HANDLED).ContinueWith((task) => { if ((DateTime.Now - _lastChange).TotalMilliseconds >= MILLISECONDS_BEFORE_CHANGE_HANDLED) { LilyMemento currentMemento = originator.getMemento(); LilyMemento lastMemento = caretaker.getLast(); if (lastMemento == null || lastMemento.getState() != currentMemento.getState()) { caretaker.insertMemento(currentMemento); } Staff staff = lilypondToStaff.load(currentMemento.getState()); controller.ViewCOR.handle(staff, ContentType.WPF); controller.ViewCOR.handle(staff, ContentType.MIDI); } }, TaskScheduler.FromCurrentSynchronizationContext()); }
public void setMemento(LilyMemento memento) { _textbox.Text = memento.getState(); }