Ejemplo n.º 1
0
        public TaxonNameDetails(int?taxonId, User user, Action <TaxonNameViewModel> successAction)  : base(user, "TaxonNameDetails::" + taxonId.Value)
        {
            _successAction = successAction;

            var   service = new TaxaService(user);
            Taxon taxon   = service.GetTaxon(taxonId.Value);

            _rank        = service.GetTaxonRank(taxon);
            _kingdomList = service.GetKingdomList();
            Kingdom kingdom = _kingdomList.Find((k) => k.KingdomCode.Equals(taxon.KingdomCode));

            _model = new TaxonNameViewModel(taxon, kingdom, _rank);

            _model.DataChanged += new DataChangedHandler(_model_DataChanged);

            InitializeComponent();

            cmbKingdom.ItemsSource = _kingdomList;

            this.chkChangedCombination.Visibility = (_rank != null && _rank.Category == "S" ? Visibility.Visible : Visibility.Hidden);

            if (taxon.AvailableName.ValueOrFalse() || taxon.LiteratureName.ValueOrFalse())
            {
                string phraseCategory = "ALN Name Status";
                chkChangedCombination.Visibility = System.Windows.Visibility.Hidden;
                if (taxon.AvailableName.ValueOrFalse())
                {
                    TaxonRank rank = service.GetTaxonRank(taxon);

                    if (rank != null)
                    {
                        switch (rank.Category.ToLower())
                        {
                        case "g": phraseCategory = "GAN Name Status";
                            break;

                        case "s": phraseCategory = "SAN Name Status";
                            break;
                        }
                    }
                }

                txtNameStatus.BindUser(PluginManager.Instance.User, PickListType.Phrase, phraseCategory, TraitCategoryType.Taxon);
            }
            else
            {
                txtNameStatus.Visibility = System.Windows.Visibility.Collapsed;
                lblNameStatus.Visibility = System.Windows.Visibility.Collapsed;
            }

            this.DataContext       = _model;
            this.ChangesCommitted += new PendingChangesCommittedHandler(TaxonNameDetails_ChangesCommitted);
        }
Ejemplo n.º 2
0
        public SelectRankWindow()
        {
            InitializeComponent();

            var service = new TaxaService(PluginManager.Instance.User);

            _map = service.GetTaxonRankMap();

            var kingdoms = service.GetKingdomList().Where((kingdom) => {
                return(!string.IsNullOrWhiteSpace(kingdom.KingdomCode));
            });

            cmbKingdom.SelectionChanged += new SelectionChangedEventHandler(cmbKingdom_SelectionChanged);

            cmbKingdom.ItemsSource = kingdoms;
            if (kingdoms.Count() > 0)
            {
                cmbKingdom.SelectedIndex = 0;
            }

            this.DataContext = this;
        }