Example #1
0
        public DistributionControl(TaxaPlugin plugin, Data.User user, TaxonViewModel taxon)
            : base(user, String.Format("Taxon::DistributionControl::{0}", taxon.TaxaID.Value))
        {
            InitializeComponent();

            this.AllowDrop = true;

            this.Taxon = taxon;
            this.Plugin = plugin;
            txtDistribution.DataContext = taxon;

            var list = Service.GetDistribution(taxon.TaxaID);
            list.Sort((a, b) => {
                return a.DistRegionFullPath.CompareTo(b.DistRegionFullPath);
            });

            _model = CreateModelFromList(list);
            tvwDist.ItemsSource = _model;
            ExpandAll(_model);
            grpDist.IsEnabled = false;

            taxon.DataChanged += new DataChangedHandler((t) => {
                RegisterUniquePendingChange(new UpdateDistQualDatabaseCommand(taxon.Taxon));
            });

            this.PreviewDragEnter += new DragEventHandler(DistributionControl_PreviewDrag);
            this.PreviewDragOver += new DragEventHandler(DistributionControl_PreviewDrag);

            this.Drop += new DragEventHandler(DistributionControl_Drop);
        }
Example #2
0
        public TaxonExplorer(TaxaPlugin owner)
            : base(owner.User)
        {
            InitializeComponent();

            Owner = owner;

            _searchModel = new ObservableCollection<TaxonViewModel>();
            tvwResults.ItemsSource = _searchModel;

            ListCollectionView dataView = CollectionViewSource.GetDefaultView(tvwResults.ItemsSource) as ListCollectionView;
            dataView.SortDescriptions.Clear();
            dataView.CustomSort = new TaxonComparer();
            dataView.Refresh();

            IsManualSort = Config.GetUser(Owner.User, "Taxa.ManualSort", false);

            if (IsManualSort) {
                btnDown.Visibility = System.Windows.Visibility.Visible;
                btnUp.Visibility = System.Windows.Visibility.Visible;
            }

            tvwAllTaxa.PreviewKeyDown += new KeyEventHandler(TaxonExplorer_PreviewKeyDown);
            tvwResults.PreviewKeyDown += new KeyEventHandler(TaxonExplorer_PreviewKeyDown);

            btnLock.Checked += new RoutedEventHandler(btnLock_Checked);
            btnLock.Unchecked += new RoutedEventHandler(btnLock_Unchecked);

            tvwAllTaxa.MouseDoubleClick += new MouseButtonEventHandler((sender, e) => PerformDefaultAction(sender as TreeView));
            tvwResults.MouseDoubleClick += new MouseButtonEventHandler((sender, e) => PerformDefaultAction(sender as TreeView));

            favorites.BindUser(User, this);
        }
Example #3
0
 public TaxonDropContext(TaxonViewModel source, TaxonViewModel target, TaxaPlugin plugin)
 {
     this.TaxaPlugin = plugin;
     this.Source = source;
     this.Target = target;
     this.SourceRank = TaxaPlugin.Service.GetTaxonRank(source.Taxon);
     this.TargetRank = TaxaPlugin.Service.GetTaxonRank(target.Taxon);
     this.SourceChildRank = GetChildElementType(source);
     this.TargetChildRank = GetChildElementType(target);
 }
Example #4
0
        public TaxonDetails(TaxaPlugin plugin, TaxonViewModel taxon, User user, Action<TaxonViewModel> committedAction, bool readOnly)
            : base(user, "TaxonDetails::" + taxon.TaxaID.Value)
        {
            InitializeComponent();

            this.Plugin = plugin;
            _committedAction = committedAction;

            tabControl.AddTabItem("General", new TaxonNameDetails(taxon.TaxaID, User, committedAction) { IsReadOnly = readOnly });

            if (taxon.IsAvailableOrLiteratureName) {
                TaxonRank rank = Service.GetTaxonRank(taxon.Taxon);
                switch (rank.Category.ToLower()) {
                    case "g":
                        tabControl.AddTabItem("Available Name", new GenusAvailableNameControl(taxon, user) { IsReadOnly = readOnly });
                        break;
                    case "s":
                        tabControl.AddTabItem("Available Name", new SpeciesAvailableNameControl(taxon, user) { IsReadOnly = readOnly });
                        break;
                    default:
                        tabControl.AddTabItem("Available Name", new AvailableNameControl(taxon, user) { IsReadOnly = readOnly });
                        break;
                }
            } else {
                tabControl.AddTabItem("Common Names", new CommonNamesControl(taxon, user) { IsReadOnly = readOnly });
            }

            tabControl.AddTabItem("References", new ReferencesControl(user, TraitCategoryType.Taxon, taxon.TaxaID) { IsReadOnly = readOnly });

            if ((!taxon.AvailableName.ValueOrFalse() && !taxon.LiteratureName.ValueOrFalse())) {
                tabControl.AddTabItem("Distribution", new DistributionControl(Plugin, user, taxon) { IsReadOnly = readOnly });
            }

            tabControl.AddTabItem("Multimedia", new MultimediaControl(User, TraitCategoryType.Taxon, taxon) { IsReadOnly = readOnly });
            tabControl.AddTabItem("Associates", new OneToManyControl(new AssociatesOneToManyController(User, TraitCategoryType.Taxon, taxon)) { IsReadOnly = readOnly });
            tabControl.AddTabItem("Traits", new TraitControl(User, TraitCategoryType.Taxon, taxon) { IsReadOnly = readOnly });
            tabControl.AddTabItem("Notes", new NotesControl(User, TraitCategoryType.Taxon, taxon) { IsReadOnly = readOnly });
            tabControl.AddTabItem("Ownership", new OwnershipDetails(taxon.Taxon));

            this.Taxon = taxon;

            this.ChangesCommitted += new PendingChangesCommittedHandler(TaxonDetails_ChangesCommitted);
        }
Example #5
0
 public DragDropOptions(TaxaPlugin owner)
 {
     _owner = owner;
     InitializeComponent();
     Title = owner.GetCaption("DragDropOptions.Title");
 }