public void DeleteExecute() { var dm = new TestItemDM() { Id = this.SelectedTestItem.Id, SomeDouble = this.SelectedTestItem.SomeDouble, Message = this.SelectedTestItem.Message }; var vm = new TestItemVM(dm); var hashCode = vm.GetHashCode(); #region undo/redo var oldValue = dataModel.Message; var undo = new Action(() => { obsTestList.Add(vm); }); var redo = new Action(() => { var deleteMe = obsTestList.FirstOrDefault(x => x.GetHashCode() == hashCode); obsTestList.Remove(deleteMe); }); undoActions.Add(new List <Action>() { undo, redo }); #endregion undo/redo obsTestList.Remove(SelectedTestItem); }
public void AddExecute() { var dm = new TestItemDM() { Id = Id, Message = Message, SomeDouble = SomeDouble }; var vm = new TestItemVM(dm); vm.TestItemPropChanged += OnTestItemPropChanged; var hashCode = vm.GetHashCode(); #region undo/redo var oldValue = dataModel.Message; var undo = new Action(() => { var deleteMe = obsTestList.FirstOrDefault(x => x.GetHashCode() == hashCode); obsTestList.Remove(deleteMe); }); var redo = new Action(() => { obsTestList.Add(vm); }); undoActions.Add(new List <Action>() { undo, redo }); #endregion undo/redo obsTestList.Add(vm); }
public TestItemVM(TestItemVM vm) { this.dataModel = new TestItemDM() { Id = vm.Id, Message = vm.Message, SomeDouble = vm.SomeDouble }; }
public void DeleteExecute() { var dm = new TestItemDM() { Id = this.SelectedTestItem.Id, SomeDouble = this.SelectedTestItem.SomeDouble, Message = this.SelectedTestItem.Message }; var vm = new TestItemVM(dm); var hashCode = vm.GetHashCode(); #region undo/redo var oldValue = dataModel.Message; var undo = new Action(() => { obsTestList.Add(vm); }); var redo = new Action(() => { var deleteMe = obsTestList.FirstOrDefault(x => x.GetHashCode() == hashCode); obsTestList.Remove(deleteMe); }); undoActions.Add(new List<Action>() { undo, redo }); #endregion undo/redo obsTestList.Remove(SelectedTestItem); }
public void AddExecute() { var dm = new TestItemDM() { Id = Id, Message = Message, SomeDouble = SomeDouble }; var vm = new TestItemVM(dm); vm.TestItemPropChanged += OnTestItemPropChanged; var hashCode = vm.GetHashCode(); #region undo/redo var oldValue = dataModel.Message; var undo = new Action(() => { var deleteMe = obsTestList.FirstOrDefault(x => x.GetHashCode() == hashCode); obsTestList.Remove(deleteMe); }); var redo = new Action(() => { obsTestList.Add(vm); }); undoActions.Add(new List<Action>() { undo, redo }); #endregion undo/redo obsTestList.Add(vm); }
public TestItemPropChangedArgs(TestItemVM vm, Property changedProperty, List <Action> undoActions) { this.vm = vm; this.changedProperty = changedProperty; this.undoActions = undoActions; }
public TestItemPropChangedArgs(TestItemVM vm, Property changedProperty, List<Action> undoActions) { this.vm = vm; this.changedProperty = changedProperty; this.undoActions = undoActions; }