Skip to content

Commit

Permalink
* Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDead committed Sep 7, 2016
1 parent 9040ea5 commit adaed83
Show file tree
Hide file tree
Showing 4 changed files with 212 additions and 204 deletions.
21 changes: 17 additions & 4 deletions DeadLock/Classes/LanguageManager.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using System.IO;
using System;
using System.IO;
using System.Windows.Forms;
using System.Xml.Serialization;
using Syncfusion.Windows.Forms;

namespace DeadLock.Classes
{
Expand All @@ -9,7 +12,9 @@ namespace DeadLock.Classes
internal class LanguageManager
{
#region Variables

private Language _currentLanguage;

#endregion

/// <summary>
Expand All @@ -26,10 +31,18 @@ internal LanguageManager()
/// <param name="path">Path to the XML language file.</param>
internal void LoadLanguage(string path)
{
XmlSerializer serializer = new XmlSerializer(_currentLanguage.GetType());
using (StreamReader reader = new StreamReader(path))
try
{
XmlSerializer serializer = new XmlSerializer(_currentLanguage.GetType());
using (StreamReader reader = new StreamReader(path))
{
_currentLanguage = (Language)serializer.Deserialize(reader);
}
}
catch (Exception ex)
{
_currentLanguage = (Language)serializer.Deserialize(reader);
MessageBoxAdv.Show(ex.Message, "DeadLock", MessageBoxButtons.OK, MessageBoxIcon.Error);
LoadLanguage(1);
}
}

Expand Down
19 changes: 9 additions & 10 deletions DeadLock/Forms/FrmMain.Designer.cs

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

8 changes: 2 additions & 6 deletions DeadLock/Forms/FrmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ internal void LanguageSwitch()
clhProcessID.Text = l.ClhProcessId;

//Main Form - Status bar:
versionStaticBarItem.Text = l.LblVersion;
versionStaticBarItem.Text = l.LblVersion + @" " + Application.ProductVersion;

//Main Form - ContextMenu Items:
detailsToolStripMenuItem.Text = l.CmiDetails;
Expand Down Expand Up @@ -235,6 +235,7 @@ internal void LoadTheme()
cmsDetails.MetroColor = Properties.Settings.Default.MetroColor;
cmsTray.MetroColor = Properties.Settings.Default.MetroColor;

mfbmMain.BeginInit();
mfbmMain.MetroColor = Properties.Settings.Default.MetroColor;
mfbmMain.ResetCustomization = false;
mfbmMain.Style = VisualStyle.Metro;
Expand All @@ -255,11 +256,6 @@ internal void LoadTheme()
}
}

private void FrmMain_Load(object sender, EventArgs e)
{
versionStaticBarItem.Text += @" " + Application.ProductVersion;
}

private void aboutBarItem_Click(object sender, EventArgs e)
{
new FrmAbout(LanguageManager.GetLanguage()).ShowDialog();
Expand Down
Loading

0 comments on commit adaed83

Please sign in to comment.