예제 #1
0
        public RDMPCollection GetCollectionForRootObject(object root)
        {
            if (FavouritesCollectionUI.IsRootObject(ActivateItems, root))
            {
                return(RDMPCollection.Favourites);
            }

            if (CatalogueCollectionUI.IsRootObject(root))
            {
                return(RDMPCollection.Catalogue);
            }

            if (CohortIdentificationCollectionUI.IsRootObject(root))
            {
                return(RDMPCollection.Cohort);
            }

            if (DataExportCollectionUI.IsRootObject(root))
            {
                return(RDMPCollection.DataExport);
            }

            if (LoadMetadataCollectionUI.IsRootObject(root))
            {
                return(RDMPCollection.DataLoad);
            }

            if (TableInfoCollectionUI.IsRootObject(root))
            {
                return(RDMPCollection.Tables);
            }

            if (SavedCohortsCollectionUI.IsRootObject(root))
            {
                return(RDMPCollection.SavedCohorts);
            }

            return(RDMPCollection.None);
        }
예제 #2
0
        /// <summary>
        /// Creates a new instance of the given RDMPCollectionUI specified by the Enum collectionToCreate at the specified dock position
        /// </summary>
        /// <param name="collectionToCreate"></param>
        /// <param name="position"></param>
        /// <returns></returns>
        public PersistableToolboxDockContent Create(RDMPCollection collectionToCreate, DockState position = DockState.DockLeft)
        {
            PersistableToolboxDockContent toReturn;
            RDMPCollectionUI collection;

            switch (collectionToCreate)
            {
            case RDMPCollection.Catalogue:
                collection = new CatalogueCollectionUI();
                toReturn   = Show(RDMPCollection.Catalogue, collection, "Catalogues", CatalogueIcons.Catalogue);
                break;

            case RDMPCollection.DataLoad:
                collection = new LoadMetadataCollectionUI();
                toReturn   = Show(RDMPCollection.DataLoad, collection, "Load Configurations", CatalogueIcons.LoadMetadata);
                break;

            case RDMPCollection.Tables:
                collection = new TableInfoCollectionUI();
                toReturn   = Show(RDMPCollection.Tables, collection, "Tables", CatalogueIcons.TableInfo);
                break;

            case RDMPCollection.DataExport:
                if (RepositoryLocator.DataExportRepository == null)
                {
                    WideMessageBox.Show("Data export database unavailable", "Cannot create DataExport Toolbox because DataExportRepository has not been set/created yet");
                    return(null);
                }

                collection = new DataExportCollectionUI();
                toReturn   = Show(RDMPCollection.DataExport, collection, "Data Export", CatalogueIcons.Project);
                break;

            case RDMPCollection.Cohort:
                collection = new CohortIdentificationCollectionUI();
                toReturn   = Show(RDMPCollection.Cohort, collection, "Cohort Builder", CatalogueIcons.CohortIdentificationConfiguration);
                break;

            case RDMPCollection.SavedCohorts:
                collection = new SavedCohortsCollectionUI();
                toReturn   = Show(RDMPCollection.SavedCohorts, collection, "Saved Cohorts", CatalogueIcons.AllCohortsNode);
                break;

            case RDMPCollection.Favourites:
                collection = new FavouritesCollectionUI();
                toReturn   = Show(RDMPCollection.Favourites, collection, "Favourites", CatalogueIcons.Favourite);
                break;

            default: throw new ArgumentOutOfRangeException("collectionToCreate");
            }

            toReturn.DockState = position;

            collection.SetItemActivator(ActivateItems);

            if (CollectionCreated != null)
            {
                CollectionCreated(this, new RDMPCollectionCreatedEventHandlerArgs(collectionToCreate));
            }

            return(toReturn);
        }