Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Src/Common/FwUtils/EventConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public static class EventConstants
public const string PrepareToRefresh = "PrepareToRefresh";
public const string RecordNavigation = "RecordNavigation";
public const string RefreshCurrentList = "RefreshCurrentList";
public const string RefreshCurrentView = "RefreshCurrentView";
public const string RefreshInterlin = "RefreshInterlin";
public const string RefreshPopupWindowFonts = "RefreshPopupWindowFonts";
public const string ReloadAreaTools = "ReloadAreaTools";
Expand Down
9 changes: 8 additions & 1 deletion Src/LexText/LexTextControls/EntryDlgListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,15 @@ private void DialogInsertItemInVector(object obj)
bool newby;
dlg.GetDialogInfo(out entry, out newby);
// No need for a PropChanged here because InsertEntryDlg takes care of that. (LT-3608)
// Two-stage refresh: if the active content control can satisfy the request by
// regenerating its own content (the XHTML document views), skip the full refresh.
var refreshRequest = new ReturnObject(null);
Publisher.Publish(new PublisherParameterObject(EventConstants.RefreshCurrentView, refreshRequest, m_propertyTable.GetWindow()));
if (!refreshRequest.ReturnValue)
{
Publisher.Publish(new PublisherParameterObject(EventConstants.MasterRefresh, null, m_propertyTable.GetWindow()));
}
#pragma warning disable 618 // suppress obsolete warning
m_mediator.SendMessage("MasterRefresh", null);
m_mediator.SendMessage("JumpToRecord", entry.Hvo);
#pragma warning restore 618
}
Expand Down
11 changes: 8 additions & 3 deletions Src/xWorks/RecordClerk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1547,9 +1547,14 @@ private void DeleteRecord(object commandObject)
}
}
}
#pragma warning disable 618 // suppress obsolete warning
m_mediator.SendMessage("MasterRefresh", null);
#pragma warning restore 618
// Two-stage refresh: if the active content control can satisfy the request by
// regenerating its own content (the XHTML document views), skip the full refresh.
var refreshRequest = new ReturnObject(null);
Publisher.Publish(new PublisherParameterObject(EventConstants.RefreshCurrentView, refreshRequest, m_propertyTable.GetWindow()));
if (!refreshRequest.ReturnValue)
{
Publisher.Publish(new PublisherParameterObject(EventConstants.MasterRefresh, null, m_propertyTable.GetWindow()));
}
}
}
}
Expand Down
23 changes: 23 additions & 0 deletions Src/xWorks/XhtmlDocView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public override void Init(Mediator mediator, PropertyTable propertyTable, XmlNod
}
}
Subscriber.Subscribe(EventConstants.DictionaryConfigured, RefreshAllContent, m_propertyTable.GetWindow());
Subscriber.Subscribe(EventConstants.RefreshCurrentView, RefreshCurrentView, m_propertyTable.GetWindow());
}

protected override void Dispose(bool disposing)
Expand All @@ -93,6 +94,7 @@ protected override void Dispose(bool disposing)
if (disposing)
{
Subscriber.Unsubscribe(EventConstants.DictionaryConfigured, RefreshAllContent);
Subscriber.Unsubscribe(EventConstants.RefreshCurrentView, RefreshCurrentView);
}
base.Dispose(disposing);
}
Expand Down Expand Up @@ -1323,6 +1325,27 @@ public void OnMasterRefresh(object sender)
RefreshAllContent(null);
}

/// <summary>
/// First stage of a sender's two-stage refresh request: while this view is the active
/// content control it claims the request and satisfies it by regenerating its own
/// content, so the sender skips the full master refresh.
/// </summary>
private void RefreshCurrentView(object obj)
{
if (!(obj is ReturnObject retObj))
{
Debug.Assert(false, "Received unexpected object type.");
return;
}
// Return if already handled by another Subscriber.
Comment thread
papeh marked this conversation as resolved.
if (retObj.ReturnValue)
{
return;
}
RefreshAllContent(null);
retObj.ReturnValue = true;
}

/// <summary>
/// Regenerate this view's XHTML content, ensuring the selected publication is valid for
/// the current configuration. Subscribed to the Pub/Sub DictionaryConfigured event.
Expand Down
Loading