Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Link"/> class.
        /// </summary>
        /// <param name="origin">The origin<see cref="IFigures"/>.</param>
        /// <param name="target">The target<see cref="IFigures"/>.</param>
        /// <param name="keyRubric">The keyRubric<see cref="IRubric"/>.</param>
        public Link(IFigures origin, IFigures target, IRubric keyRubric) : this(origin, target)
        {
            var originRubric = origin.Rubrics[keyRubric];
            var targetRubric = target.Rubrics[keyRubric];

            if (originRubric != null && targetRubric != null)
            {
                OriginKeys.Add(originRubric);
                TargetKeys.Add(targetRubric);
            }
            else
            {
                throw new IndexOutOfRangeException("Rubric not found");
            }
            OriginKeys.Update();
            TargetKeys.Update();
        }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Link"/> class.
 /// </summary>
 /// <param name="origin">The origin<see cref="IFigures"/>.</param>
 /// <param name="target">The target<see cref="IFigures"/>.</param>
 /// <param name="keyRubricNames">The keyRubricNames<see cref="string[]"/>.</param>
 public Link(IFigures origin, IFigures target, string[] keyRubricNames) : this(origin, target)
 {
     foreach (var name in keyRubricNames)
     {
         var originRubric = origin.Rubrics[name];
         var targetRubric = target.Rubrics[name];
         if (originRubric != null && targetRubric != null)
         {
             OriginKeys.Add(originRubric);
             TargetKeys.Add(targetRubric);
         }
         else
         {
             throw new IndexOutOfRangeException("Rubric not found");
         }
     }
     OriginKeys.Update();
     TargetKeys.Update();
 }