Exemplo n.º 1
0
        public RDMPTaskBarUI()
        {
            InitializeComponent();
            BackColorProvider provider = new BackColorProvider();

            btnHome.Image                 = FamFamFamIcons.application_home;
            btnCatalogues.Image           = CatalogueIcons.Catalogue;
            btnCatalogues.BackgroundImage = provider.GetBackgroundImage(btnCatalogues.Size, RDMPCollection.Catalogue);

            btnCohorts.Image           = CatalogueIcons.CohortIdentificationConfiguration;
            btnCohorts.BackgroundImage = provider.GetBackgroundImage(btnCohorts.Size, RDMPCollection.Cohort);

            btnSavedCohorts.Image           = CatalogueIcons.AllCohortsNode;
            btnSavedCohorts.BackgroundImage = provider.GetBackgroundImage(btnSavedCohorts.Size, RDMPCollection.SavedCohorts);

            btnDataExport.Image           = CatalogueIcons.Project;
            btnDataExport.BackgroundImage = provider.GetBackgroundImage(btnDataExport.Size, RDMPCollection.DataExport);

            btnTables.Image           = CatalogueIcons.TableInfo;
            btnTables.BackgroundImage = provider.GetBackgroundImage(btnTables.Size, RDMPCollection.Tables);

            btnLoad.Image           = CatalogueIcons.LoadMetadata;
            btnLoad.BackgroundImage = provider.GetBackgroundImage(btnLoad.Size, RDMPCollection.DataLoad);

            btnFavourites.Image   = CatalogueIcons.Favourite;
            btnDeleteLayout.Image = FamFamFamIcons.delete;
        }
Exemplo n.º 2
0
        public NavigateToObjectUI(IActivateItems activator, string initialSearchQuery = null, RDMPCollection focusedCollection = RDMPCollection.None) : base(activator)
        {
            _coreIconProvider  = activator.CoreIconProvider;
            _favouriteProvider = Activator.FavouritesProvider;
            _magnifier         = FamFamFamIcons.magnifier;
            InitializeComponent();

            CompletionAction = Emphasise;

            activator.Theme.ApplyTo(toolStrip1);

            _searchables = Activator.CoreChildProvider.GetAllSearchables();

            _usefulPropertyFinder = new AttributePropertyFinder <UsefulPropertyAttribute>(_searchables.Keys);

            textBox1.Focus();
            textBox1.Text = initialSearchQuery;

            textBox1.TextChanged += tbFind_TextChanged;
            textBox1.KeyUp       += _scintilla_KeyUp;

            FetchMatches(initialSearchQuery, CancellationToken.None);
            StartPosition  = FormStartPosition.CenterScreen;
            DoubleBuffered = true;

            _types     = _searchables.Keys.Select(k => k.GetType()).Distinct().ToArray();
            _typeNames = new HashSet <string>(_types.Select(t => t.Name));

            foreach (Type t in StartingEasyFilters.SelectMany(v => v.Value))
            {
                if (!_typeNames.Contains(t.Name))
                {
                    _typeNames.Add(t.Name);
                }
            }

            //autocomplete is all Type names (e.g. "Catalogue") + all short codes (e.g. "c")
            textBox1.AutoCompleteMode   = AutoCompleteMode.Append;
            textBox1.AutoCompleteSource = AutoCompleteSource.CustomSource;
            textBox1.AutoCompleteCustomSource.AddRange(
                _typeNames.Union(ShortCodes.Select(kvp => kvp.Key)).ToArray());

            Type[] startingFilters = null;

            if (focusedCollection != RDMPCollection.None && StartingEasyFilters.ContainsKey(focusedCollection))
            {
                startingFilters = StartingEasyFilters[focusedCollection];
            }

            BackColorProvider backColorProvider = new BackColorProvider();

            foreach (Type t in EasyFilterTypesAndAssociatedCollections.Keys)
            {
                var b = new ToolStripButton();
                b.Image        = activator.CoreIconProvider.GetImage(t);
                b.CheckOnClick = true;
                b.Tag          = t;
                b.DisplayStyle = ToolStripItemDisplayStyle.Image;

                string shortCode = ShortCodes.Single(kvp => kvp.Value == t).Key;

                b.Text            = $"{t.Name} ({shortCode})";
                b.CheckedChanged += CollectionCheckedChanged;
                b.Checked         = startingFilters != null && startingFilters.Contains(t);

                b.BackgroundImage = backColorProvider.GetBackgroundImage(b.Size, EasyFilterTypesAndAssociatedCollections[t]);

                toolStrip1.Items.Add(b);
            }
        }