Skip to content

Commit 7ca5501

Browse files
fix: design view connecting to tts
The design view was connecting to TTS. The effect is funny, creepy, and outright terrifying. Voices both loud and soft depending on how half executed code behaves. closes #45
1 parent 9d8e045 commit 7ca5501

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/TwitchStreamingTools/Configuration.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
using System.Linq;
55
using System.Speech.Synthesis;
66

7+
using Avalonia.Controls;
8+
79
using Newtonsoft.Json;
810

911
using Nullinside.Api.Common.Twitch;
@@ -91,6 +93,10 @@ public static Configuration Instance {
9193
/// </summary>
9294
/// <returns>True if successful, false otherwise.</returns>
9395
public bool WriteConfiguration() {
96+
if (Design.IsDesignMode) {
97+
return false;
98+
}
99+
94100
try {
95101
Directory.CreateDirectory(Path.GetDirectoryName(CONFIG_LOCATION)!);
96102

src/TwitchStreamingTools/Services/TwitchTtsService.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
using System.Linq;
44
using System.Threading;
55

6+
using Avalonia.Controls;
7+
68
using log4net;
79

810
using Nullinside.Api.Common.Twitch;
@@ -93,6 +95,10 @@ private void Main() {
9395
/// Connects to any configuration found in the config file that we are not currently connected to.
9496
/// </summary>
9597
private void ConnectChatsInConfig() {
98+
if (Design.IsDesignMode) {
99+
return;
100+
}
101+
96102
List<string?>? missing = _configuration.TwitchChats?
97103
.Select(c => c.TwitchChannel)
98104
.Except(_chats?.Select(c => c.ChatConfig?.TwitchChannel) ?? [])

0 commit comments

Comments
 (0)