示例#1
0
        protected void VerifyValidDelegation(INotifyPropertyChanged foreignObject, string foreignProperty,
                                             string[] localProperties)
        {
#if DEBUG
            VerifyPropertyExists.InDebugBuilds(this, localProperties);
            if (foreignObject == null)
            {
                throw new InvalidOperationException("Delegation to a null object");
            }
            VerifyPropertyExists.InDebugBuilds(foreignObject, foreignProperty);
#endif
        }
示例#2
0
 public static void WhenMemberChangesOnce(this INotifyPropertyChanged target, string member, Action action)
 {
     VerifyPropertyExists.InDebugBuilds((object)target, member);
     void method(object s, PropertyChangedEventArgs e)
     {
         if (e.PropertyName.Equals(member, StringComparison.Ordinal))
         {
             action();
             target.PropertyChanged -= method;
         }
     };
     target.PropertyChanged += method;
 }
示例#3
0
        public static Action WhenMemberChanges(this INotifyPropertyChanged target, string member, Action action)
        {
            VerifyPropertyExists.InDebugBuilds((object)target, member);
            PropertyChangedEventHandler method = (s, e) =>
            {
                if (e.PropertyName.Equals(member, StringComparison.Ordinal))
                {
                    action();
                }
            };

            target.PropertyChanged += method;

            return(() => target.PropertyChanged -= method);
        }
示例#4
0
 /// <summary>
 ///   Notifies subscribers of the property change.
 /// </summary>
 /// <param name = "propertyName">SheetName of the property.</param>
 protected void OnPropertyChanged(string propertyName)
 {
     VerifyPropertyExists.InDebugBuilds(this, propertyName);
     PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
 }