Esempio n. 1
0
        public static void QuietlyReload <T>(this PropertyChangedBase presenter, ref ICollectionView list, string propertyName)
        {
            var temp = list;

            list = new ListCollectionView(new List <T>());
            presenter.NotifyOfPropertyChange(propertyName);
            list = temp;
            presenter.NotifyOfPropertyChange(propertyName);
        }
Esempio n. 2
0
        public static void QuietlyReload(this PropertyChangedBase presenter, ref IList list, string propertyName)
        {
            var temp = list;

            list = new List <IEnumerable>();
            presenter.NotifyOfPropertyChange(propertyName);
            list = temp;
            presenter.NotifyOfPropertyChange(propertyName);
        }
Esempio n. 3
0
        public static void QuietlyReload <T>(this PropertyChangedBase presenter, ref IEnumerable <T> list, string propertyName)
        {
            var temp = list;

            list = null;
            presenter.NotifyOfPropertyChange(propertyName);
            list = temp;
            presenter.NotifyOfPropertyChange(propertyName);
        }
Esempio n. 4
0
        public static bool SetFieldObj <T>(this PropertyChangedBase obj
                                           , ref T field, T value
                                           , bool overrideChecks = false
                                           , [System.Runtime.CompilerServices.CallerMemberName] string propertyName = "")
            where T : class, IEquatable <T>
        {
            if (obj == null)
            {
                return(false);
            }

            if (!overrideChecks)
            {
                if (field == null)
                {
                    if (value == null)
                    {
                        return(false);
                    }
                }
                else if (field.Equals(value))
                {
                    return(false);
                }
            }

            field = value;

            if (obj.IsNotifying)
            {
                obj.NotifyOfPropertyChange(propertyName);
            }

            return(true);
        }
Esempio n. 5
0
        public static bool SetFieldEnum <TEnum>(this PropertyChangedBase obj
                                                , ref TEnum field, TEnum value
                                                , bool overrideChecks = false
                                                , [System.Runtime.CompilerServices.CallerMemberName] string propertyName = "")
            where TEnum : struct, IComparable, IFormattable, IConvertible
        {
            if (obj == null)
            {
                return(false);
            }

            if (!overrideChecks)
            {
                if (field.ToInt64(null) == value.ToInt64(null))
                {
                    return(false);
                }
            }

            field = value;

            if (obj.IsNotifying)
            {
                obj.NotifyOfPropertyChange(propertyName);
            }

            return(true);
        }
Esempio n. 6
0
        public static bool SetField <T>(this PropertyChangedBase obj
                                        , ref T field, T value
                                        , bool overrideChecks = false
                                        , [System.Runtime.CompilerServices.CallerMemberName] string propertyName = "")
        {
            if (obj == null)
            {
                return(false);
            }

            if (!overrideChecks)
            {
                if (EqualityComparer <T> .Default.Equals(field, value))
                {
                    return(false);
                }
            }

            field = value;

            if (obj.IsNotifying)
            {
                obj.NotifyOfPropertyChange(propertyName);
            }

            return(true);
        }
 public static bool SetValue <T>(this PropertyChangedBase viewModel, ref T field, T newValue, Expression <Func <T> > propertyExpression)
 {
     if (EqualityComparer <T> .Default.Equals(field, newValue))
     {
         return(false);
     }
     field = newValue;
     viewModel.NotifyOfPropertyChange(propertyExpression);
     return(true);
 }
 public static bool Set <T>(this PropertyChangedBase screen, ref T field, T value, [CallerMemberName] string propertyName = null)
 {
     if (EqualityComparer <T> .Default.Equals(field, value))
     {
         return(false);
     }
     field = value;
     screen.NotifyOfPropertyChange(propertyName);
     return(true);
 }
        public static bool SetValue <T>(this PropertyChangedBase viewModel, ref T field, T newValue, [CallerMemberName] string propertyName = null)
        {
            if (EqualityComparer <T> .Default.Equals(field, newValue))
            {
                return(false);
            }

            field = newValue;
            viewModel.NotifyOfPropertyChange(propertyName);
            return(true);
        }
Esempio n. 10
0
        public static bool SetPropertyValue <T>(this PropertyChangedBase @base, ref T property, T value, [CallerMemberName] string propertyName = "")
        {
            if (Equals(property, value))
            {
                return(false);
            }

            property = value;
            @base.NotifyOfPropertyChange(propertyName);
            return(true);
        }
Esempio n. 11
0
        public static bool Set <T>(this PropertyChangedBase propertyChangedBase, ref T oldValue, T newValue, [CallerMemberName] string propertyName = null)
        {
            if (Equals(oldValue, newValue))
            {
                return(false);
            }

            oldValue = newValue;
            propertyChangedBase.NotifyOfPropertyChange(propertyName);

            return(true);
        }
Esempio n. 12
0
        public static bool SetPropertyChanged(this PropertyChangedBase obj
                                              , [System.Runtime.CompilerServices.CallerMemberName] string propertyName = "")
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj.IsNotifying)
            {
                obj.NotifyOfPropertyChange(propertyName);
            }

            return(true);
        }