Skip to content

Commit

Permalink
마지막 언어 저장 방식 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
icaros7 committed Dec 11, 2018
1 parent 28e22b4 commit ef35539
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 48 deletions.
10 changes: 0 additions & 10 deletions source/Funbit.Ets.Telemetry.Server/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="Funbit.Ets.Telemetry.Server.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<appSettings>
<!-- ============================================================================== -->
Expand Down Expand Up @@ -68,11 +65,4 @@
</providers>
</roleManager>
</system.web>
<userSettings>
<Funbit.Ets.Telemetry.Server.Properties.Settings>
<setting name="Lang" serializeAs="String">
<value>0</value>
</setting>
</Funbit.Ets.Telemetry.Server.Properties.Settings>
</userSettings>
</configuration>
1 change: 1 addition & 0 deletions source/Funbit.Ets.Telemetry.Server/Helpers/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class Settings

public bool FirewallSetupHadErrors { get; set; }
public bool UrlReservationSetupHadErrors { get; set; }
public string LastLang { get; set; }

#endregion

Expand Down
36 changes: 16 additions & 20 deletions source/Funbit.Ets.Telemetry.Server/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ void Start()

void MainForm_Load(object sender, EventArgs e)
{
// Check Last Settings
Thread.CurrentThread.CurrentUICulture = new CultureInfo(Settings.Instance.LastLang);
// Apply Locale
FormInitialize();

// log current version for debugging
Log.InfoFormat("{0} ({1}) {2}", Environment.OSVersion,
Environment.Is64BitOperatingSystem ? "64" + StringLib.CurrentVersion_Bit : "32" + StringLib.CurrentVersion_Bit,
Expand All @@ -164,19 +169,6 @@ void MainForm_Load(object sender, EventArgs e)
Setup();

Start();

// Check Last Settings
if (Properties.Settings.Default.Lang == 0)
{
Lang_ko_ToolStripMenuItem.PerformClick();
}
else if (Properties.Settings.Default.Lang == 1)
{
Lang_en_ToolStripMenuItem.PerformClick();
}

// Apply Locale
FormInitialize();
}

void MainForm_FormClosed(object sender, FormClosedEventArgs e)
Expand Down Expand Up @@ -326,17 +318,21 @@ private void TranslateToolStripMenuItem_Click(object sender, EventArgs e)

private void Lang_ko_ToolStripMenuItem_Click(object sender, EventArgs e)
{
Thread.CurrentThread.CurrentUICulture = new CultureInfo("ko");
Properties.Settings.Default.Lang = 0;
Properties.Settings.Default.Save();
FormInitialize();
ChangeLang("ko", Lang_ko_ToolStripMenuItem.Text);
}

private void Lang_en_ToolStripMenuItem_Click(object sender, EventArgs e)
{
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en");
Properties.Settings.Default.Lang = 1;
Properties.Settings.Default.Save();
ChangeLang("en", Lang_en_ToolStripMenuItem.Text);
}

private void ChangeLang(string lang, string lang_button)
{
Thread.CurrentThread.CurrentUICulture = new CultureInfo(lang);
Settings.Instance.LastLang = lang;
Settings.Instance.Save();
MessageBox.Show(StringLib.Settings_Lang_LogInfo, StringLib.Information, MessageBoxButtons.OK ,MessageBoxIcon.Information);
Log.InfoFormat(StringLib.Settings_Lang_1 + lang_button + StringLib.Settings_Lang_2);
FormInitialize();
}
}
Expand Down
12 changes: 0 additions & 12 deletions source/Funbit.Ets.Telemetry.Server/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Funbit.Ets.Telemetry.Server.Properties" GeneratedClassName="Settings">
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles />
<Settings>
<Setting Name="Lang" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
</Settings>
<Settings />
</SettingsFile>

0 comments on commit ef35539

Please sign in to comment.