public ActivateItems(ITheme theme, RefreshBus refreshBus, DockPanel mainDockPanel, IRDMPPlatformRepositoryServiceLocator repositoryLocator, WindowFactory windowFactory, WindowManager windowManager, ICheckNotifier globalErrorCheckNotifier) : base(repositoryLocator, globalErrorCheckNotifier) { Theme = theme; WindowFactory = windowFactory; _mainDockPanel = mainDockPanel; _windowManager = windowManager; RefreshBus = refreshBus; ConstructPluginChildProviders(); CoreChildProvider = GetChildProvider(); //Shouldn't ever change externally to your session so doesn't need constantly refreshed FavouritesProvider = new FavouritesProvider(this, repositoryLocator.CatalogueRepository); HistoryProvider = new HistoryProvider(repositoryLocator); //handle custom icons from plugin user interfaces in which CoreIconProvider = new DataExportIconProvider(repositoryLocator, PluginUserInterfaces.ToArray()); SelectIMapsDirectlyToDatabaseTableDialog.ImageGetter = (model) => CoreIconProvider.GetImage(model); WindowArranger = new WindowArranger(this, _windowManager, _mainDockPanel); CommandFactory = new RDMPCombineableFactory(); CommandExecutionFactory = new RDMPCommandExecutionFactory(this); ProblemProviders = new List <IProblemProvider>(); ProblemProviders.Add(new DataExportProblemProvider()); ProblemProviders.Add(new CatalogueProblemProvider()); RefreshProblemProviders(); RefreshBus.Subscribe(this); }
public TestActivateItems(UITests uiTests, MemoryDataExportRepository repo) : base(new RepositoryProvider(repo), new ToMemoryCheckNotifier()) { _uiTests = uiTests; Results = new TestActivateItemsResults(); RefreshBus = new RefreshBus(); //don't load the comment store for every single test if (_commentStore == null) { _commentStore = new CommentStore(); _commentStore.ReadComments(TestContext.CurrentContext.TestDirectory); } CommentStore = _commentStore; CoreChildProvider = new DataExportChildProvider(RepositoryLocator, null, Results); CoreIconProvider = new DataExportIconProvider(RepositoryLocator, null); FavouritesProvider = new FavouritesProvider(this, repo.CatalogueRepository); _problemProviders = new List <IProblemProvider>(new IProblemProvider[] { new CatalogueProblemProvider(), new DataExportProblemProvider() }); PluginUserInterfaces = new List <IPluginUserInterface>(); }
public BasicActivateItems(IRDMPPlatformRepositoryServiceLocator repositoryLocator, ICheckNotifier globalErrorCheckNotifier) { RepositoryLocator = repositoryLocator; GlobalErrorCheckNotifier = globalErrorCheckNotifier; ServerDefaults = RepositoryLocator.CatalogueRepository.GetServerDefaults(); //Shouldn't ever change externally to your session so doesn't need constantly refreshed FavouritesProvider = new FavouritesProvider(this); // This has to happen before we create the child providers ConstructPluginChildProviders(); // Note that this is virtual so can return null e.g. if other stuff has to happen with the activator before a valid child provider can be built (e.g. loading plugin user interfaces) CoreChildProvider = GetChildProvider(); //handle custom icons from plugin user interfaces in which CoreIconProvider = new DataExportIconProvider(repositoryLocator, PluginUserInterfaces.ToArray()); }
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); } }