Fixed resource handling

This commit is contained in:
Thorsten Sommer 2024-07-27 22:53:29 +02:00
parent 4ecdc48fce
commit 6d2813a4bd
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
4 changed files with 40 additions and 4 deletions

View File

@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Components;
namespace AIStudio.Components.Blocks; namespace AIStudio.Components.Blocks;
public partial class ConfigurationProviderSelection : ComponentBase, IMessageBusReceiver public partial class ConfigurationProviderSelection : ComponentBase, IMessageBusReceiver, IDisposable
{ {
[Parameter] [Parameter]
public Func<string> SelectedValue { get; set; } = () => string.Empty; public Func<string> SelectedValue { get; set; } = () => string.Empty;
@ -71,4 +71,13 @@ public partial class ConfigurationProviderSelection : ComponentBase, IMessageBus
} }
#endregion #endregion
#region Implementation of IDisposable
public void Dispose()
{
this.MessageBus.Unregister(this);
}
#endregion
} }

View File

@ -8,7 +8,7 @@ namespace AIStudio.Components;
/// <summary> /// <summary>
/// A base class for configuration options. /// A base class for configuration options.
/// </summary> /// </summary>
public partial class ConfigurationBase : ComponentBase, IMessageBusReceiver public partial class ConfigurationBase : ComponentBase, IMessageBusReceiver, IDisposable
{ {
/// <summary> /// <summary>
/// The description of the option, i.e., the name. Should be /// The description of the option, i.e., the name. Should be
@ -76,4 +76,13 @@ public partial class ConfigurationBase : ComponentBase, IMessageBusReceiver
} }
#endregion #endregion
#region Implementation of IDisposable
public void Dispose()
{
this.MessageBus.Unregister(this);
}
#endregion
} }

View File

@ -10,7 +10,7 @@ using DialogOptions = AIStudio.Components.CommonDialogs.DialogOptions;
namespace AIStudio.Components.Layout; namespace AIStudio.Components.Layout;
public partial class MainLayout : LayoutComponentBase, IMessageBusReceiver public partial class MainLayout : LayoutComponentBase, IMessageBusReceiver, IDisposable
{ {
[Inject] [Inject]
private IJSRuntime JsRuntime { get; init; } = null!; private IJSRuntime JsRuntime { get; init; } = null!;
@ -212,4 +212,13 @@ public partial class MainLayout : LayoutComponentBase, IMessageBusReceiver
await MessageBus.INSTANCE.SendMessage<bool>(this, Event.RESET_CHAT_STATE); await MessageBus.INSTANCE.SendMessage<bool>(this, Event.RESET_CHAT_STATE);
} }
} }
#region Implementation of IDisposable
public void Dispose()
{
this.MessageBus.Unregister(this);
}
#endregion
} }

View File

@ -11,7 +11,7 @@ using DialogOptions = AIStudio.Components.CommonDialogs.DialogOptions;
namespace AIStudio.Components.Pages; namespace AIStudio.Components.Pages;
public partial class Settings : ComponentBase, IMessageBusReceiver public partial class Settings : ComponentBase, IMessageBusReceiver, IDisposable
{ {
[Inject] [Inject]
public SettingsManager SettingsManager { get; init; } = null!; public SettingsManager SettingsManager { get; init; } = null!;
@ -179,4 +179,13 @@ public partial class Settings : ComponentBase, IMessageBusReceiver
} }
#endregion #endregion
#region Implementation of IDisposable
public void Dispose()
{
this.MessageBus.Unregister(this);
}
#endregion
} }