public void Clone(IWorldContainer copyParent)
        {
            PlantType clone = new PlantType(app, copyParent as Grass, instances, name,
                                            imageName, scaleWidthLow, scaleWidthHi, scaleHeightLow, ScaleHeightHi, color, colorMultLow,
                                            colorMultHi, windMagnitude);

            copyParent.Add(clone);
        }
 public void Execute()
 {
     if (plant == null)
     {
         plant = new PlantType(app, parent, instances, name, imageName, scaleWidthLow, scaleWidthHi, scaleHeightLow, scaleHeightHi, colorRGB, colorMultLow, colorMultHi, windMagnitude);
     }
     this.parent.Add(plant);
     for (int i = app.SelectedObject.Count - 1; i >= 0; i--)
     {
         app.SelectedObject[i].Node.UnSelect();
     }
     if (plant.Node != null)
     {
         plant.Node.Select();
     }
 }
Beispiel #3
0
        public void FromXml(XmlReader r)
        {
            // first parse the attributes
            for (int i = 0; i < r.AttributeCount; i++)
            {
                r.MoveToAttribute(i);

                // set the field in this object based on the element we just read
                switch (r.Name)
                {
                case "Name":
                    this.name = r.Value;
                    break;
                }
            }
            r.MoveToElement(); //Moves the reader back to the element node.

            if (!r.IsEmptyElement)
            {
                while (r.Read())
                {
                    if (r.NodeType == XmlNodeType.Whitespace)
                    {
                        continue;
                    }
                    if (r.NodeType == XmlNodeType.EndElement)
                    {
                        break;
                    }
                    if (r.NodeType == XmlNodeType.Element)
                    {
                        switch (r.Name)
                        {
                        case "PlantType":
                            PlantType plant = new PlantType(r, this, app);
                            Add(plant);
                            break;
                        }
                    }
                }
            }
        }
        public void AddToTree(WorldTreeNode parentNode)
        {
            this.parentNode = parentNode;
            inTree          = true;

            // create a node for the collection and add it to the parent
            node = app.MakeTreeNode(this, NodeName);

            parentNode.Nodes.Add(node);
            PlantType plantType = this;

            // build the menu
            CommandMenuBuilder menuBuilder = new CommandMenuBuilder();

            menuBuilder.Add("Copy Description", "", app.copyToClipboardMenuButton_Click);
            menuBuilder.Add("Help", "Plant_Type", app.HelpClickHandler);
            menuBuilder.Add("Delete", new DeleteObjectCommandFactory(app, parent, this), app.DefaultCommandClickHandler);
            node.ContextMenuStrip = menuBuilder.Menu;
            buttonBar             = menuBuilder.ButtonBar;
        }
 public void Clone(IWorldContainer copyParent)
 {
     PlantType clone = new PlantType(app, copyParent as Grass, instances, name,
         imageName, scaleWidthLow, scaleWidthHi, scaleHeightLow, ScaleHeightHi, color, colorMultLow,
         colorMultHi, windMagnitude);
     copyParent.Add(clone);
 }
 public void Execute()
 {
     if (plant == null)
     {
         plant = new PlantType(app, parent, instances, name, imageName, scaleWidthLow, scaleWidthHi, scaleHeightLow, scaleHeightHi, colorRGB, colorMultLow, colorMultHi, windMagnitude);
     }
     this.parent.Add(plant);
     for (int i = app.SelectedObject.Count - 1; i >= 0; i--)
     {
         app.SelectedObject[i].Node.UnSelect();
     }
     if (plant.Node != null)
     {
         plant.Node.Select();
     }
 }
        public void FromXml(XmlReader r)
        {
            // first parse the attributes
            for (int i = 0; i < r.AttributeCount; i++)
            {
                r.MoveToAttribute(i);

                // set the field in this object based on the element we just read
                switch (r.Name)
                {
                    case "Name":
                        this.name = r.Value;
                        break;
                }
            }
            r.MoveToElement(); //Moves the reader back to the element node.

            if (!r.IsEmptyElement)
            {
                while (r.Read())
                {
                    if (r.NodeType == XmlNodeType.Whitespace)
                    {
                        continue;
                    }
                    if (r.NodeType == XmlNodeType.EndElement)
                    {
                        break;
                    }
                    if (r.NodeType == XmlNodeType.Element)
                    {
                        switch (r.Name)
                        {
                            case "PlantType":
                                PlantType plant = new PlantType(r, this, app);
                                Add(plant);
                                break;
                        }
                    }
                }
            }
        }