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(); }
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); }
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); }
public MainForm() { InitializeComponent(); UndoRedoManager.Instance().RedoStackStatusChanged += new UndoRedoManager.OnStackStatusChanged(MainForm_RedoStackStatusChanged); UndoRedoManager.Instance().UndoStackStatusChanged += new UndoRedoManager.OnStackStatusChanged(MainForm_UndoStackStatusChanged); }
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); }