Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using System.Windows;
|
---|
6 |
|
---|
7 | namespace 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.