Exemple #1
0
        //=========================================================================================
        // Constructors
        //

        public TaxonDesc(string _name)
        {
            if (string.IsNullOrEmpty(_name))
            {
                RefMultiName = new Helpers.MultiName("");
            }
            else
            {
                RefMultiName = new Helpers.MultiName(_name.Substring(0, 1).ToUpper() + _name.Substring(1));
            }
        }
        private void addButton_Click(object sender, EventArgs e)
        {
            if (classicRankCB.Text == string.Empty)
            {
                errorLabel.Text = "Please select a classic rank value";
                return;
            }

            if (RedListCategory.Text == string.Empty)
            {
                errorLabel.Text = "Please select a red list category";
                return;
            }

            string nameString = nameTextBox.Text;

            if (nameString == string.Empty)
            {
                nameString = "Unnamed";
            }

            Helpers.MultiName name        = new Helpers.MultiName(nameString);
            Helpers.MultiName frenchName  = new Helpers.MultiName(frenchNameTextBox.Text);
            ClassicRankEnum   classicRank = ClassicRankEnum.None;

            Enum.TryParse <ClassicRankEnum>(classicRankCB.Text, out classicRank);
            RedListCategoryEnum redListCategory = RedListCategoryEnum.NotEvaluated;

            Enum.TryParse <RedListCategoryEnum>(RedListCategoryCB.Text, out redListCategory);

            TaxonDesc desc = new TaxonDesc
            {
                RefMultiName    = name,
                ClassicRank     = classicRank,
                RedListCategory = redListCategory,
                FrenchMultiName = frenchName
            };


            node = new TaxonTreeNode
            {
                Desc = desc
            };

            Close();
        }