Esempio n. 1
0
        internal static AtomSourceProperty Get(Type type)
        {
            return(sources.GetOrAdd(type, t => {
                var p = new AtomSourceProperty(t);
                if (p.Any())
                {
                    return p;
                }

                return null;
            }));
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="propertyName"></param>
        public void OnPropertyChanged([CallerMemberName] string propertyName = "")
        {
            if (preventRecursive)
            {
                System.Diagnostics.Debug.WriteLine("WARNING!!!! You should avoid recursive OnPropertyChanged method calls");
                return;
            }
            try
            {
                preventRecursive = true;
                var changed = PropertyChanged;
                if (changed == null)
                {
                    return;
                }


                changed(this, new PropertyChangedEventArgs(propertyName));


                var source = AtomSourceProperty.Get(GetType());
                if (source != null)
                {
                    List <string> dependents = null;
                    if (source.TryGetValue(propertyName, out dependents))
                    {
                        foreach (var n in dependents)
                        {
                            changed(this, new PropertyChangedEventArgs(n));
                        }
                    }
                }
            }
            finally {
                preventRecursive = false;
            }
        }