public void AddPropertyCouple <T1, T2>(PropertyCouple <T1, T2> couple)
        {
            PropertyCoupleExtened <T1, T2> pr = new PropertyCoupleExtened <T1, T2>(couple, _Object1, _Object2);

            if (pr.IsSameName)
            {
                if (!_PropertyCouples.TryAdd(pr.PropName1, pr))
                {
                    string msg = "Tryed to bind pporperty with alredy binded property. " + Environment.NewLine;
                    msg += Convert.ToString(_Object1) + "; " + Convert.ToString(_Object2) + ";" + Environment.NewLine;
                    msg += pr.Property1Info.ToString() + "; " + pr.Property2Info.ToString() + ";";

                    throw new ArgumentException(msg);
                }
            }
            else
            {
                if (!_PropertyCouples.TryAdd(pr.PropName1, pr))
                {
                    string msg = "Tryed to bind pporperty with alredy binded property. " + Environment.NewLine;
                    msg += Convert.ToString(_Object1) + "; " + Convert.ToString(_Object2) + ";" + Environment.NewLine;
                    msg += pr.Property1Info.ToString() + "; " + pr.Property2Info.ToString() + ";";

                    throw new ArgumentException(msg);
                }
                if (!_PropertyCouples.TryAdd(pr.PropName2, pr))
                {
                    string msg = "Tryed to bind pporperty with alredy binded property. " + Environment.NewLine;
                    msg += Convert.ToString(_Object1) + "; " + Convert.ToString(_Object2) + ";" + Environment.NewLine;
                    msg += pr.Property1Info.ToString() + "; " + pr.Property2Info.ToString() + ";";

                    throw new ArgumentException(msg);
                }
            }
        }
Example #2
0
        public PropertyCoupleExtened(PropertyCouple <T1, T2> couple, object obj1, object obj2) : base(couple)
        {
            var type1 = obj1.GetType();
            var type2 = obj2.GetType();

            _Property1Info = type1.GetProperty(PropName1);
            _Property2Info = type2.GetProperty(PropName2);
        }
Example #3
0
        public PropertyCouple(PropertyCouple <T1, T2> couple)
        {
            this._PropName1 = couple._PropName1;
            this._PropName2 = couple._PropName2;

            this._PropertyConverter1 = couple._PropertyConverter1;
            this._PropertyConverter2 = couple._PropertyConverter2;

            this._Covertor1Info = couple._Covertor1Info;
            this._Covertor2Info = couple._Covertor2Info;
        }
Example #4
0
        public virtual bool Equals(PropertyCouple <T1, T2> couple)
        {
            if (Object.ReferenceEquals(couple, null))
            {
                return(false);
            }

            if (Object.ReferenceEquals(this, couple))
            {
                return(true);
            }

            if (this.GetType() != couple.GetType())
            {
                return(false);
            }

            return(this._PropName1 == couple._PropName2);
        }