Exemple #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            personListBindingSource.DataSource = _personList;
            lbPeople.DataSource    = personListBindingSource;
            lbPeople.DisplayMember = "Name";

            //기본 대상자 2명 입력.
            AddDefaultPeople();

            ///clear any undo operations added implicitly during startup
            UndoRedoManager.Instance().Clear();
        }
Exemple #2
0
        private void RemovePerson(Person person)
        {
            //Nothing to do if the person is not in the list
            bool found = _personList.Exists(p => p.ID == person.ID);

            if (!found)
            {
                return;
            }

            UndoRedoManager.Instance().Push(p => AddPerson(p), person, "Remove Person");

            personListBindingSource.Remove(person);
        }
Exemple #3
0
        private Person AddPerson(Person person)
        {
            //Do not add if the person is already in the list
            Person personInList = _personList.Find(p => p.ID == person.ID);

            if (personInList != null)
            {
                return(personInList);
            }

            //UndoRedoManager.Instance().Push(p => RemovePerson(p), person,"Add Person");
            UndoRedoManager.Instance().Push(delegate(Person p) { RemovePerson(p); }, person, "Add Person");

            personListBindingSource.Position = personListBindingSource.Add(person);

            return(person);
        }
Exemple #4
0
 public MainForm()
 {
     InitializeComponent();
     UndoRedoManager.Instance().RedoStackStatusChanged += new UndoRedoManager.OnStackStatusChanged(MainForm_RedoStackStatusChanged);
     UndoRedoManager.Instance().UndoStackStatusChanged += new UndoRedoManager.OnStackStatusChanged(MainForm_UndoStackStatusChanged);
 }
Exemple #5
0
 private void redoToolStripMenuItem_Click(object sender, EventArgs e)
 {
     UndoRedoManager.Instance().Redo();
 }
 public void Dispose()
 {
     UndoRedoManager.Instance().EndTransaction(this);
 }
 public UndoTransaction(string name = "")
 {
     _Name = name;
     UndoRedoManager.Instance().StartTransaction(this);
 }