Mono does not like my settings for some reason. Moved settings to my own class that loads from properties.settings. Will load/save to xml in another commit.

This commit is contained in:
2017-06-16 11:27:53 -05:00
parent b7bef436d2
commit 16f5c54ee9
7 changed files with 150 additions and 57 deletions

View File

@ -326,13 +326,14 @@ namespace EduNetworkBuilder
{
BuilderWindow myWin = (BuilderWindow)Application.OpenForms["BuilderWindow"];
CultureInfo CI=null;
NBSettings oursettings = NB.GetSettings();
if (myWin != null)
{
CI = myWin.GetCulture();
}
if(CI == null || myWin == null)
{
string CL = Properties.Settings.Default.ChosenLanguage;
string CL = oursettings.ChosenLanguage;
CI = CultureInfo.CreateSpecificCulture(CL);
}
return CI;
@ -358,6 +359,16 @@ namespace EduNetworkBuilder
return myresource;
}
public static NBSettings GetSettings()
{
BuilderWindow myWin = (BuilderWindow)Application.OpenForms["BuilderWindow"];
if (myWin != null)
{
return myWin.OurSettings;
}
return new NBSettings(); //This is only in case we are blowing up. Try to avoid that.
}
/// <summary>
/// Determine if we are using Mono or .Net. Some things get killed using Mono.
/// </summary>
@ -460,7 +471,8 @@ namespace EduNetworkBuilder
{
//Find the window. If it exists, use /set the language setting there. If not, use / set the default.
BuilderWindow myWin = (BuilderWindow)Application.OpenForms["BuilderWindow"];
string lang = Properties.Settings.Default.ChosenLanguage;
NBSettings oursettings = NB.GetSettings();
string lang = oursettings.ChosenLanguage;
if (lang == "") lang = "en";
string StartingItem = "";
@ -512,12 +524,12 @@ namespace EduNetworkBuilder
LanguageForm.ShowDialog();
if (cbQuestions.SelectedIndex >= 0)
{
Properties.Settings.Default.LanguageHasBeenChosen = true;
oursettings.LanguageHasBeenChosen = true;
string mychoice = LanguageChoices[cbQuestions.SelectedIndex, 1];
if (myWin == null)
{
Properties.Settings.Default.ChosenLanguage = mychoice;
//Properties.Settings.Default.Save(); //We do this when we exit. No need to save it right this instant.
oursettings.ChosenLanguage = mychoice;
//oursettings.Save(); //We do this when we exit. No need to save it right this instant.
}
else
{