From e4f5fafdea69c319de5febc6e208b6fbd850d0a8 Mon Sep 17 00:00:00 2001 From: mark-sil <83427558+mark-sil@users.noreply.github.com> Date: Thu, 29 Jan 2026 15:31:38 -0500 Subject: [PATCH] LT-22387: Implement RefreshInterlin in Pub/Sub system --- Src/Common/FwUtils/EventConstants.cs | 1 + Src/LexText/Interlinear/InterlinMaster.Designer.cs | 10 +++++++--- Src/LexText/Interlinear/InterlinMaster.cs | 4 +++- Src/LexText/Morphology/ParserAnalysisRemover.cs | 2 +- Src/LexText/Morphology/UserAnalysisRemover.cs | 3 ++- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Src/Common/FwUtils/EventConstants.cs b/Src/Common/FwUtils/EventConstants.cs index 97904ac77a..5c003626d8 100644 --- a/Src/Common/FwUtils/EventConstants.cs +++ b/Src/Common/FwUtils/EventConstants.cs @@ -28,6 +28,7 @@ public static class EventConstants public const string PrepareToRefresh = "PrepareToRefresh"; public const string RecordNavigation = "RecordNavigation"; public const string RefreshCurrentList = "RefreshCurrentList"; + public const string RefreshInterlin = "RefreshInterlin"; public const string RefreshPopupWindowFonts = "RefreshPopupWindowFonts"; public const string ReloadAreaTools = "ReloadAreaTools"; public const string RemoveFilters = "RemoveFilters"; diff --git a/Src/LexText/Interlinear/InterlinMaster.Designer.cs b/Src/LexText/Interlinear/InterlinMaster.Designer.cs index b7d16cb4d6..c8351efd66 100644 --- a/Src/LexText/Interlinear/InterlinMaster.Designer.cs +++ b/Src/LexText/Interlinear/InterlinMaster.Designer.cs @@ -1,14 +1,16 @@ -// Copyright (c) 2015 SIL International +// Copyright (c) 2015 SIL International // This software is licensed under the LGPL, version 2.1 or later // (http://www.gnu.org/licenses/lgpl-2.1.html) +using SIL.FieldWorks.Common.Framework; +using SIL.FieldWorks.Common.FwUtils; +using static SIL.FieldWorks.Common.FwUtils.FwUtils; +using SIL.FieldWorks.Common.RootSites; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; -using SIL.FieldWorks.Common.Framework; -using SIL.FieldWorks.Common.RootSites; using XCore; namespace SIL.FieldWorks.IText @@ -32,6 +34,8 @@ protected override void Dispose(bool disposing) if (disposing) { + Subscriber.Unsubscribe(EventConstants.RefreshInterlin, RefreshInterlin); + //SuspendLayout(); // don't want do trigger OnLayout() when removing controls! //DestroyTitleContentsPane(); //if (m_tabCtrl != null) diff --git a/Src/LexText/Interlinear/InterlinMaster.cs b/Src/LexText/Interlinear/InterlinMaster.cs index d37d420fe2..5f7feb60bc 100644 --- a/Src/LexText/Interlinear/InterlinMaster.cs +++ b/Src/LexText/Interlinear/InterlinMaster.cs @@ -743,6 +743,8 @@ public override void Init(Mediator mediator, PropertyTable propertyTable, XmlNod InitBase(mediator, propertyTable, configurationParameters); m_fullyInitialized = true; RefreshPaneBar(); + + Subscriber.Subscribe(EventConstants.RefreshInterlin, RefreshInterlin); } /// @@ -880,7 +882,7 @@ protected override void OnValidating(System.ComponentModel.CancelEventArgs e) SaveWorkInProgress(); } - public void OnRefreshInterlin(object argument) + private void RefreshInterlin(object argument) { // Reset data. RootStText = null; diff --git a/Src/LexText/Morphology/ParserAnalysisRemover.cs b/Src/LexText/Morphology/ParserAnalysisRemover.cs index 9e2d751513..95937434a8 100644 --- a/Src/LexText/Morphology/ParserAnalysisRemover.cs +++ b/Src/LexText/Morphology/ParserAnalysisRemover.cs @@ -125,7 +125,7 @@ public void Process() }); // Interlin display may be affected. - m_dlg.Mediator.SendMessage("RefreshInterlin", null); + Publisher.Publish(new PublisherParameterObject(EventConstants.RefreshInterlin, null)); } #endregion IUtility implementation diff --git a/Src/LexText/Morphology/UserAnalysisRemover.cs b/Src/LexText/Morphology/UserAnalysisRemover.cs index 4e7990f999..12a255178f 100644 --- a/Src/LexText/Morphology/UserAnalysisRemover.cs +++ b/Src/LexText/Morphology/UserAnalysisRemover.cs @@ -5,6 +5,7 @@ using System.Text; using System.Threading.Tasks; using SIL.FieldWorks.Common.FwUtils; +using static SIL.FieldWorks.Common.FwUtils.FwUtils; using SIL.FieldWorks.FwCoreDlgs; using SIL.LCModel.Infrastructure; using SIL.LCModel; @@ -124,7 +125,7 @@ public void Process() } }); - m_dlg.Mediator.SendMessage("RefreshInterlin", null); + Publisher.Publish(new PublisherParameterObject(EventConstants.RefreshInterlin, null)); }