Skip to content

Commit

Permalink
修复系统 TTS 不存在时使用强下课提醒会崩溃的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
STBBRD committed Aug 15, 2024
1 parent c226602 commit 2fec0d2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion ZongziTEK_Blackboard_Sticker/StrongNotificationWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,18 @@ public StrongNotificationWindow(string title, string subtitle)
TextBlockSubtitle.Text = subtitle;

if (subtitle == "") TextBlockSubtitle.Visibility = Visibility.Collapsed;

try
{
synthesizer = new SpeechSynthesizer();
}
catch (Exception ex)
{
// 系统 TTS 不存在
}
}

private SpeechSynthesizer synthesizer = new();
private SpeechSynthesizer synthesizer;

private async void Window_Loaded(object sender, RoutedEventArgs e)
{
Expand Down

0 comments on commit 2fec0d2

Please sign in to comment.