Пример #1
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            string text = theStatement.Text;

            originator.set(text);

            caretaker.addMemento(originator.storeInMemento());

            saveFiles++;
            currentStatement++;

            WriteLine("Saved files " + saveFiles + "\n");
            btnUndo.IsEnabled = true;
        }
        //the next few methods are what will do stuff.
        //notably, undo and redo.
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            string text = theStatement.Text;

            originator.set(text);                              //pass the statement to the originator

            caretaker.addMemento(originator.storeInMemento()); //two things happening here:
            //add the memento to Caretaker
            //store the memento via the originator.
            //I know I'm missing some details here...

            saveFiles++;
            currentStatement++;

            WriteLine("Saved files " + saveFiles + "\n");

            btnUndo.IsEnabled = true; //turns on the button that will allow Undo
        }
Пример #3
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            // Get text in JTextArea
            string textInTextArea = theArticle.Text;

            // Set the value for the current memento
            originator.set(textInTextArea);

            // Add new article to the ArrayList
            caretaker.addMemento(originator.storeInMemento());

            // saveFiles monitors how many articles are saved
            // Number of mementos I have
            saveFiles++;
            currentArticle++;

            WriteLine("Saved Files " + saveFiles + "\n");

            btnUndo.IsEnabled = true;
        }
Пример #4
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            // Get text in TextBox
            string text = theStatement.Text;

            // Set the value for the current memento
            originator.set(text);

            // Add new statement to the collection
            caretaker.addMemento(originator.storeInMemento());

            // saveFiles monitors how many statements are saved
            // Number of mementos I have
            saveFiles++;
            currentStatement++;

            System.Threading.Thread.Sleep(500);
            WriteLine("Saved Files " + saveFiles + "\n");

            btnUndo.IsEnabled = true;
        }