Changes to fix campatibility error

This commit is contained in:
Brett Hewitson 2021-12-03 10:33:53 +10:00
parent 98a19e2d17
commit bd04866ea6
4 changed files with 25 additions and 3 deletions

View file

@ -59,6 +59,28 @@ namespace ServerManagerTool.Plugin.Discord
public bool HasConfigForm => true; public bool HasConfigForm => true;
public string LanguageCode
{
get
{
var assembly = PluginHelper.Instance.GetType().Assembly;
if (assembly != null)
{
var pluginHelperType = assembly.GetType(typeof(PluginHelper).FullName, false, true);
if (pluginHelperType != null)
{
var field = pluginHelperType.GetProperty("LanguageCode");
if (field != null)
{
return field.GetValue(PluginHelper.Instance).ToString();
}
}
}
return "en-US";
}
}
private async Task CallHomeAsync() private async Task CallHomeAsync()
{ {
try try

View file

@ -25,7 +25,7 @@ namespace ServerManagerTool.Plugin.Discord.Windows
InitializeComponent(); InitializeComponent();
try try
{ {
ResourceUtils.UpdateResourceDictionary(this, PluginHelper.Instance.LanguageCode); ResourceUtils.UpdateResourceDictionary(this, plugin.LanguageCode);
} }
catch (Exception) catch (Exception)
{ {

View file

@ -23,7 +23,7 @@ namespace ServerManagerTool.Plugin.Discord.Windows
InitializeComponent(); InitializeComponent();
try try
{ {
ResourceUtils.UpdateResourceDictionary(this, PluginHelper.Instance.LanguageCode); ResourceUtils.UpdateResourceDictionary(this, plugin.LanguageCode);
} }
catch (Exception) catch (Exception)
{ {

View file

@ -21,7 +21,7 @@ namespace ServerManagerTool.Plugin.Discord.Windows
InitializeComponent(); InitializeComponent();
try try
{ {
ResourceUtils.UpdateResourceDictionary(this, PluginHelper.Instance.LanguageCode); ResourceUtils.UpdateResourceDictionary(this, plugin.LanguageCode);
} }
catch (Exception) catch (Exception)
{ {