This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private MethodDefinition CreateAddPropertyChangedMethod() | |
| { | |
| return CreatePropertyChangedEventHookupMethod( | |
| "add_PropertyChanged", | |
| "Combine"); | |
| } | |
| private MethodDefinition CreateRemovePropertyChangedMethod() | |
| { | |
| return CreatePropertyChangedEventHookupMethod( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void InjectNotification(MethodDefinition methodDef, | |
| IEnumerable<string> propNames) | |
| { | |
| if (_notifyMethodDef == null || methodDef == null) | |
| { | |
| return; | |
| } | |
| if (HasMultipleReturnPoints(methodDef)) | |
| { | |
| RefactorSetterAndInjectNotification(methodDef, propNames); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private DateTime _birthDate; | |
| public DateTime BirthDate | |
| { | |
| get { return _birthDate; } | |
| set { _birthDate = value; } | |
| } | |
| [Viewable] | |
| public int Age |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private DateTime _birthDate; | |
| public DateTime BirthDate | |
| { | |
| get { return _birthDate; } | |
| set | |
| { | |
| _birthDate = value; | |
| Notify("Age"); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void HandlePropertyToNotify(PropertyDefinition prop) | |
| { | |
| foreach (var affector in FindAffectingProperties(prop, new List<string>())) | |
| { | |
| AddDependency(affector, prop); | |
| } | |
| } | |
| private void AddDependency(PropertyDefinition key, | |
| PropertyDefinition value) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| field private class [System]System.ComponentModel.PropertyChangedEventHandler PropertyChanged | |
| event [System]System.ComponentModel.PropertyChangedEventHandler PropertyChanged | |
| { | |
| .addon instance void Silver.Needle.Tests.Data.Dependencies.Complex.PersonViewModel::add_PropertyChanged(class [System]System.ComponentModel.PropertyChangedEventHandler) | |
| .removeon instance void Silver.Needle.Tests.Data.Dependencies.Complex.PersonViewModel::remove_PropertyChanged(class [System]System.ComponentModel.PropertyChangedEventHandler) | |
| } | |
| .method public final hidebysig specialname newslot virtual | |
| instance void add_PropertyChanged ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static MethodDefinition FindNotificationMethod( | |
| TypeDefinition typeDef, | |
| bool includePrivateMethods = true) | |
| { | |
| foreach (var m in typeDef.Methods.Where(m => includePrivateMethods | |
| || m.Attributes.HasFlag(MethodAttributes.Public))) | |
| { | |
| if (IsProbableNotificationMethod(m)) | |
| { | |
| return m; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private MethodDefinition CreateNotificationMethodDefinition() | |
| { | |
| const string MethodName = "NotifyViewableProperty"; | |
| var methodDef = new MethodDefinition(MethodName, | |
| MethodAttributes.Private | | |
| MethodAttributes.HideBySig, | |
| this._types.Void); | |
| var paramDef = new ParameterDefinition("propertyName", | |
| ParameterAttributes.None, | |
| _types.String); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class PersonViewModel | |
| { | |
| [Viewable] | |
| public string Name { get; set; } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class PersonViewModel : INotifyPropertyChanged | |
| { | |
| private string _name; | |
| public event PropertyChangedEventHandler PropertyChanged; | |
| public string Name | |
| { | |
| get | |
| { |