diff --git a/Actions/DoSpeechAction.cs b/Actions/DoSpeechAction.cs deleted file mode 100644 index 0150a570..00000000 --- a/Actions/DoSpeechAction.cs +++ /dev/null @@ -1,34 +0,0 @@ -using ClassIsland.Core.Abstractions.Automation; -using ClassIsland.Core.Abstractions.Services.SpeechService; -using ClassIsland.Core.Attributes; -using Microsoft.Extensions.Logging; -using System; -using System.Threading.Tasks; -using SystemTools.Settings; - -namespace SystemTools.Actions -{ - [ActionInfo("SystemTools.DoSpeech", "语音播报", "\uE5C7", false)] - public class DoSpeechAction(ILogger logger, ISpeechService speechService) : ActionBase - { - private readonly ILogger _logger = logger; - private readonly ISpeechService _speechService = speechService; - - protected override async Task OnInvoke() - { - _logger.LogDebug("DoSpeechAction OnInvoke 开始"); - var text = Settings?.Text; - if (string.IsNullOrWhiteSpace(text)) - { - _logger.LogError("语音播报内容不能为空"); - throw new InvalidOperationException("语音播报内容不能为空"); - } - else - { - _speechService.EnqueueSpeechQueue(text); - } - await base.OnInvoke(); - _logger.LogDebug("DoSpeechAction OnInvoke 完成"); - } - } -} diff --git a/Controls/DoSpeechSettingsControl.cs b/Controls/DoSpeechSettingsControl.cs deleted file mode 100644 index ac838b55..00000000 --- a/Controls/DoSpeechSettingsControl.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Avalonia.Controls; -using ClassIsland.Core.Abstractions.Controls; -using SystemTools.Settings; - -namespace SystemTools.Controls; - -public class DoSpeechSettingsControl : ActionSettingsControlBase -{ - private readonly TextBox _textBox; - - public DoSpeechSettingsControl() - { - var panel = new StackPanel { Spacing = 8, Margin = new(10) }; - - panel.Children.Add(new TextBlock - { - Text = "语音播报", - FontWeight = Avalonia.Media.FontWeight.Bold, - FontSize = 14 - }); - - _textBox = new TextBox - { - Watermark = "请输入要播报的文字", - AcceptsReturn = true, - Height = 120, - Width = 420 - }; - _textBox.TextChanged += (_, _) => { Settings.Text = _textBox.Text ?? string.Empty; }; - panel.Children.Add(_textBox); - - Content = panel; - } - - protected override void OnInitialized() - { - base.OnInitialized(); - _textBox.Text = Settings.Text; - } -} diff --git a/Plugin.cs b/Plugin.cs index a965e13e..a7e177f7 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -278,8 +278,6 @@ private void RegisterBaseActions(IServiceCollection services) RegisterActionIfEnabled(services, config, "SystemTools.BackgroundPlayAudio"); RegisterActionIfEnabled(services, config, "SystemTools.ShowDesktop"); - // 语音播报 - RegisterActionIfEnabled(services, config, "SystemTools.DoSpeech"); // 悬浮窗设置 if (config.EnableFloatingWindowFeature) @@ -516,7 +514,7 @@ private void BuildBaseActionTree() if (HasAnyActionEnabled(config, "SystemTools.ClearAllNotifications", "SystemTools.RestartAsAdmin", "SystemTools.LoadTemporaryClassPlan", "SystemTools.OpenAppSettings", - "SystemTools.OpenProfileEditor", "SystemTools.OpenClassSwapWindow","SystemTools.DoSpeech")) + "SystemTools.OpenProfileEditor", "SystemTools.OpenClassSwapWindow")) { IActionService.ActionMenuTree["SystemTools 行动"].Add(new ActionMenuTreeGroup("ClassIsland…", "\uE5CB")); BuildClassIslandMenu(config); @@ -863,8 +861,6 @@ private void BuildClassIslandMenu(MainConfigData config) items.Add(new ActionMenuTreeItem("SystemTools.OpenProfileEditor", "打开档案编辑", "\uE699")); if (config.IsActionEnabled("SystemTools.OpenClassSwapWindow")) items.Add(new ActionMenuTreeItem("SystemTools.OpenClassSwapWindow", "打开换课窗口", "\uE13B")); - if (config.IsActionEnabled("SystemTools.DoSpeech")) - items.Add(new ActionMenuTreeItem("SystemTools.DoSpeech", "语音播报", "\uE5C7")); if (items.Count > 0) { diff --git a/Settings/DoSpeechSettings.cs b/Settings/DoSpeechSettings.cs deleted file mode 100644 index d01e980a..00000000 --- a/Settings/DoSpeechSettings.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Text.Json.Serialization; - -namespace SystemTools.Settings; - -public class DoSpeechSettings -{ - [JsonPropertyName("text")] - public string Text { get; set; } = string.Empty; -} diff --git a/SettingsPage/SystemToolsSettingsViewModel.cs b/SettingsPage/SystemToolsSettingsViewModel.cs index 08a16110..511a9d7a 100644 --- a/SettingsPage/SystemToolsSettingsViewModel.cs +++ b/SettingsPage/SystemToolsSettingsViewModel.cs @@ -213,7 +213,6 @@ public void InitializeFeatureItems() ("SystemTools.OpenAppSettings", "打开应用设置", "ClassIsland"), ("SystemTools.OpenProfileEditor", "打开档案编辑", "ClassIsland"), ("SystemTools.OpenClassSwapWindow", "打开换课窗口", "ClassIsland"), - ("SystemTools.DoSpeech", "语音播报", "ClassIsland"), }; if (Settings.EnableFloatingWindowFeature)