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

Add event to be triggered when the UI is closing #435

Merged
merged 1 commit into from
Nov 2, 2022
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
11 changes: 11 additions & 0 deletions UI_Engine/Compute/LogUsage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ private static void OnProcessExit(object sender, EventArgs e)
// The file seems to be writable after the UI closed even without this but better safe than sorry.
if (m_UsageLog != null)
m_UsageLog.Close();

TriggerUIClose();
}

/*************************************/
Expand All @@ -171,6 +173,14 @@ private static void TriggerUsageLog(TriggerLogUsageArgs e)
m_UsageLogTriggered.Invoke(null, e);
}

/*************************************/

private static void TriggerUIClose()
{
if (m_UIClosed != null)
m_UIClosed.Invoke(null, null);
}

/*************************************/
/**** Static Fields ****/
/*************************************/
Expand All @@ -184,6 +194,7 @@ private static void TriggerUsageLog(TriggerLogUsageArgs e)
private static Dictionary<string, string> m_ProjectIDPerFile = new Dictionary<string, string>();

public static event EventHandler m_UsageLogTriggered;
public static event EventHandler m_UIClosed;

/*************************************/
}
Expand Down