Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/DynamicDataDisplay/Common/UndoSystem/DependencyPropertyChangedUndoAction.cs @ 13792

Last change on this file since 13792 was 12503, checked in by aballeit, 9 years ago

#2283 added GUI and charts; fixed MCTS

File size: 1.1 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Windows;
6
7namespace Microsoft.Research.DynamicDataDisplay.Common.UndoSystem
8{
9  public class DependencyPropertyChangedUndoAction : UndoAction
10  {
11    private readonly DependencyProperty property;
12    private readonly DependencyObject target;
13    private readonly object oldValue;
14    private readonly object newValue;
15
16    public DependencyPropertyChangedUndoAction(DependencyObject target, DependencyProperty property, object oldValue, object newValue)
17    {
18      this.target = target;
19      this.property = property;
20      this.oldValue = oldValue;
21      this.newValue = newValue;
22    }
23
24    public DependencyPropertyChangedUndoAction(DependencyObject target, DependencyPropertyChangedEventArgs e)
25    {
26      this.target = target;
27      this.property = e.Property;
28      this.oldValue = e.OldValue;
29      this.newValue = e.NewValue;
30    }
31
32    public override void Do()
33    {
34      target.SetValue(property, newValue);
35    }
36
37    public override void Undo()
38    {
39      target.SetValue(property, oldValue);
40    }
41  }
42}
Note: See TracBrowser for help on using the repository browser.