public virtual void SetDatabaseObject(IActivateItems activator, T databaseObject) { SetItemActivator(activator); Activator.RefreshBus.EstablishSelfDestructProtocol(this, activator, databaseObject); DatabaseObject = databaseObject; CommonFunctionality.ClearToolStrip(); if (_colorIndicator == null && AssociatedCollection != RDMPCollection.None) { var colorProvider = new BackColorProvider(); _colorIndicator = new Control(); _colorIndicator.Dock = DockStyle.Top; _colorIndicator.Location = new Point(0, 0); _colorIndicator.Size = new Size(150, BackColorProvider.IndiciatorBarSuggestedHeight); _colorIndicator.TabIndex = 0; _colorIndicator.BackColor = colorProvider.GetColor(AssociatedCollection); this.Controls.Add(this._colorIndicator); } if (_binder == null) { _binder = new BinderWithErrorProviderFactory(activator); } SetBindings(_binder, databaseObject); if (this is ISaveableUI) { ObjectSaverButton1.SetupFor(this, databaseObject, activator); } }
private void CreateColorIndicator(TreeListView tree, RDMPCollection collection) { if (Tree.Parent == null || collection == RDMPCollection.None) { return; } var indicatorHeight = BackColorProvider.IndiciatorBarSuggestedHeight; BackColorProvider p = new BackColorProvider(); var ctrl = new Control(); ctrl.BackColor = p.GetColor(collection); ctrl.Location = new Point(Tree.Location.X, tree.Location.Y - indicatorHeight); ctrl.Height = indicatorHeight; ctrl.Width = Tree.Width; if (Tree.Dock != DockStyle.None) { ctrl.Dock = DockStyle.Top; } else { ctrl.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right; } Tree.Parent.Controls.Add(ctrl); }
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; }
private PersistableToolboxDockContent Show(RDMPCollection collection, RDMPCollectionUI control, string label, Bitmap image) { BackColorProvider c = new BackColorProvider(); image = c.DrawBottomBar(image, collection); var content = _windowFactory.Create(ActivateItems, control, label, image, collection);//these are collections so are not tracked with a window tracker. content.Closed += (s, e) => content_Closed(collection); _visibleToolboxes.Add(collection, content); content.Show(_mainDockPanel, DockState.DockLeft); return(content); }
public virtual void SetDatabaseObject(IActivateItems activator, T databaseObject) { SetItemActivator(activator); Activator.RefreshBus.EstablishSelfDestructProtocol(this, activator, databaseObject); DatabaseObject = databaseObject; CommonFunctionality.ClearToolStrip(); if (_colorIndicator == null && AssociatedCollection != RDMPCollection.None) { var colorProvider = new BackColorProvider(); _colorIndicator = new Control(); _colorIndicator.Dock = DockStyle.Top; _colorIndicator.Location = new Point(0, 0); _colorIndicator.Size = new Size(150, BackColorProvider.IndiciatorBarSuggestedHeight); _colorIndicator.TabIndex = 0; _colorIndicator.BackColor = colorProvider.GetColor(AssociatedCollection); this.Controls.Add(this._colorIndicator); } if (_readonlyIndicator == null) { _readonlyIndicator = new Label(); _readonlyIndicator.Dock = DockStyle.Top; _readonlyIndicator.Location = new Point(0, 0); _readonlyIndicator.Size = new Size(150, 20); _readonlyIndicator.TabIndex = 0; _readonlyIndicator.TextAlign = ContentAlignment.MiddleLeft; _readonlyIndicator.BackColor = System.Drawing.SystemColors.HotTrack; _readonlyIndicator.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); _readonlyIndicator.ForeColor = System.Drawing.Color.Moccasin; } if (databaseObject is IMightBeReadOnly ro) { if (ro.ShouldBeReadOnly(out string reason)) { _readonlyIndicator.Text = reason; this.Controls.Add(this._readonlyIndicator); ReadOnly = true; } else { //removing it allows us to handle refreshes (where something becomes unfrozen for example) this.Controls.Remove(this._readonlyIndicator); ReadOnly = false; } } if (_binder == null) { _binder = new BinderWithErrorProviderFactory(activator); } SetBindings(_binder, databaseObject); if (this is ISaveableUI) { ObjectSaverButton1.SetupFor(this, databaseObject, activator); } }
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); } }