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);
                }
            }
        }
Exemple #2
0
        public virtual bool Equals(PropertyCoupleExtened <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.Property1Info == couple.Property2Info);
        }