Exemplo n.º 1
0
        private void BtnUndo_Click(object sender, EventArgs e)
        {
            if (currentArticle >= 1)
            {
                currentArticle--;

                string prevText = originator.restoreFromMemento(careTaker.GetMemento(currentArticle));

                lbText.Text = prevText;

                btnRedo.Enabled = true;
            }
        }
Exemplo n.º 2
0
 public Program()
 {
     myStore    = new CareTaker();
     originator = new Originator();
     Console.WriteLine("Storing Memento");
     originator.Set("My Initial State which will be stored");
     myStore.ADD(originator.Store());
     itemNumber++;
     originator.Set("My Changed State which will not be stored and will be restored");
     Console.WriteLine("Restored : " + originator.Restore(myStore.GetMemento(itemNumber - 1)));
     Console.ReadLine();
 }