Ejemplo n.º 1
0
 //-------------------------------------------------------------------
 public void MenuDeleteKeepChildren_Click(object sender, EventArgs e)
 {
     if (_MenuTaxonTreeNode == null)
     {
         return;
     }
     foreach (TaxonTreeNode child in _MenuTaxonTreeNode.Children)
     {
         _MenuTaxonTreeNode.AddSiblingBefore(child);
     }
     _MenuTaxonTreeNode.Children.Clear();
     _MenuTaxonTreeNode.Father.Children.Remove(_MenuTaxonTreeNode);
     RefreshGraph();
 }
Ejemplo n.º 2
0
        //-------------------------------------------------------------------
        public void AddSiblingAbove(TaxonTreeNode _taxon)
        {
            if (_taxon == null)
            {
                return;
            }
            string firstName = null;

            if (_taxon.Desc.ClassicRank == ClassicRankEnum.Espece)
            {
                string[] parts = _taxon.Desc.RefMainName.Split(' ');
                if (parts.Length >= 2)
                {
                    firstName = parts[0];
                }
            }
            NewTaxon dlg = new TaxonDialog.NewTaxon(firstName)
            {
                TopMost        = true,
                CheckNameUsage = true
            };

            dlg.ShowDialog();
            if (dlg.DialogResult != DialogResult.OK)
            {
                return;
            }

            TaxonDesc newTaxon = new TaxonDesc(dlg.TaxonName)
            {
                ClassicRank = _taxon.Desc.ClassicRank
            };

            TaxonTreeNode newNode = new TaxonTreeNode(newTaxon);

            _taxon.AddSiblingBefore(newNode);
            _taxon.Father.Expand();
            RefreshGraph();
        }