Fixed DeepL state after changing its settings

This commit is contained in:
Thorsten Sommer 2023-02-12 12:01:27 +01:00
parent 96823aa948
commit 882c2bba2b
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
4 changed files with 14 additions and 3 deletions

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);

View File

@ -76,4 +76,6 @@ public static class DeepL
return string.Empty;
}
}
public static void ResetState() => DEEPL_NOT_AVAILABLE = false;
}

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}";
}

View File

@ -79,6 +79,7 @@ internal static class Program
// Start the app:
do
{
Processor.DeepL.ResetState();
Application.Run(new Main());
} while (Program.RestartMainApp);
}