Пример #1
0
        private void _UpdateSelectOfMenuItem(MenuItem selected, MenuItem select)
        {
            if (selected is not null && select is not null)
            {
                Taxon selectedTaxon = Common.SelectedTaxon;

                selected.IsEnabled = false;
                select.IsEnabled   = selectedTaxon != Common.RightButtonTaxon;

                if (selectedTaxon is null)
                {
                    selected.Visibility = Visibility.Collapsed;
                }
                else
                {
                    selected.Visibility = Visibility.Visible;

                    if (selectedTaxon.IsAnonymous)
                    {
                        selected.Header = "已选择: <节点>";
                    }
                    else
                    {
                        string taxonName = selectedTaxon.GetLongName();

                        if (taxonName.Length > 32)
                        {
                            selected.Header = string.Concat("已选择:\"", taxonName[..32], "...\"");
Пример #2
0
        private void _UpdateTaxon()
        {
            if (_Taxon is not null)
            {
                textBlock_TaxonName.Text = _Taxon.GetLongName();

                Rank rank = _Taxon.Rank;

                bool basicPrimary = rank.IsBasicPrimaryRank();
                bool bellowGenus  = false;

                if (rank.IsPrimaryOrSecondaryRank())
                {
                    Rank inheritedPrimaryRank = _Taxon.GetInheritedPrimaryRank();

                    bellowGenus = inheritedPrimaryRank.IsPrimaryRank() && inheritedPrimaryRank <= Rank.Genus;
                }

                textBlock_TaxonName.FontStyle  = bellowGenus ? FontStyles.Italic : FontStyles.Normal;
                textBlock_TaxonName.FontWeight = basicPrimary ? FontWeights.Bold : FontWeights.Normal;

                //

                _UpdateIsUndet();

                if (_Taxon.IsNamed && _Taxon.IsExtinct)
                {
                    if (exSymbol is null)
                    {
                        exSymbol = new ExSymbol()
                        {
                            Margin = new Thickness(0, 0, 3, 0)
                        };
                        panel_State.Children.Add(exSymbol);
                    }
                    else
                    {
                        exSymbol.Visibility = Visibility.Visible;
                    }
                }
                else
                {
                    if (exSymbol is not null)
                    {
                        exSymbol.Visibility = Visibility.Collapsed;
                    }
                }

                if (_Taxon.IsNamed && _Taxon.IsParaphyly)
                {
                    if (paraphylySymbol is null)
                    {
                        paraphylySymbol = new ParaphylySymbol()
                        {
                            Margin            = new Thickness(3, 0, 0, 0),
                            VerticalAlignment = VerticalAlignment.Top
                        };
                        grid_PolyOrPara.Children.Add(paraphylySymbol);
                    }
                    else
                    {
                        paraphylySymbol.Visibility = Visibility.Visible;
                    }
                }
                else
                {
                    if (paraphylySymbol is not null)
                    {
                        paraphylySymbol.Visibility = Visibility.Collapsed;
                    }
                }

                if (_Taxon.IsNamed && _Taxon.IsPolyphyly)
                {
                    if (polyphylySymbol is null)
                    {
                        polyphylySymbol = new PolyphylySymbol()
                        {
                            Margin            = new Thickness(3, 0, 0, 0),
                            VerticalAlignment = VerticalAlignment.Top
                        };
                        grid_PolyOrPara.Children.Add(polyphylySymbol);
                    }
                    else
                    {
                        polyphylySymbol.Visibility = Visibility.Visible;
                    }
                }
                else
                {
                    if (polyphylySymbol is not null)
                    {
                        polyphylySymbol.Visibility = Visibility.Collapsed;
                    }
                }
            }
        }