コード例 #1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {// Create a new person with the specified inputs
            Shape newShape = new Shape("Test");

            newShape.Comments = new Comments();
            newShape.Avatar   = "*";
            newShape.Name     = "ShapeName";


            family.Current = newShape;
            family.Add(newShape);

            Shape newShape2 = new Shape("Test2");

            newShape2.Comments = new Comments();
            newShape2.Avatar   = "*";
            newShape2.Name     = "ShapeName2";

            newShape2.Parents.Add(newShape);

            newShape.Children.Add(newShape2);
            family.Add(newShape2);


            family.OnContentChanged();
        }
コード例 #2
0
        /// <summary>
        /// Performs the business logic for adding the Parent relationship between the person and the parent.
        /// </summary>
        public static void AddParent(UMLCollection family, Shape shape, Shape parent)
        {
            // Add the parent to the main collection of people.
            family.Add(parent);

            // Setter for property change notification
            shape.HasParents = true;
        }