Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OnConfigurationWindowClosed Event #415

Merged
merged 2 commits into from
Nov 12, 2023
Merged
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
17 changes: 16 additions & 1 deletion JotunnLib/Managers/SynchronizationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ public class SynchronizationManager : IManager
/// </summary>
public static event Action OnAdminStatusChanged;

/// <summary>
/// Event triggered after the in-game configuration manager window is closed
/// </summary>
public static event Action OnConfigurationWindowClosed;

private static SynchronizationManager _instance;

/// <summary>
Expand Down Expand Up @@ -574,11 +579,21 @@ private void ConfigurationManager_DisplayingWindowChanged(object sender, object

if (!ConfigurationManagerWindowShown)
{
InvokeOnConfigurationWindowClosed();

// After closing the window check for changed configs
SynchronizeChangedConfig();
}
}

/// <summary>
/// Safely invoke the <see cref="OnConfigurationWindowClosed"/> event
/// </summary>
private void InvokeOnConfigurationWindowClosed()
{
OnConfigurationWindowClosed?.SafeInvoke();
}

/// <summary>
/// Initial cache the config values of dependent plugins and register ourself to config change events
/// </summary>
Expand Down Expand Up @@ -875,7 +890,7 @@ private void InvokeOnConfigurationSynchronized(bool initial, HashSet<string> plu
}

/// <summary>
/// Safely invoke the <see cref="OnConfigurationSynchronized"/> event
/// Safely invoke the <see cref="OnSyncingConfiguration"/> event
/// </summary>
private void InvokeOnSyncingConfiguration()
{
Expand Down