示例#1
0
        //this is called when an event is leaving the future events stack (aka Redo)
        private void OnFutureEventsPop()
        {
            CustomChangeArgs args = _futureEvents.Pop();        //Pop the last event from the future events stack

            MainTextBox.Text = args.Redo(MainTextBox.Text);     //Apply the event to our text
            OnPastEventsPush(args, false);                      //Push the event back to the past events stack

            OnStackChange();
        }
示例#2
0
        //Ths is called when an event is leaving the past events stack (aka Undo)
        private void OnPastEventsPop()
        {
            CustomChangeArgs args = _pastEvents.Pop();          //Grab the last event

            MainTextBox.Text = args.Undo(MainTextBox.Text);     //Apply it to our text
            OnFutureEventsPush(args);                           //Push it onto the future events stack

            OnStackChange();
        }
示例#3
0
        //This is called when an event is entering the past events stack
        private void OnPastEventsPush(CustomChangeArgs args, bool isNew)
        {
            _pastEvents.Push(args);
            if (isNew)                      //We use a bool to determine if the event is new (user hit a key, not undo/redo)
            {
                _futureEvents.Clear();      //If its a new input event, we need to clear the future events stack since
            }
            //we've branched off from our previous timeline.

            OnStackChange();
        }
示例#4
0
 //This is called when an event enters the future events stack (aka Undo)
 private void OnFutureEventsPush(CustomChangeArgs args)
 {
     _futureEvents.Push(args);       //Just add the event to the stack and update
     OnStackChange();
 }