diff --git a/Src/FdoUi/FdoUiCore.cs b/Src/FdoUi/FdoUiCore.cs index 6af24c591e..26a6afadcc 100644 --- a/Src/FdoUi/FdoUiCore.cs +++ b/Src/FdoUi/FdoUiCore.cs @@ -1166,9 +1166,7 @@ public void MergeUnderlyingObject(bool fLoseNoTextData) { ReallyMergeUnderlyingObject(dlg.Hvo, fLoseNoTextData); // Refresh in case "Sense Number" was 0 in the target and non-0 in the source (LT-22155). -#pragma warning disable 618 // suppress obsolete warning - m_mediator.SendMessage("MasterRefresh", null); -#pragma warning restore 618 + Publisher.Publish(new PublisherParameterObject(EventConstants.MasterRefresh, null, m_propertyTable.GetWindow())); } } } diff --git a/Src/LexText/Interlinear/InterlinearSfmImportWizard.cs b/Src/LexText/Interlinear/InterlinearSfmImportWizard.cs index 0622762625..087fa241af 100644 --- a/Src/LexText/Interlinear/InterlinearSfmImportWizard.cs +++ b/Src/LexText/Interlinear/InterlinearSfmImportWizard.cs @@ -16,6 +16,7 @@ using SIL.FieldWorks.Common.Controls; using SIL.FieldWorks.Common.Controls.FileDialog; using SIL.FieldWorks.Common.FwUtils; +using static SIL.FieldWorks.Common.FwUtils.FwUtils; using SIL.FieldWorks.Common.RootSites; using SIL.LCModel; using SIL.LCModel.Infrastructure; @@ -586,9 +587,7 @@ protected override void OnFinishButton() Close(); } } -#pragma warning disable 618 // suppress obsolete warning - m_mediator.SendMessage("MasterRefresh", ActiveForm); -#pragma warning restore 618 + Publisher.Publish(new PublisherParameterObject(EventConstants.MasterRefresh, null, m_propertyTable.GetWindow())); if (m_firstNewText != null) { // try to select it. diff --git a/Src/LexText/LexTextDll/LexTextApp.cs b/Src/LexText/LexTextDll/LexTextApp.cs index dd0b274b47..128833cf58 100644 --- a/Src/LexText/LexTextDll/LexTextApp.cs +++ b/Src/LexText/LexTextDll/LexTextApp.cs @@ -420,9 +420,7 @@ dlg is LexImportWizard || dlg is NotebookImportWiz || dlg is LiftImportDlg || dlg is CombineImportDlg) { // Make everything we've imported visible. -#pragma warning disable 618 // suppress obsolete warning - wndActive.Mediator.SendMessage("MasterRefresh", wndActive); -#pragma warning restore 618 + Publisher.Publish(new PublisherParameterObject(EventConstants.MasterRefresh, null, wndActive)); } } } diff --git a/Src/LexText/Lexicon/ReversalListener.cs b/Src/LexText/Lexicon/ReversalListener.cs index 9588fea8b2..313a494204 100644 --- a/Src/LexText/Lexicon/ReversalListener.cs +++ b/Src/LexText/Lexicon/ReversalListener.cs @@ -731,9 +731,7 @@ protected virtual void ReallyDeleteReversalIndex(IReversalIndex ri) } // Without this, stale data can still display in the BulkEditSenses tool if you // recreate the deleted reversal index. -#pragma warning disable 618 // suppress obsolete warning - m_mediator.SendMessage("MasterRefresh", null); -#pragma warning restore 618 + Publisher.Publish(new PublisherParameterObject(EventConstants.MasterRefresh, null, m_propertyTable.GetWindow())); } internal static IReversalIndex ReversalIndexAfterDeletion(LcmCache cache, out int cobjNew) diff --git a/Src/LexText/Morphology/MasterInflFeatDlgListener.cs b/Src/LexText/Morphology/MasterInflFeatDlgListener.cs index 0b0238b035..5556e2b82f 100644 --- a/Src/LexText/Morphology/MasterInflFeatDlgListener.cs +++ b/Src/LexText/Morphology/MasterInflFeatDlgListener.cs @@ -123,13 +123,7 @@ private void DialogInsertItemInVector(object obj) #pragma warning disable 618 // suppress obsolete warning m_mediator.BroadcastMessageUntilHandled("JumpToRecord", dlg.SelectedFeatDefn.Hvo); #pragma warning restore 618 - // LT-6412: this call will now cause the Mediator to be disposed while it is busy processing - // this call, so there is code in the Mediator to handle in the middle of a msg the case - // where the object is nolonger valid. This has happend before and was being handled, this - // call "SendMessageToAllNow" has not had the code to handle the exception, so it was added. -#pragma warning disable 618 // suppress obsolete warning - m_mediator.SendMessageToAllNow("MasterRefresh", cache.LangProject.MsFeatureSystemOA); -#pragma warning restore 618 + Publisher.Publish(new PublisherParameterObject(EventConstants.MasterRefresh, null, m_propertyTable.GetWindow())); break; } } diff --git a/Src/LexText/Morphology/MasterPhonFeatDlgListener.cs b/Src/LexText/Morphology/MasterPhonFeatDlgListener.cs index 35a740af96..7438cb1906 100644 --- a/Src/LexText/Morphology/MasterPhonFeatDlgListener.cs +++ b/Src/LexText/Morphology/MasterPhonFeatDlgListener.cs @@ -135,13 +135,7 @@ private void DialogInsertItemInVector(object obj) m_mediator.BroadcastMessageUntilHandled("JumpToRecord", dlg.SelectedFeatDefn.Hvo); #pragma warning restore 618 } - // LT-6412: this call will now cause the Mediator to be disposed while it is busy processing - // this call, so there is code in the Mediator to handle in the middle of a msg the case - // where the object is nolonger valid. This has happend before and was being handled, this - // call "SendMessageToAllNow" has not had the code to handle the exception, so it was added. -#pragma warning disable 618 // suppress obsolete warning - m_mediator.SendMessageToAllNow("MasterRefresh", cache.LangProject.PhFeatureSystemOA); -#pragma warning restore 618 + Publisher.Publish(new PublisherParameterObject(EventConstants.MasterRefresh, null, m_propertyTable.GetWindow())); break; } } diff --git a/Src/LexText/Morphology/RespellerDlg.cs b/Src/LexText/Morphology/RespellerDlg.cs index 461eb1c3bc..47d218f900 100644 --- a/Src/LexText/Morphology/RespellerDlg.cs +++ b/Src/LexText/Morphology/RespellerDlg.cs @@ -519,9 +519,7 @@ private void m_btnClose_Click(object sender, EventArgs e) { if (ChangesWereMade) { -#pragma warning disable 618 // suppress obsolete warning - m_mediator.SendMessage("MasterRefresh", null); -#pragma warning restore 618 + Publisher.Publish(new PublisherParameterObject(EventConstants.MasterRefresh, null, m_propertyTable.GetWindow())); } Close(); } diff --git a/Src/xWorks/DTMenuHandler.cs b/Src/xWorks/DTMenuHandler.cs index ea3618f3e8..b18e15cfb1 100644 --- a/Src/xWorks/DTMenuHandler.cs +++ b/Src/xWorks/DTMenuHandler.cs @@ -626,9 +626,7 @@ private void POSPopupTreeManager_AfterSelect(object sender, System.Windows.Forms if (m_moveObj is IMoInflAffixSlot slot) { MoveSlot(slot, selectedPOS); -#pragma warning disable 618 // suppress obsolete warning - m_mediator.SendMessage("MasterRefresh", null); -#pragma warning restore 618 + Publisher.Publish(new PublisherParameterObject(EventConstants.MasterRefresh, null, m_propertyTable.GetWindow())); } if (m_moveObj is IMoInflAffixTemplate template) { diff --git a/Src/xWorks/FwXWindow.cs b/Src/xWorks/FwXWindow.cs index e865feb7cf..eb0a0992d4 100644 --- a/Src/xWorks/FwXWindow.cs +++ b/Src/xWorks/FwXWindow.cs @@ -307,6 +307,7 @@ private void BasicInit(FwApp app) } Subscriber.Subscribe(EventConstants.JumpToPopupLexEntry, JumpToPopupLexEntry, this); Subscriber.Subscribe(EventConstants.ConfigureCustomFields, ConfigureCustomFields, this); + Subscriber.Subscribe(EventConstants.MasterRefresh, OnMasterRefresh, this); } /// ------------------------------------------------------------------------------------ @@ -435,6 +436,7 @@ protected override void Dispose(bool disposing) { Subscriber.Unsubscribe(EventConstants.JumpToPopupLexEntry, JumpToPopupLexEntry); Subscriber.Unsubscribe(EventConstants.ConfigureCustomFields, ConfigureCustomFields); + Subscriber.Unsubscribe(EventConstants.MasterRefresh, OnMasterRefresh); if (m_viewHelper != null) m_viewHelper.Dispose(); @@ -2014,9 +2016,7 @@ public bool OnImportPhonology(object commandObject) var phonologyServices = new PhonologyServices(Cache); phonologyServices.DeletePhonology(); phonologyServices.ImportPhonologyFromXml(filename); -#pragma warning disable 618 // suppress obsolete warning - m_mediator.SendMessage("MasterRefresh", null); -#pragma warning restore 618 + Publisher.Publish(new PublisherParameterObject(EventConstants.MasterRefresh, null, this)); } catch (Exception ex) {