From 2e08dbff8f091f4f10cb24eacfcf462057a96826 Mon Sep 17 00:00:00 2001 From: Roy Mudie <5470814+RoyMudie@users.noreply.github.com> Date: Fri, 29 Apr 2022 16:11:09 +0100 Subject: [PATCH 1/6] first draft at creating specific columns widths --- .../DataExportCollectionUI.Designer.cs | 23 ++++++++------- Rdmp.UI/Collections/DataExportCollectionUI.cs | 11 +++++-- .../Providers/CheckColumnProvider.cs | 5 ++++ .../Providers/FavouriteColumnProvider.cs | 6 ++-- .../Collections/Providers/IDColumnProvider.cs | 6 ++++ .../RDMPCollectionCommonFunctionality.cs | 29 +++++++++++++------ .../SimpleDialogs/UserSettingsUI.Designer.cs | 14 +++++++++ Rdmp.UI/SimpleDialogs/UserSettingsUI.cs | 4 +++ ...tIdentificationConfigurationUI.Designer.cs | 27 +++++++++-------- .../CohortIdentificationConfigurationUI.cs | 27 ++++++++++------- .../CohortIdentificationConfigurationUI.resx | 2 +- .../Settings/UserSettings.cs | 23 +++++++++++---- Reusable/ReusableLibraryCode/UsefulStuff.cs | 2 ++ 13 files changed, 124 insertions(+), 55 deletions(-) diff --git a/Rdmp.UI/Collections/DataExportCollectionUI.Designer.cs b/Rdmp.UI/Collections/DataExportCollectionUI.Designer.cs index 398923a821..1226f579d0 100644 --- a/Rdmp.UI/Collections/DataExportCollectionUI.Designer.cs +++ b/Rdmp.UI/Collections/DataExportCollectionUI.Designer.cs @@ -32,10 +32,10 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.tlvDataExport = new BrightIdeasSoftware.TreeListView(); - this.olvName = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this.olvProjectNumber = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this.olvCohortSource = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this.olvCohortVersion = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); + this.olvName = new BrightIdeasSoftware.OLVColumn(); + this.olvProjectNumber = new BrightIdeasSoftware.OLVColumn(); + this.olvCohortSource = new BrightIdeasSoftware.OLVColumn(); + this.olvCohortVersion = new BrightIdeasSoftware.OLVColumn(); ((System.ComponentModel.ISupportInitialize)(this.tlvDataExport)).BeginInit(); this.SuspendLayout(); // @@ -53,11 +53,11 @@ private void InitializeComponent() this.tlvDataExport.Cursor = System.Windows.Forms.Cursors.Default; this.tlvDataExport.Dock = System.Windows.Forms.DockStyle.Fill; this.tlvDataExport.FullRowSelect = true; - this.tlvDataExport.HideSelection = false; this.tlvDataExport.Location = new System.Drawing.Point(0, 0); + this.tlvDataExport.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.tlvDataExport.Name = "tlvDataExport"; this.tlvDataExport.ShowGroups = false; - this.tlvDataExport.Size = new System.Drawing.Size(385, 694); + this.tlvDataExport.Size = new System.Drawing.Size(449, 801); this.tlvDataExport.TabIndex = 0; this.tlvDataExport.UseCompatibleStateImageBehavior = false; this.tlvDataExport.View = System.Windows.Forms.View.Details; @@ -67,12 +67,14 @@ private void InitializeComponent() // this.olvName.AspectName = "ToString"; this.olvName.CellEditUseWholeCell = true; - this.olvName.Text = "Projects"; this.olvName.MinimumWidth = 100; + this.olvName.Text = "Projects"; + this.olvName.Width = 100; // // olvProjectNumber // - this.olvProjectNumber.Text = "ProjectNumber"; + this.olvProjectNumber.Text = "Project Number"; + this.olvProjectNumber.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; this.olvProjectNumber.Width = 89; // // olvCohortSource @@ -86,11 +88,12 @@ private void InitializeComponent() // // DataExportCollectionUI // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.tlvDataExport); + this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.Name = "DataExportCollectionUI"; - this.Size = new System.Drawing.Size(385, 694); + this.Size = new System.Drawing.Size(449, 801); ((System.ComponentModel.ISupportInitialize)(this.tlvDataExport)).EndInit(); this.ResumeLayout(false); diff --git a/Rdmp.UI/Collections/DataExportCollectionUI.cs b/Rdmp.UI/Collections/DataExportCollectionUI.cs index 1f335e9de5..79ac642e5b 100644 --- a/Rdmp.UI/Collections/DataExportCollectionUI.cs +++ b/Rdmp.UI/Collections/DataExportCollectionUI.cs @@ -125,10 +125,15 @@ public override void SetItemActivator(IActivateItems activator) if (_isFirstTime) { CommonTreeFunctionality.SetupColumnTracking(olvName, new Guid("00a384ce-08fa-43fd-9cf3-7ddbbf5cec1c")); - CommonTreeFunctionality.SetupColumnTracking(olvProjectNumber, new Guid("2a1764d4-8871-4488-b068-8940b777f90e")); - CommonTreeFunctionality.SetupColumnTracking(olvCohortSource, new Guid("c4dabcc3-ccc9-4c9b-906b-e8106e8b616c")); - CommonTreeFunctionality.SetupColumnTracking(olvCohortVersion, new Guid("2d0f8d32-090d-4d2b-8cfe-b6d16f5cc419")); + CommonTreeFunctionality.SetupColumnTracking(olvProjectNumber, new Guid("2a1764d4-8871-4488-b068-8940b777f90e"), 116); + CommonTreeFunctionality.SetupColumnTracking(olvCohortSource, new Guid("c4dabcc3-ccc9-4c9b-906b-e8106e8b616c"), 102); + CommonTreeFunctionality.SetupColumnTracking(olvCohortVersion, new Guid("2d0f8d32-090d-4d2b-8cfe-b6d16f5cc419"), 69); _isFirstTime = false; + + //Set default column widths + olvProjectNumber.MinimumWidth = 33; + olvCohortSource.MinimumWidth = 33; + olvCohortVersion.MinimumWidth = 33; } SetupToolStrip(); diff --git a/Rdmp.UI/Collections/Providers/CheckColumnProvider.cs b/Rdmp.UI/Collections/Providers/CheckColumnProvider.cs index 323c6c6b9b..ebf65c3755 100644 --- a/Rdmp.UI/Collections/Providers/CheckColumnProvider.cs +++ b/Rdmp.UI/Collections/Providers/CheckColumnProvider.cs @@ -26,6 +26,9 @@ public class CheckColumnProvider public const string ChecksColumnName = "Checks"; + public int DefaultColumnWidth = 68; + public bool IsFixedWidth = false; + public CheckColumnProvider(TreeListView tree, ICoreIconProvider iconProvider) { _tree = tree; @@ -38,6 +41,8 @@ public OLVColumn CreateColumn() toReturn.Text = ChecksColumnName; toReturn.ImageGetter = CheckImageGetter; toReturn.IsEditable = false; + toReturn.TextAlign = HorizontalAlignment.Center; + toReturn.MinimumWidth = 33; return toReturn; } diff --git a/Rdmp.UI/Collections/Providers/FavouriteColumnProvider.cs b/Rdmp.UI/Collections/Providers/FavouriteColumnProvider.cs index f9a3086037..bbb5331010 100644 --- a/Rdmp.UI/Collections/Providers/FavouriteColumnProvider.cs +++ b/Rdmp.UI/Collections/Providers/FavouriteColumnProvider.cs @@ -27,7 +27,8 @@ public class FavouriteColumnProvider private Bitmap _starFull; private Bitmap _starHollow; - + public int DefaultColumnWidth = 21; + public bool IsFixedWidth = true; public FavouriteColumnProvider(IActivateItems activator,TreeListView tlv) { @@ -41,7 +42,8 @@ public FavouriteColumnProvider(IActivateItems activator,TreeListView tlv) public OLVColumn CreateColumn() { _olvFavourite = new OLVColumn("Favourite", null); - _olvFavourite.Text = "Favourite"; + _olvFavourite.Text = "Favourites"; + _olvFavourite.ShowTextInHeader = false; _olvFavourite.ImageGetter += FavouriteImageGetter; _olvFavourite.IsEditable = false; _olvFavourite.Sortable = true; diff --git a/Rdmp.UI/Collections/Providers/IDColumnProvider.cs b/Rdmp.UI/Collections/Providers/IDColumnProvider.cs index 3b7f888acc..11fbf80f62 100644 --- a/Rdmp.UI/Collections/Providers/IDColumnProvider.cs +++ b/Rdmp.UI/Collections/Providers/IDColumnProvider.cs @@ -7,6 +7,7 @@ using BrightIdeasSoftware; using MapsDirectlyToDatabaseTable; using Rdmp.Core.Curation.Data; +using System.Windows.Forms; namespace Rdmp.UI.Collections.Providers { @@ -18,6 +19,9 @@ public class IDColumnProvider { private readonly TreeListView _tree; + public int DefaultColumnWidth = 40; + public bool IsFixedWidth = false; + public IDColumnProvider(TreeListView tree) { _tree = tree; @@ -46,6 +50,8 @@ public OLVColumn CreateColumn() toReturn.IsVisible = false; toReturn.AspectGetter += IDColumnAspectGetter; toReturn.IsEditable = false; + toReturn.TextAlign = HorizontalAlignment.Right; + toReturn.MinimumWidth = 40; return toReturn; } } diff --git a/Rdmp.UI/Collections/RDMPCollectionCommonFunctionality.cs b/Rdmp.UI/Collections/RDMPCollectionCommonFunctionality.cs index 6fa37178e3..685aaeea5d 100644 --- a/Rdmp.UI/Collections/RDMPCollectionCommonFunctionality.cs +++ b/Rdmp.UI/Collections/RDMPCollectionCommonFunctionality.cs @@ -106,20 +106,31 @@ public partial class RDMPCollectionCommonFunctionality : IRefreshBusSubscriber /// /// /// - public void SetupColumnTracking(OLVColumn col, Guid g) + /// + /// + public void SetupColumnTracking(OLVColumn col, Guid g, int? defaultWidth = null, bool isFixedWidth = false) { - SetupColumnTracking(Tree, col, g); + SetupColumnTracking(Tree, col, g, defaultWidth, isFixedWidth); } public void SetupColumnTracking(OLVColumn col, string columnUniqueIdentifier) { SetupColumnTracking(Tree, col, columnUniqueIdentifier); } - /// - public static void SetupColumnTracking(ObjectListView view, OLVColumn col, Guid g) + /// + public static void SetupColumnTracking(ObjectListView view, OLVColumn col, Guid g, int? defaultWidth = null, bool isFixedWidth = false) { - col.Width = UserSettings.GetColumnWidth(g); - view.ColumnWidthChanged += (s, e) => UserSettings.SetColumnWidth(g, col.Width); + if (isFixedWidth) + { + col.Width = defaultWidth.Value; + col.MinimumWidth = defaultWidth.Value; + col.MaximumWidth = defaultWidth.Value; + } + else + { + col.Width = UserSettings.GetColumnWidth(g, defaultWidth); + view.ColumnWidthChanged += (s, e) => UserSettings.SetColumnWidth(g, col.Width); + } col.IsVisible = UserSettings.GetColumnVisible(g); col.VisibilityChanged += (s, e) => UserSettings.SetColumnVisible(g, ((OLVColumn)s).IsVisible); @@ -245,7 +256,7 @@ public void SetUp(RDMPCollection collection, TreeListView tree, IActivateItems a FavouriteColumnProvider = new FavouriteColumnProvider(_activator, tree); FavouriteColumn = FavouriteColumnProvider.CreateColumn(); - SetupColumnTracking(FavouriteColumn, new Guid("ab25aa56-957c-4d1b-b395-48299be8e467")); + SetupColumnTracking(FavouriteColumn, new Guid("ab25aa56-957c-4d1b-b395-48299be8e467"), FavouriteColumnProvider.DefaultColumnWidth, FavouriteColumnProvider.IsFixedWidth); } if (settings.AddIDColumn) @@ -254,7 +265,7 @@ public void SetUp(RDMPCollection collection, TreeListView tree, IActivateItems a IDColumn = IDColumnProvider.CreateColumn(); Tree.AllColumns.Add(IDColumn); - SetupColumnTracking(IDColumn, new Guid("9d567d9c-06f5-41b6-9f0d-e630a0e23f3a")); + SetupColumnTracking(IDColumn, new Guid("9d567d9c-06f5-41b6-9f0d-e630a0e23f3a"), IDColumnProvider.DefaultColumnWidth, IDColumnProvider.IsFixedWidth); Tree.RebuildColumns(); } @@ -263,7 +274,7 @@ public void SetUp(RDMPCollection collection, TreeListView tree, IActivateItems a CheckColumnProvider = new CheckColumnProvider(tree, _activator.CoreIconProvider); CheckColumn = CheckColumnProvider.CreateColumn(); - SetupColumnTracking(CheckColumn, new Guid("8d9c6a0f-82a8-4f4e-b058-e3017d8d60e0")); + SetupColumnTracking(CheckColumn, new Guid("8d9c6a0f-82a8-4f4e-b058-e3017d8d60e0"), CheckColumnProvider.DefaultColumnWidth, CheckColumnProvider.IsFixedWidth); Tree.AllColumns.Add(CheckColumn); Tree.RebuildColumns(); diff --git a/Rdmp.UI/SimpleDialogs/UserSettingsUI.Designer.cs b/Rdmp.UI/SimpleDialogs/UserSettingsUI.Designer.cs index de6e4b2a94..f21dcf6e18 100644 --- a/Rdmp.UI/SimpleDialogs/UserSettingsUI.Designer.cs +++ b/Rdmp.UI/SimpleDialogs/UserSettingsUI.Designer.cs @@ -80,6 +80,7 @@ private void InitializeComponent() this.cbSelectiveRefresh = new System.Windows.Forms.CheckBox(); this.cbAlwaysJoinEverything = new System.Windows.Forms.CheckBox(); this.userSettingsToolTips = new System.Windows.Forms.ToolTip(this.components); + this.btnClearSettings = new System.Windows.Forms.Button(); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.olvErrorCodes)).BeginInit(); this.groupBox2.SuspendLayout(); @@ -644,11 +645,23 @@ private void InitializeComponent() this.userSettingsToolTips.IsBalloon = true; this.userSettingsToolTips.ReshowDelay = 50; // + // btnClearSettings + // + this.btnClearSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnClearSettings.Location = new System.Drawing.Point(877, 9); + this.btnClearSettings.Name = "btnClearSettings"; + this.btnClearSettings.Size = new System.Drawing.Size(123, 23); + this.btnClearSettings.TabIndex = 25; + this.btnClearSettings.Text = "Clear User Settings"; + this.btnClearSettings.UseVisualStyleBackColor = true; + this.btnClearSettings.Click += new System.EventHandler(this.btnClearSettings_Click); + // // UserSettingsFileUI // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1012, 758); + this.Controls.Add(this.btnClearSettings); this.Controls.Add(this.flowLayoutPanel1); this.Controls.Add(this.ddTheme); this.Controls.Add(this.cbThemeMenus); @@ -733,5 +746,6 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox cbAlwaysJoinEverything; private System.Windows.Forms.GroupBox groupBox8; private System.Windows.Forms.CheckBox cbStrictValidationForCohortBuilderContainers; + private System.Windows.Forms.Button btnClearSettings; } } \ No newline at end of file diff --git a/Rdmp.UI/SimpleDialogs/UserSettingsUI.cs b/Rdmp.UI/SimpleDialogs/UserSettingsUI.cs index 996dde53c6..20d0ac3b9a 100644 --- a/Rdmp.UI/SimpleDialogs/UserSettingsUI.cs +++ b/Rdmp.UI/SimpleDialogs/UserSettingsUI.cs @@ -285,5 +285,9 @@ private void tbTooltipAppearDelay_TextChanged(object sender, EventArgs e) } } + private void btnClearSettings_Click(object sender, EventArgs e) + { + UserSettings.ClearAppSettings(); + } } } diff --git a/Rdmp.UI/SubComponents/CohortIdentificationConfigurationUI.Designer.cs b/Rdmp.UI/SubComponents/CohortIdentificationConfigurationUI.Designer.cs index 356a59b782..bdbff2a05c 100644 --- a/Rdmp.UI/SubComponents/CohortIdentificationConfigurationUI.Designer.cs +++ b/Rdmp.UI/SubComponents/CohortIdentificationConfigurationUI.Designer.cs @@ -55,8 +55,8 @@ private void InitializeComponent() this.tbDescription = new System.Windows.Forms.TextBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.panel1 = new System.Windows.Forms.Panel(); - this.lblExecuteAllPhase = new System.Windows.Forms.Label(); this.btnClearCache = new System.Windows.Forms.Button(); + this.lblExecuteAllPhase = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.tlvCic)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit(); this.splitContainer2.Panel1.SuspendLayout(); @@ -90,7 +90,6 @@ private void InitializeComponent() this.olvCatalogue}); this.tlvCic.Cursor = System.Windows.Forms.Cursors.Default; this.tlvCic.Dock = System.Windows.Forms.DockStyle.Fill; - this.tlvCic.HideSelection = false; this.tlvCic.Location = new System.Drawing.Point(0, 0); this.tlvCic.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.tlvCic.Name = "tlvCic"; @@ -142,7 +141,7 @@ private void InitializeComponent() // this.olvWorking.IsEditable = false; this.olvWorking.Sortable = false; - this.olvWorking.Text = "Working"; + this.olvWorking.Text = "Status"; // // olvTime // @@ -271,6 +270,17 @@ private void InitializeComponent() this.panel1.Size = new System.Drawing.Size(247, 36); this.panel1.TabIndex = 70; // + // btnClearCache + // + this.btnClearCache.Image = ((System.Drawing.Image)(resources.GetObject("btnClearCache.Image"))); + this.btnClearCache.Location = new System.Drawing.Point(212, 0); + this.btnClearCache.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.btnClearCache.Name = "btnClearCache"; + this.btnClearCache.Size = new System.Drawing.Size(34, 36); + this.btnClearCache.TabIndex = 67; + this.btnClearCache.UseVisualStyleBackColor = true; + this.btnClearCache.Click += new System.EventHandler(this.btnClearCache_Click); + // // lblExecuteAllPhase // this.lblExecuteAllPhase.Enabled = false; @@ -283,17 +293,6 @@ private void InitializeComponent() this.lblExecuteAllPhase.Text = "Execution status..."; this.lblExecuteAllPhase.TextAlign = System.Drawing.ContentAlignment.TopCenter; // - // btnClearCache - // - this.btnClearCache.Image = ((System.Drawing.Image)(resources.GetObject("btnClearCache.Image"))); - this.btnClearCache.Location = new System.Drawing.Point(212, 0); - this.btnClearCache.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.btnClearCache.Name = "btnClearCache"; - this.btnClearCache.Size = new System.Drawing.Size(34, 36); - this.btnClearCache.TabIndex = 67; - this.btnClearCache.UseVisualStyleBackColor = true; - this.btnClearCache.Click += new System.EventHandler(this.btnClearCache_Click); - // // CohortIdentificationConfigurationUI // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); diff --git a/Rdmp.UI/SubComponents/CohortIdentificationConfigurationUI.cs b/Rdmp.UI/SubComponents/CohortIdentificationConfigurationUI.cs index cf372dff22..75ee954f3d 100644 --- a/Rdmp.UI/SubComponents/CohortIdentificationConfigurationUI.cs +++ b/Rdmp.UI/SubComponents/CohortIdentificationConfigurationUI.cs @@ -95,11 +95,14 @@ public CohortIdentificationConfigurationUI() olvExecute.IsButton = true; olvExecute.ButtonSizing = OLVColumn.ButtonSizingMode.CellBounds; + olvExecute.ShowTextInHeader = false; tlvCic.RowHeight = 19; olvExecute.AspectGetter += ExecuteAspectGetter; tlvCic.ButtonClick += tlvCic_ButtonClick; olvOrder.AspectGetter += (o)=> o is JoinableCollectionNode ? null : o is ISqlParameter ? null : (o as IOrderable)?.Order; olvOrder.IsEditable = false; + olvOrder.TextAlign = HorizontalAlignment.Right; + olvOrder.IsVisible = false; tlvCic.ItemActivate += TlvCic_ItemActivate; AssociatedCollection = RDMPCollection.Cohort; @@ -109,10 +112,14 @@ public CohortIdentificationConfigurationUI() timer.Start(); olvCount.AspectGetter = Count_AspectGetter; + olvCount.TextAlign = HorizontalAlignment.Right; olvCached.AspectGetter = Cached_AspectGetter; + olvCached.TextAlign = HorizontalAlignment.Center; olvCumulativeTotal.AspectGetter = CumulativeTotal_AspectGetter; + olvCumulativeTotal.TextAlign = HorizontalAlignment.Right; olvTime.AspectGetter = Time_AspectGetter; olvWorking.AspectGetter = Working_AspectGetter; + olvWorking.TextAlign = HorizontalAlignment.Center; olvCatalogue.AspectGetter = Catalogue_AspectGetter; cbIncludeCumulative.CheckedChanged += (s, e) => @@ -126,15 +133,15 @@ public CohortIdentificationConfigurationUI() olvNameCol.Sortable = true; tlvCic.Sort(olvNameCol); - RDMPCollectionCommonFunctionality.SetupColumnTracking(tlvCic, olvCached, new Guid("59c6eda9-dcf3-4a24-801f-4c5467c76f94")); - RDMPCollectionCommonFunctionality.SetupColumnTracking(tlvCic, olvCatalogue, new Guid("59c6f9a6-4a93-4167-a268-9ea755d0ad94")); - RDMPCollectionCommonFunctionality.SetupColumnTracking(tlvCic, olvCount, new Guid("4ca6588f-2511-4082-addd-ec42e9d75b39")); - RDMPCollectionCommonFunctionality.SetupColumnTracking(tlvCic, olvCumulativeTotal, new Guid("a3e901e2-c6b8-4365-bea8-5666b9b74821")); - RDMPCollectionCommonFunctionality.SetupColumnTracking(tlvCic, olvExecute, new Guid("f8ad1751-b273-42d7-a6d1-0c580099ceee")); - RDMPCollectionCommonFunctionality.SetupColumnTracking(tlvCic, olvNameCol, new Guid("63db1af5-061c-42b9-873c-7d3d3ac21cd8")); - RDMPCollectionCommonFunctionality.SetupColumnTracking(tlvCic, olvOrder, new Guid("5be4e6e7-bad6-4bd5-821c-a235bc056053")); - RDMPCollectionCommonFunctionality.SetupColumnTracking(tlvCic, olvTime, new Guid("88f88d4a-6204-4f83-b9a7-5421186808b7")); - RDMPCollectionCommonFunctionality.SetupColumnTracking(tlvCic, olvWorking, new Guid("cfe55a4f-9e17-4205-9016-ae506667f22d")); + RDMPCollectionCommonFunctionality.SetupColumnTracking(tlvCic, olvCached, new Guid("59c6eda9-dcf3-4a24-801f-4c5467c76f94"), 60); + RDMPCollectionCommonFunctionality.SetupColumnTracking(tlvCic, olvCatalogue, new Guid("59c6f9a6-4a93-4167-a268-9ea755d0ad94"), 100); + RDMPCollectionCommonFunctionality.SetupColumnTracking(tlvCic, olvCount, new Guid("4ca6588f-2511-4082-addd-ec42e9d75b39"), 102); + RDMPCollectionCommonFunctionality.SetupColumnTracking(tlvCic, olvCumulativeTotal, new Guid("a3e901e2-c6b8-4365-bea8-5666b9b74821"), 102); + RDMPCollectionCommonFunctionality.SetupColumnTracking(tlvCic, olvExecute, new Guid("f8ad1751-b273-42d7-a6d1-0c580099ceee"), 62); + RDMPCollectionCommonFunctionality.SetupColumnTracking(tlvCic, olvNameCol, new Guid("63db1af5-061c-42b9-873c-7d3d3ac21cd8"), 300); + RDMPCollectionCommonFunctionality.SetupColumnTracking(tlvCic, olvOrder, new Guid("5be4e6e7-bad6-4bd5-821c-a235bc056053"), 44); + RDMPCollectionCommonFunctionality.SetupColumnTracking(tlvCic, olvTime, new Guid("88f88d4a-6204-4f83-b9a7-5421186808b7"), 52); + RDMPCollectionCommonFunctionality.SetupColumnTracking(tlvCic, olvWorking, new Guid("cfe55a4f-9e17-4205-9016-ae506667f22d"), 90); tt.SetToolTip(btnExecute, "Starts running and caches all cohort sets and containers"); tt.SetToolTip(btnAbortLoad, "Cancells execution of any running cohort sets"); @@ -142,7 +149,7 @@ public CohortIdentificationConfigurationUI() private object Working_AspectGetter(object rowobject) { - return GetKey(rowobject)?.State; + return UsefulStuff.PascalCaseStringToHumanReadable(GetKey(rowobject)?.State.ToString()); } private object Time_AspectGetter(object rowobject) diff --git a/Rdmp.UI/SubComponents/CohortIdentificationConfigurationUI.resx b/Rdmp.UI/SubComponents/CohortIdentificationConfigurationUI.resx index f8c7b52d45..11d3006344 100644 --- a/Rdmp.UI/SubComponents/CohortIdentificationConfigurationUI.resx +++ b/Rdmp.UI/SubComponents/CohortIdentificationConfigurationUI.resx @@ -76,7 +76,7 @@ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - vQAADr0BR/uQrQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMzQDW3oAAAEaSURBVDhPnY/t + vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMzQDW3oAAAEaSURBVDhPnY/t KoVBFEbf/+IupMQ1iIiU3yIppaSkEAk5KR8pKUmJkgiRlJKUFIlEkgtQiBK5huU5pzPTNGO8OrvWNLP3 flZNkmRKyKJKCsEKChUFAoO/GMP9Qq5cSb7/a9AQCEy5kvz8b8EX33zwybvOV53PvPHES6rICu545IYH rrnnklvO9TrjilO9TriIiqxgn2N2OWKbQzY5YF2dNfZYZYdltlhig0V1XUkOc5ljhVmtTmt1UqsTLDDO diff --git a/Reusable/ReusableLibraryCode/Settings/UserSettings.cs b/Reusable/ReusableLibraryCode/Settings/UserSettings.cs index faeebadfef..b46e70549e 100644 --- a/Reusable/ReusableLibraryCode/Settings/UserSettings.cs +++ b/Reusable/ReusableLibraryCode/Settings/UserSettings.cs @@ -412,16 +412,22 @@ public static void SetColumnVisible(string colIdentifier,bool visible) AppSettings.AddOrUpdateValue("ColV_" + colIdentifier, visible); } - public static int GetColumnWidth(Guid columnGuid) + public static int GetColumnWidth(Guid columnGuid, int? defaultColumnWidth = null) { - if (columnGuid == Guid.Empty) - return 100; + //If we have a GUID then return it + if (columnGuid != Guid.Empty) + return GetColumnWidth(columnGuid.ToString("N"), defaultColumnWidth); - return GetColumnWidth(columnGuid.ToString("N")); + //If the columnGuid is empty then check if we have a default width and return that + if (defaultColumnWidth != null) + return defaultColumnWidth.Value; + + //else return default value + return 150; } - public static int GetColumnWidth(string colIdentifier) + public static int GetColumnWidth(string colIdentifier, int? defaultColumnWidth = null) { - return AppSettings.GetValueOrDefault("ColW_" + colIdentifier, 100); + return AppSettings.GetValueOrDefault("ColW_" + colIdentifier, defaultColumnWidth ?? 150); } public static bool GetColumnVisible(Guid columnGuid) @@ -489,6 +495,11 @@ static ISettings CreateSettings() return new RDMPApplicationSettings(); } + public static void ClearAppSettings() + { + AppSettings.Clear(); + } + } } diff --git a/Reusable/ReusableLibraryCode/UsefulStuff.cs b/Reusable/ReusableLibraryCode/UsefulStuff.cs index 5336be7adb..704313b525 100644 --- a/Reusable/ReusableLibraryCode/UsefulStuff.cs +++ b/Reusable/ReusableLibraryCode/UsefulStuff.cs @@ -522,6 +522,8 @@ public static bool IsAssignableToGenericType(Type givenType, Type genericType) public static string PascalCaseStringToHumanReadable(string pascalCaseString) { + if (pascalCaseString == null) return null; + //Deal with legacy property names by replacing underscore with a space pascalCaseString = pascalCaseString.Replace("_", " "); From 4181d4f02bd57538e51b610d00e80cb86cd8b7e3 Mon Sep 17 00:00:00 2001 From: Roy Mudie <5470814+RoyMudie@users.noreply.github.com> Date: Mon, 2 May 2022 15:08:44 +0100 Subject: [PATCH 2/6] Updated progressui column widths and layout --- Rdmp.UI/Progress/ProgressUI.Designer.cs | 8 +++++--- Rdmp.UI/Progress/ProgressUI.cs | 19 +++++++++++++------ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Rdmp.UI/Progress/ProgressUI.Designer.cs b/Rdmp.UI/Progress/ProgressUI.Designer.cs index c6479f64f0..cb45b4543e 100644 --- a/Rdmp.UI/Progress/ProgressUI.Designer.cs +++ b/Rdmp.UI/Progress/ProgressUI.Designer.cs @@ -146,13 +146,12 @@ private void InitializeComponent() this.olvProgressEvents.AllColumns.Add(this.olvMessage); this.olvProgressEvents.CellEditUseWholeCell = false; this.olvProgressEvents.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.olvSender, this.olvEventDate, + this.olvSender, this.olvMessage}); this.olvProgressEvents.Cursor = System.Windows.Forms.Cursors.Default; this.olvProgressEvents.Dock = System.Windows.Forms.DockStyle.Fill; this.olvProgressEvents.FullRowSelect = true; - this.olvProgressEvents.HideSelection = false; this.olvProgressEvents.Location = new System.Drawing.Point(0, 15); this.olvProgressEvents.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.olvProgressEvents.Name = "olvProgressEvents"; @@ -173,8 +172,11 @@ private void InitializeComponent() // this.olvEventDate.AspectName = "EventDate"; this.olvEventDate.Groupable = false; + this.olvEventDate.MaximumWidth = 112; + this.olvEventDate.MinimumWidth = 112; this.olvEventDate.Text = "Event Date"; - this.olvEventDate.Width = 140; + this.olvEventDate.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.olvEventDate.Width = 112; // // olvMessage // diff --git a/Rdmp.UI/Progress/ProgressUI.cs b/Rdmp.UI/Progress/ProgressUI.cs index 937600ac56..279492b017 100644 --- a/Rdmp.UI/Progress/ProgressUI.cs +++ b/Rdmp.UI/Progress/ProgressUI.cs @@ -84,16 +84,13 @@ public ProgressUI() _fail = ChecksAndProgressIcons.Fail; _failEx = ChecksAndProgressIcons.FailEx; - olvSender.ImageGetter += ImageGetter; + olvMessage.ImageGetter += ImageGetter; olvProgressEvents.ItemActivate += olvProgressEvents_ItemActivate; olvProgressEvents.UseFiltering = true; + olvProgressEvents.Sorting = SortOrder.Descending; - ddGroupBy.Items.Add("None"); + ddGroupBy.Items.Add(olvEventDate.Text); ddGroupBy.Items.Add(olvSender.Text); - - RDMPCollectionCommonFunctionality.SetupColumnTracking(olvProgressEvents, olvSender, new Guid("2731d3cb-703c-4743-96d9-f16abff1dbbf")); - RDMPCollectionCommonFunctionality.SetupColumnTracking(olvProgressEvents, olvEventDate, new Guid("f3580392-e5b5-41d0-a1da-2751172d5517")); - RDMPCollectionCommonFunctionality.SetupColumnTracking(olvProgressEvents, olvMessage, new Guid("d698faf6-2ff1-4f71-96e2-9a889c2e3f13")); } public void ApplyTheme(ITheme theme) @@ -241,6 +238,11 @@ void ProcessAndClearQueuedProgressMessages(object sender, EventArgs e) } ProgressQueue.Remove(message.Key); + + olvSender.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); + olvMessage.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); + olvMessage.Width = olvMessage.Width + 15; //add room for icon + olvProgressEvents.Sort(); } } @@ -250,6 +252,11 @@ void ProcessAndClearQueuedProgressMessages(object sender, EventArgs e) { olvProgressEvents.AddObjects(NotificationQueue); NotificationQueue.Clear(); + + olvSender.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); + olvMessage.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); + olvMessage.Width = olvMessage.Width + 15; //add room for icon + olvProgressEvents.Sort(); } } } From a45cf1ca6fcef0125482de6a6b6180340192cb27 Mon Sep 17 00:00:00 2001 From: Roy Mudie <5470814+RoyMudie@users.noreply.github.com> Date: Mon, 2 May 2022 15:11:05 +0100 Subject: [PATCH 3/6] Updated search dialogue default column widths --- Rdmp.UI/SimpleDialogs/SelectDialog.Designer.cs | 7 +++++++ Rdmp.UI/SimpleDialogs/SelectDialog.cs | 18 ++++++++++++++---- .../Settings/UserSettings.cs | 4 ++-- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/Rdmp.UI/SimpleDialogs/SelectDialog.Designer.cs b/Rdmp.UI/SimpleDialogs/SelectDialog.Designer.cs index c4a1d57bea..30d88603b1 100644 --- a/Rdmp.UI/SimpleDialogs/SelectDialog.Designer.cs +++ b/Rdmp.UI/SimpleDialogs/SelectDialog.Designer.cs @@ -81,13 +81,20 @@ private void InitializeComponent() // // olvSelected // + this.olvSelected.MaximumWidth = 58; + this.olvSelected.MinimumWidth = 58; this.olvSelected.Text = "Selected"; this.olvSelected.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.olvSelected.Width = 58; // // olvID // this.olvID.AspectName = ""; + this.olvID.MaximumWidth = 90; + this.olvID.MinimumWidth = 30; this.olvID.Text = "ID"; + this.olvID.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.olvID.Width = 30; // // olvName // diff --git a/Rdmp.UI/SimpleDialogs/SelectDialog.cs b/Rdmp.UI/SimpleDialogs/SelectDialog.cs index 98f04dcde6..cde67cf9e7 100644 --- a/Rdmp.UI/SimpleDialogs/SelectDialog.cs +++ b/Rdmp.UI/SimpleDialogs/SelectDialog.cs @@ -233,9 +233,8 @@ public SelectDialog(DialogArgs args, IActivateItems activator, IEnumerable to MultiSelected = new HashSet(); - RDMPCollectionCommonFunctionality.SetupColumnTracking(olv, olvName, new Guid("298cda00-5ec8-423c-9230-71d78bec6bc4")); - RDMPCollectionCommonFunctionality.SetupColumnTracking(olv, olvID, new Guid("bb0fe2f0-1e73-4b00-a5b7-4b6ce3510bab")); - RDMPCollectionCommonFunctionality.SetupColumnTracking(olv, olvHierarchy, new Guid("9393c6f0-b2c5-4bf8-8675-3a0117a2c850")); + RDMPCollectionCommonFunctionality.SetupColumnTracking(olv, olvName, new Guid("298cda00-5ec8-423c-9230-71d78bec6bc4"), 300); + RDMPCollectionCommonFunctionality.SetupColumnTracking(olv, olvID, new Guid("fd3741b9-a20a-4782-afe4-4b0c5e648e9c"), 30); btnCancel.KeyPress += BtnKeypress; btnSelect.KeyPress += BtnKeypress; @@ -689,6 +688,18 @@ private void tbFilter_TextChanged(object sender, EventArgs e) // updates the list _matches = _tempMatches; StateChanged(); + + if (_matches.Count > 0) + { + olvHierarchy.MaximumWidth = -1; + olvHierarchy.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); + olvHierarchy.Width = olvHierarchy.Width + 15; + olvHierarchy.MaximumWidth = olvHierarchy.Width; + } + else + { + olvHierarchy.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize); + } } } @@ -698,7 +709,6 @@ private void tbFilter_TextChanged(object sender, EventArgs e) } }, TaskScheduler.FromCurrentSynchronizationContext()); - } public void AddObjects(ICollection modelObjects) diff --git a/Reusable/ReusableLibraryCode/Settings/UserSettings.cs b/Reusable/ReusableLibraryCode/Settings/UserSettings.cs index b46e70549e..8f2aeb1a26 100644 --- a/Reusable/ReusableLibraryCode/Settings/UserSettings.cs +++ b/Reusable/ReusableLibraryCode/Settings/UserSettings.cs @@ -313,12 +313,12 @@ public static int ArchiveTriggerTimeout public static int FindWindowWidth { - get { return AppSettings.GetValueOrDefault("FindWindowWidth", 300); } + get { return AppSettings.GetValueOrDefault("FindWindowWidth", 730); } set { AppSettings.AddOrUpdateValue("FindWindowWidth", value); } } public static int FindWindowHeight { - get { return AppSettings.GetValueOrDefault("FindWindowHeight", 500); } + get { return AppSettings.GetValueOrDefault("FindWindowHeight", 460); } set { AppSettings.AddOrUpdateValue("FindWindowHeight", value); } } From ab6e88c5c4acc7d9dfbd93b24b6628b10ac415dd Mon Sep 17 00:00:00 2001 From: Roy Mudie <5470814+RoyMudie@users.noreply.github.com> Date: Mon, 2 May 2022 15:33:59 +0100 Subject: [PATCH 4/6] Updated columns widths for checksui, data release and extractions --- Rdmp.UI/ChecksUI/ChecksUI.Designer.cs | 3 +-- Rdmp.UI/ChecksUI/ChecksUI.cs | 9 ++++++--- Rdmp.UI/DataRelease/DataReleaseUI.cs | 4 ++-- Rdmp.UI/ProjectUI/ExecuteExtractionUI.Designer.cs | 7 +++---- Rdmp.UI/ProjectUI/ExecuteExtractionUI.cs | 4 ++-- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Rdmp.UI/ChecksUI/ChecksUI.Designer.cs b/Rdmp.UI/ChecksUI/ChecksUI.Designer.cs index 13856ae85b..7de083746c 100644 --- a/Rdmp.UI/ChecksUI/ChecksUI.Designer.cs +++ b/Rdmp.UI/ChecksUI/ChecksUI.Designer.cs @@ -83,13 +83,12 @@ private void InitializeComponent() this.olvChecks.AllColumns.Add(this.olvMessage); this.olvChecks.CellEditUseWholeCell = false; this.olvChecks.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.olvResult, this.olvEventDate, + this.olvResult, this.olvMessage}); this.olvChecks.Cursor = System.Windows.Forms.Cursors.Default; this.olvChecks.Dock = System.Windows.Forms.DockStyle.Fill; this.olvChecks.FullRowSelect = true; - this.olvChecks.HideSelection = false; this.olvChecks.Location = new System.Drawing.Point(0, 0); this.olvChecks.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.olvChecks.Name = "olvChecks"; diff --git a/Rdmp.UI/ChecksUI/ChecksUI.cs b/Rdmp.UI/ChecksUI/ChecksUI.cs index bca044e1b8..9eec6feaab 100644 --- a/Rdmp.UI/ChecksUI/ChecksUI.cs +++ b/Rdmp.UI/ChecksUI/ChecksUI.cs @@ -68,9 +68,8 @@ public ChecksUI() _timer.Tick += _timer_Tick; _timer.Start(); - RDMPCollectionCommonFunctionality.SetupColumnTracking(olvChecks, olvMessage, new Guid("5d62580d-2bee-420b-ab43-f40317769514")); - RDMPCollectionCommonFunctionality.SetupColumnTracking(olvChecks, olvResult, new Guid("18b26ae1-c35d-4e73-9dc5-88f15910c1f9")); - RDMPCollectionCommonFunctionality.SetupColumnTracking(olvChecks, olvEventDate, new Guid("28c13822-b4c0-4fa5-b20d-af612b076716")); + RDMPCollectionCommonFunctionality.SetupColumnTracking(olvChecks, olvResult, new Guid("18b26ae1-c35d-4e73-9dc5-88f15910c1f9"), 75, true); + RDMPCollectionCommonFunctionality.SetupColumnTracking(olvChecks, olvEventDate, new Guid("28c13822-b4c0-4fa5-b20d-af612b076716"), 115, true); } private void _timer_Tick(object sender, EventArgs e) @@ -88,6 +87,10 @@ private void _timer_Tick(object sender, EventArgs e) olvChecks.AddObjects(_results); outOfDate = false; } + + olvMessage.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); + olvMessage.MinimumWidth = olvMessage.Width; + olvMessage.MinimumWidth = olvMessage.Width; } private object ImageGetter(object rowObject) diff --git a/Rdmp.UI/DataRelease/DataReleaseUI.cs b/Rdmp.UI/DataRelease/DataReleaseUI.cs index ad33716b67..544f20265d 100644 --- a/Rdmp.UI/DataRelease/DataReleaseUI.cs +++ b/Rdmp.UI/DataRelease/DataReleaseUI.cs @@ -195,8 +195,8 @@ public override void SetDatabaseObject(IActivateItems activator, Project databas AddCheckColumn = false }); - _commonFunctionality.SetupColumnTracking(olvName, new Guid("2d09c1d2-b4a7-400f-9003-d23e43cd3d75")); - _commonFunctionality.SetupColumnTracking(olvReleaseability, new Guid("2f0ca398-a0d5-4e13-bb40-a2c817d4179a")); + _commonFunctionality.SetupColumnTracking(olvName, new Guid("2d09c1d2-b4a7-400f-9003-d23e43cd3d75"), 250); + _commonFunctionality.SetupColumnTracking(olvReleaseability, new Guid("2f0ca398-a0d5-4e13-bb40-a2c817d4179a"), 200); } _childProvider = (DataExportChildProvider)Activator.CoreChildProvider; diff --git a/Rdmp.UI/ProjectUI/ExecuteExtractionUI.Designer.cs b/Rdmp.UI/ProjectUI/ExecuteExtractionUI.Designer.cs index 105e342eec..912533cce1 100644 --- a/Rdmp.UI/ProjectUI/ExecuteExtractionUI.Designer.cs +++ b/Rdmp.UI/ProjectUI/ExecuteExtractionUI.Designer.cs @@ -119,7 +119,6 @@ private void InitializeComponent() this.olvName, this.olvState}); this.tlvDatasets.Cursor = System.Windows.Forms.Cursors.Default; - this.tlvDatasets.HideSelection = false; this.tlvDatasets.Location = new System.Drawing.Point(-2, -2); this.tlvDatasets.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.tlvDatasets.Name = "tlvDatasets"; @@ -145,7 +144,7 @@ private void InitializeComponent() // olvState // this.olvState.Groupable = false; - this.olvState.Text = "Extraction State"; + this.olvState.Text = "Status"; this.olvState.Width = 160; // // helpIcon1 @@ -154,7 +153,7 @@ private void InitializeComponent() this.helpIcon1.BackColor = System.Drawing.Color.Transparent; this.helpIcon1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("helpIcon1.BackgroundImage"))); this.helpIcon1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; - this.helpIcon1.Location = new System.Drawing.Point(781, 9); + this.helpIcon1.Location = new System.Drawing.Point(780, 9); this.helpIcon1.Margin = new System.Windows.Forms.Padding(5, 3, 5, 3); this.helpIcon1.MaximumSize = new System.Drawing.Size(26, 25); this.helpIcon1.MinimumSize = new System.Drawing.Size(26, 25); @@ -172,7 +171,7 @@ private void InitializeComponent() this.checkAndExecuteUI1.Location = new System.Drawing.Point(5, 0); this.checkAndExecuteUI1.Margin = new System.Windows.Forms.Padding(5, 3, 5, 3); this.checkAndExecuteUI1.Name = "checkAndExecuteUI1"; - this.checkAndExecuteUI1.Size = new System.Drawing.Size(803, 745); + this.checkAndExecuteUI1.Size = new System.Drawing.Size(802, 745); this.checkAndExecuteUI1.TabIndex = 28; // // ExecuteExtractionUI diff --git a/Rdmp.UI/ProjectUI/ExecuteExtractionUI.cs b/Rdmp.UI/ProjectUI/ExecuteExtractionUI.cs index 077439d40b..a2c74a3ea3 100644 --- a/Rdmp.UI/ProjectUI/ExecuteExtractionUI.cs +++ b/Rdmp.UI/ProjectUI/ExecuteExtractionUI.cs @@ -99,8 +99,8 @@ public ExecuteExtractionUI() new ExecuteCommandAddPackageToConfiguration(Activator,_extractionConfiguration), }; - RDMPCollectionCommonFunctionality.SetupColumnTracking(tlvDatasets, olvName, new Guid("57c60bc1-9935-49b2-bb32-58e4c20ad666")); - RDMPCollectionCommonFunctionality.SetupColumnTracking(tlvDatasets, olvState, new Guid("22642c7d-342b-4a6c-b2c4-7ca581877cb2")); + RDMPCollectionCommonFunctionality.SetupColumnTracking(tlvDatasets, olvName, new Guid("57c60bc1-9935-49b2-bb32-58e4c20ad666"), 250); + RDMPCollectionCommonFunctionality.SetupColumnTracking(tlvDatasets, olvState, new Guid("22642c7d-342b-4a6c-b2c4-7ca581877cb2"), 95, true); } private void TlvDatasets_ItemActivate(object sender, EventArgs e) From bfcd81df7bdf5c865066cef103e6b6d1a76f49e4 Mon Sep 17 00:00:00 2001 From: Roy Mudie <5470814+RoyMudie@users.noreply.github.com> Date: Mon, 2 May 2022 17:21:41 +0100 Subject: [PATCH 5/6] Added "success" EventType --- .../Listeners/ToLoggingDatabaseDataLoadEventListener.cs | 1 + Rdmp.UI/Progress/ProgressUI.cs | 4 ++++ Reusable/ReusableLibraryCode/Progress/EventType.cs | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Rdmp.Core/Logging/Listeners/ToLoggingDatabaseDataLoadEventListener.cs b/Rdmp.Core/Logging/Listeners/ToLoggingDatabaseDataLoadEventListener.cs index 8da1fb336d..78b43a4f75 100644 --- a/Rdmp.Core/Logging/Listeners/ToLoggingDatabaseDataLoadEventListener.cs +++ b/Rdmp.Core/Logging/Listeners/ToLoggingDatabaseDataLoadEventListener.cs @@ -68,6 +68,7 @@ public virtual void OnNotify(object sender, NotifyEventArgs e) case ProgressEventType.Debug: break; case ProgressEventType.Information: + case ProgressEventType.Success: DataLoadInfo.LogProgress(Logging.DataLoadInfo.ProgressEventType.OnInformation, sender.ToString(), e.Message); break; case ProgressEventType.Warning: diff --git a/Rdmp.UI/Progress/ProgressUI.cs b/Rdmp.UI/Progress/ProgressUI.cs index 279492b017..89658ebfe2 100644 --- a/Rdmp.UI/Progress/ProgressUI.cs +++ b/Rdmp.UI/Progress/ProgressUI.cs @@ -53,6 +53,7 @@ public partial class ProgressUI : UserControl, IDataLoadEventListener private Bitmap _warningEx; private Bitmap _fail; private Bitmap _failEx; + private Bitmap _success; public ProgressUI() { @@ -83,6 +84,7 @@ public ProgressUI() _warningEx = ChecksAndProgressIcons.WarningEx; _fail = ChecksAndProgressIcons.Fail; _failEx = ChecksAndProgressIcons.FailEx; + _success = ChecksAndProgressIcons.Tick; olvMessage.ImageGetter += ImageGetter; olvProgressEvents.ItemActivate += olvProgressEvents_ItemActivate; @@ -116,6 +118,8 @@ private object ImageGetter(object rowObject) return o.Exception == null ? _warning : _warningEx; case ProgressEventType.Error: return o.Exception == null ? _fail : _failEx; + case ProgressEventType.Success: + return _success; default: throw new ArgumentOutOfRangeException(); } diff --git a/Reusable/ReusableLibraryCode/Progress/EventType.cs b/Reusable/ReusableLibraryCode/Progress/EventType.cs index 71d23b5aab..7dd0f616f7 100644 --- a/Reusable/ReusableLibraryCode/Progress/EventType.cs +++ b/Reusable/ReusableLibraryCode/Progress/EventType.cs @@ -12,6 +12,7 @@ public enum ProgressEventType Debug, Information, Warning, - Error + Error, + Success } } \ No newline at end of file From 5626422cf23f32c8eb6ca2bb01ec926db291758c Mon Sep 17 00:00:00 2001 From: Roy Mudie <5470814+RoyMudie@users.noreply.github.com> Date: Mon, 2 May 2022 17:22:19 +0100 Subject: [PATCH 6/6] Added initialized check to avoid duplicate information messages Added use of EventType.Success --- .../Destinations/BasicCohortDestination.cs | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/Rdmp.Core/CohortCommitting/Pipeline/Destinations/BasicCohortDestination.cs b/Rdmp.Core/CohortCommitting/Pipeline/Destinations/BasicCohortDestination.cs index 31ca8cdb0b..50eee33c40 100644 --- a/Rdmp.Core/CohortCommitting/Pipeline/Destinations/BasicCohortDestination.cs +++ b/Rdmp.Core/CohortCommitting/Pipeline/Destinations/BasicCohortDestination.cs @@ -25,6 +25,7 @@ public class BasicCohortDestination : IPluginCohortDestination { private string _privateIdentifier; private string _releaseIdentifier; + private bool _initialized = false; /// /// The cohort blueprint we are trying to create. @@ -203,7 +204,7 @@ public virtual void Dispose(IDataLoadEventListener listener, Exception pipelineF int id = Request.ImportAsExtractableCohort(DeprecateOldCohortOnSuccess, MigrateUsages); - listener.OnNotify(this,new NotifyEventArgs(ProgressEventType.Information, "Cohort successfully comitted to destination and imported as an RDMP ExtractableCohort (ID="+id+" <- this is the ID of the reference pointer, the cohortDefinitionID of the actual cohort remains as you specified:"+Request.NewCohortDefinition.ID+")")); + listener.OnNotify(this,new NotifyEventArgs(ProgressEventType.Success, "Cohort successfully comitted to destination and imported as an RDMP ExtractableCohort (ID="+id+" <- this is the ID of the reference pointer, the cohortDefinitionID of the actual cohort remains as you specified:"+Request.NewCohortDefinition.ID+")")); } /// @@ -222,18 +223,24 @@ public virtual void Abort(IDataLoadEventListener listener) /// public virtual void PreInitialize(ICohortCreationRequest value, IDataLoadEventListener listener) { - Request = value; - - var target = Request.NewCohortDefinition.LocationOfCohort; + if (_initialized == false) + { + Request = value; + + var target = Request.NewCohortDefinition.LocationOfCohort; - var syntax = target.GetQuerySyntaxHelper(); - _privateIdentifier = syntax.GetRuntimeName(target.PrivateIdentifierField); - _releaseIdentifier = syntax.GetRuntimeName(target.ReleaseIdentifierField); + var syntax = target.GetQuerySyntaxHelper(); + _privateIdentifier = syntax.GetRuntimeName(target.PrivateIdentifierField); + _releaseIdentifier = syntax.GetRuntimeName(target.ReleaseIdentifierField); - _fk = syntax.GetRuntimeName(Request.NewCohortDefinition.LocationOfCohort.DefinitionTableForeignKeyField); + _fk = syntax.GetRuntimeName(Request.NewCohortDefinition.LocationOfCohort.DefinitionTableForeignKeyField); + + listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Information, "CohortCreationRequest spotted, we will look for columns " + _privateIdentifier + " and " + _releaseIdentifier + " (both of which must be in the pipeline before we will allow the cohort to be submitted)")); + listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Information, "id column in table " + Request.NewCohortDefinition.LocationOfCohort.TableName + " is " + Request.NewCohortDefinition.LocationOfCohort.DefinitionTableForeignKeyField)); + + _initialized = true; + } - listener.OnNotify(this,new NotifyEventArgs(ProgressEventType.Information, "CohortCreationRequest spotted, we will look for columns " + _privateIdentifier + " and " + _releaseIdentifier + " (both of which must be in the pipeline before we will allow the cohort to be submitted)")); - listener.OnNotify(this,new NotifyEventArgs(ProgressEventType.Information, "id column in table " + Request.NewCohortDefinition.LocationOfCohort.TableName + " is " + Request.NewCohortDefinition.LocationOfCohort.DefinitionTableForeignKeyField)); } ///