From bd6ca5652ceb62cfc360ebd0b1fbb02f180f44cb Mon Sep 17 00:00:00 2001 From: James Friel Date: Tue, 22 Oct 2024 09:55:46 +0100 Subject: [PATCH] fix build --- Rdmp.UI/Collections/DatasetsCollectionUI.cs | 129 -------------------- 1 file changed, 129 deletions(-) delete mode 100644 Rdmp.UI/Collections/DatasetsCollectionUI.cs diff --git a/Rdmp.UI/Collections/DatasetsCollectionUI.cs b/Rdmp.UI/Collections/DatasetsCollectionUI.cs deleted file mode 100644 index 5e5d8aaccf..0000000000 --- a/Rdmp.UI/Collections/DatasetsCollectionUI.cs +++ /dev/null @@ -1,129 +0,0 @@ -using Rdmp.Core.CommandExecution.AtomicCommands; -using Rdmp.Core; -using Rdmp.Core.MapsDirectlyToDatabaseTable; -using Rdmp.UI.CommandExecution.AtomicCommands; -using Rdmp.UI.ItemActivation; -using Rdmp.UI.Refreshing; -using System; -using System.Collections.Generic; -using System.Linq; -using Rdmp.Core.Curation.Data; -using Rdmp.Core.Icons.IconProvision; -using System.Windows.Forms; - -namespace Rdmp.UI.Collections; - -public partial class DatasetsCollectionUI : RDMPCollectionUI, ILifetimeSubscriber -{ - - private Dataset[] _datasets; - private bool _firstTime = true; - - public DatasetsCollectionUI() - { - InitializeComponent(); - } - - public override void SetItemActivator(IActivateItems activator) - { - base.SetItemActivator(activator); - - CommonTreeFunctionality.SetUp(RDMPCollection.Datasets, tlvDatasets, Activator, olvName, olvName, - new RDMPCollectionCommonFunctionalitySettings(),tbFilter); - CommonTreeFunctionality.WhitespaceRightClickMenuCommandsGetter = - a => new IAtomicCommand[] - { - new ExecuteCommandCreateNewDatasetUI(Activator) - { OverrideCommandName = "Add New Dataset", Weight = -50.9f } - }; - Activator.RefreshBus.EstablishLifetimeSubscription(this); - tlvDatasets.AddObject(activator.CoreChildProvider.DatasetRootFolder); - - RefreshDatasets(Activator.CoreChildProvider.DatasetRootFolder); - - if (_firstTime) - { - CommonTreeFunctionality.SetupColumnTracking(olvName, new Guid("f8b0481e-378c-4996-9400-cb039c2efc5c")); - _firstTime = false; - var _refresh = new ToolStripMenuItem - { - Visible = true, - Image = FamFamFamIcons.arrow_refresh.ImageToBitmap(), - Alignment = ToolStripItemAlignment.Right, - ToolTipText = "Refresh Object" - }; - _refresh.Click += delegate (object sender, EventArgs e) { - var dataset = Activator.CoreChildProvider.AllDatasets.First(); - if (dataset is not null) - { - var cmd = new ExecuteCommandRefreshObject(Activator, dataset); - cmd.Execute(); - } - }; - CommonFunctionality.Add(_refresh); - } - } - - - - public void RefreshBus_RefreshObject(object sender, RefreshObjectEventArgs e) - { - RefreshDatasets(Activator.CoreChildProvider.DatasetRootFolder); - } - - private void RefreshDatasets(object oRefreshFrom) - { - var rootFolder = Activator.CoreChildProvider.DatasetRootFolder; - if (_datasets != null) - { - var newCatalogues = CommonTreeFunctionality.CoreChildProvider.AllDatasets.Except(_datasets); - if (newCatalogues.Any()) - { - oRefreshFrom = rootFolder; //refresh from the root instead - tlvDatasets.RefreshObject(oRefreshFrom); - } - } - _datasets = CommonTreeFunctionality.CoreChildProvider.AllDatasets; - if (_firstTime || Equals(oRefreshFrom, rootFolder)) - { - tlvDatasets.RefreshObject(rootFolder); - tlvDatasets.Expand(rootFolder); - _firstTime = false; - } - - } - - - /// - /// Returns all root objects in RDMP that match the . Handles unpicking tree collisions e.g. where matches 2 objects with one being the child of the other - /// - /// - /// - /// - public static List FindRootObjects(IActivateItems activator, - Func condition) - { - var datasets = - activator.RepositoryLocator.CatalogueRepository.GetAllObjects(); - - var actualRootFavourites = new List(); - - foreach (var currentFavourite in datasets) - actualRootFavourites.Add(currentFavourite); - - return actualRootFavourites; - } - - - /// - /// Return true if the object should be displayed in this pane - /// - /// - /// - protected virtual bool IncludeObject(IMapsDirectlyToDatabaseTable key) => - Activator.RepositoryLocator.CatalogueRepository.GetAllObjects().Contains(key); - - public static bool IsRootObject(IActivateItems activator, object root) => - //never favourite - false; -} \ No newline at end of file