mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 14:07:46 +08:00
Also fix event handler accumulation in OptionsWindow
- Add _isInitialized flag to OptionsWindow to prevent multiple ThemeChanged subscriptions - Ensures ThemeChanged event is only subscribed once Co-authored-by: Kvarkas <3611964+Kvarkas@users.noreply.github.com>
This commit is contained in:
@@ -12,6 +12,7 @@ namespace mRemoteNG.UI.Window
|
||||
public partial class OptionsWindow : BaseWindow
|
||||
{
|
||||
private FrmOptions _optionsForm;
|
||||
private bool _isInitialized = false;
|
||||
|
||||
#region Public Methods
|
||||
|
||||
@@ -34,8 +35,14 @@ namespace mRemoteNG.UI.Window
|
||||
|
||||
private void Options_Load(object sender, EventArgs e)
|
||||
{
|
||||
// Only subscribe to ThemeChanged once to prevent multiple subscriptions
|
||||
if (!_isInitialized)
|
||||
{
|
||||
ThemeManager.getInstance().ThemeChanged += ApplyTheme;
|
||||
_isInitialized = true;
|
||||
}
|
||||
|
||||
ApplyTheme();
|
||||
ThemeManager.getInstance().ThemeChanged += ApplyTheme;
|
||||
ApplyLanguage();
|
||||
LoadOptionsForm();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user