comparison Tools/DocGen/Content/Doc/EditableObjects/EditableObject.cs @ 0:f990fcb411a9

Копия текущей версии из github
author cin
date Thu, 27 Mar 2014 21:46:09 +0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f990fcb411a9
1 [BLToolkitGenerated]
2 public sealed class TestObject : EditableObjectTest.TestObject, IEditable, IMemberwiseEditable, IPrintDebugState
3 {
4 // Note that the internal representation of the properties is EditableValue<string>.
5 // The EditableValue class provides a mechanism to keep and control the field value state.
6 //
7 private /*[a]*/EditableValue<string>/*[/a]*/ _firstName;
8 private /*[a]*/EditableValue<string>/*[/a]*/ _lastName;
9
10 // PropertyInfo is used for internal purposes.
11 //
12 private static PropertyInfo _firstName_propertyInfo =
13 TypeHelper.GetPropertyInfo(typeof(EditableObjectTest.TestObject), "FirstName", typeof(string), Type.EmptyTypes);
14 private static PropertyInfo _lastName_propertyInfo =
15 TypeHelper.GetPropertyInfo(typeof(EditableObjectTest.TestObject), "LastName", typeof(string), Type.EmptyTypes);
16
17 // Constructors.
18 //
19 public TestObject()
20 {
21 this._firstName = new EditableValue<string>("");
22 this._lastName = new EditableValue<string>("");
23 }
24
25 public TestObject(InitContext ctx)
26 {
27 this._firstName = new EditableValue<string>("");
28 this._lastName = new EditableValue<string>("");
29 }
30
31 // Abstract property implementation.
32 //
33 public override string FirstName
34 {
35 get
36 {
37 return _firstName./*[a]*/Value/*[/a]*/;
38 }
39
40 set
41 {
42 _firstName./*[a]*/Value/*[/a]*/ = value;
43
44 // The PropertyChanged event support.
45 //
46 ((IPropertyChanged)this)./*[a]*/OnPropertyChanged/*[/a]*/(_firstName_propertyInfo);
47 }
48 }
49
50 public override string LastName
51 {
52 get
53 {
54 return _lastName./*[a]*/Value/*[/a]*/;
55 }
56
57 set
58 {
59 _lastName./*[a]*/Value/*[/a]*/ = value;
60 ((IPropertyChanged)this)./*[a]*/OnPropertyChanged/*[/a]*/(_lastName_propertyInfo);
61 }
62 }
63
64 // The IEditable interface implementation.
65 //
66 bool IEditable.IsDirty
67 {
68 get { return _firstName.IsDirty || _lastName.IsDirty; }
69 }
70
71 void IEditable.AcceptChanges()
72 {
73 this._firstName.AcceptChanges();
74 this._lastName. AcceptChanges();
75 }
76
77 void IEditable.RejectChanges()
78 {
79 this._firstName.RejectChanges();
80 this._lastName. RejectChanges();
81 }
82
83 // The IMemberwiseEditable interface implementation.
84 //
85 bool IMemberwiseEditable.AcceptMemberChanges(PropertyInfo propertyInfo, string memberName)
86 {
87 return
88 _firstName.AcceptMemberChanges(_firstName_propertyInfo, memberName) ||
89 _lastName. AcceptMemberChanges(_lastName_propertyInfo, memberName);
90 }
91
92 void IMemberwiseEditable.GetDirtyMembers(PropertyInfo propertyInfo, ArrayList list)
93 {
94 _firstName.GetDirtyMembers(_firstName_propertyInfo, list);
95 _lastName. GetDirtyMembers(_lastName_propertyInfo, list);
96 }
97
98 bool IMemberwiseEditable.IsDirtyMember(PropertyInfo propertyInfo, string memberName, ref bool isDirty)
99 {
100 return
101 _firstName.IsDirtyMember(_firstName_propertyInfo, memberName, ref isDirty) ||
102 _lastName. IsDirtyMember(_lastName_propertyInfo, memberName, ref isDirty);
103 }
104
105 bool IMemberwiseEditable.RejectMemberChanges(PropertyInfo propertyInfo, string memberName)
106 {
107 return
108 _firstName.RejectMemberChanges(_firstName_propertyInfo, memberName) ||
109 _lastName. RejectMemberChanges(_lastName_propertyInfo, memberName);
110 }
111
112 // The IPrintDebugState interface implementation.
113 //
114 void IPrintDebugState.PrintDebugState(PropertyInfo propertyInfo, ref string str)
115 {
116 _firstName.PrintDebugState(_firstName_propertyInfo, ref str);
117 _lastName. PrintDebugState(_lastName_propertyInfo, ref str);
118 }
119 }