Fixed DeepL state after changing its settings

This commit is contained in:
tsommer committed 2023-02-12 12:01:27 +01:00
1 parent 96823aa948
commit 882c2bba2b
4 files changed
+14 -3

No files matched your search

+10 -2
View File
@@ -168,7 +168,11 @@ public static class AppSettings
#region DeepL Mode
public static async Task SetDeepLMode(SettingDeepLMode mode) => await AppSettings.SetSetting(SettingNames.DEEPL_MODE, mode);
public static async Task SetDeepLMode(SettingDeepLMode mode)
{
DeepL.ResetState();
await AppSettings.SetSetting(SettingNames.DEEPL_MODE, mode);
}
public static async Task<SettingDeepLMode> GetDeepLMode() => await AppSettings.GetSetting(SettingNames.DEEPL_MODE, SettingDeepLMode.DISABLED);
@@ -176,7 +180,11 @@ public static class AppSettings
#region DeepL API Key
public static async Task SetDeepLAPIKey(string apiKey) => await AppSettings.SetSetting(SettingNames.DEEPL_API_KEY, apiKey);
public static async Task SetDeepLAPIKey(string apiKey)
{
DeepL.ResetState();
await AppSettings.SetSetting(SettingNames.DEEPL_API_KEY, apiKey);
}
public static async Task<string> GetDeepLAPIKey() => await AppSettings.GetSetting(SettingNames.DEEPL_API_KEY, string.Empty);
+2
View File
@@ -76,4 +76,6 @@ public static class DeepL
return string.Empty;
}
}
public static void ResetState() => DEEPL_NOT_AVAILABLE = false;
}
+1 -1
View File
@@ -2,5 +2,5 @@
public static class Version
{
public static string Text => $"v0.8.3 (2023-02-11), .NET {Environment.Version}";
public static string Text => $"v0.8.4 (2023-02-12), .NET {Environment.Version}";
}
+1
View File
@@ -79,6 +79,7 @@ internal static class Program
// Start the app:
do
{
Processor.DeepL.ResetState();
Application.Run(new Main());
} while (Program.RestartMainApp);
}