Fixed base component

This commit is contained in:
Thorsten Sommer 2026-01-06 20:29:15 +01:00
parent 2df9d363c8
commit 21d2de2614
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
2 changed files with 8 additions and 7 deletions

View File

@ -1,7 +1,7 @@
@using AIStudio.Settings.DataModel @using AIStudio.Settings.DataModel
@namespace AIStudio.Components @namespace AIStudio.Components
@inherits ComponentBase @inherits MSGComponentBase
@if (PreviewFeatures.PRE_SPEECH_TO_TEXT_2026.IsEnabled(this.SettingsManager)) @if (PreviewFeatures.PRE_SPEECH_TO_TEXT_2026.IsEnabled(this.SettingsManager))
{ {

View File

@ -1,4 +1,3 @@
using AIStudio.Settings;
using AIStudio.Tools.MIME; using AIStudio.Tools.MIME;
using AIStudio.Tools.Services; using AIStudio.Tools.Services;
@ -6,7 +5,7 @@ using Microsoft.AspNetCore.Components;
namespace AIStudio.Components; namespace AIStudio.Components;
public partial class VoiceRecorder : IDisposable public partial class VoiceRecorder : MSGComponentBase
{ {
[Inject] [Inject]
private ILogger<VoiceRecorder> Logger { get; init; } = null!; private ILogger<VoiceRecorder> Logger { get; init; } = null!;
@ -17,9 +16,6 @@ public partial class VoiceRecorder : IDisposable
[Inject] [Inject]
private RustService RustService { get; init; } = null!; private RustService RustService { get; init; } = null!;
[Inject]
private SettingsManager SettingsManager { get; set; } = null!;
private bool isRecording; private bool isRecording;
private FileStream? currentRecordingStream; private FileStream? currentRecordingStream;
private string? currentRecordingPath; private string? currentRecordingPath;
@ -176,7 +172,9 @@ public partial class VoiceRecorder : IDisposable
public bool ChangedMimeType { get; init; } public bool ChangedMimeType { get; init; }
} }
public void Dispose() #region Overrides of MSGComponentBase
protected override void DisposeResources()
{ {
// Clean up recording resources if still active: // Clean up recording resources if still active:
if (this.currentRecordingStream is not null) if (this.currentRecordingStream is not null)
@ -187,5 +185,8 @@ public partial class VoiceRecorder : IDisposable
this.dotNetReference?.Dispose(); this.dotNetReference?.Dispose();
this.dotNetReference = null; this.dotNetReference = null;
base.DisposeResources();
} }
#endregion
} }