Skip to content

Commit 05f644c

Browse files
committed
Merge pull request #3 from akorb/master
Some more refactoring
2 parents 32780ab + 842d70e commit 05f644c

File tree

2 files changed

+9
-24
lines changed

2 files changed

+9
-24
lines changed

DeadLock/Forms/FrmMain.cs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ public FrmMain(string[] args)
6060
_languageManager.LoadLanguage(Properties.Settings.Default.Language);
6161
}
6262
LanguageSwitch();
63+
64+
nfiTray.Visible = Properties.Settings.Default.ShowNotifyIcon;
65+
if (Properties.Settings.Default.RememberFormSize)
66+
{
67+
Size = Properties.Settings.Default.FormSize;
68+
}
6369
}
6470
catch (Exception ex)
6571
{
@@ -248,19 +254,6 @@ private void LoadTheme()
248254
private void FrmMain_Load(object sender, EventArgs e)
249255
{
250256
versionStaticBarItem.Text += " " + Application.ProductVersion;
251-
try
252-
{
253-
nfiTray.Visible = Properties.Settings.Default.ShowNotifyIcon;
254-
if (Properties.Settings.Default.RememberFormSize)
255-
{
256-
Size = Properties.Settings.Default.FormSize;
257-
CenterToScreen();
258-
}
259-
}
260-
catch (Exception ex)
261-
{
262-
MessageBoxAdv.Show(ex.Message, "DeadLock", MessageBoxButtons.OK, MessageBoxIcon.Error);
263-
}
264257
}
265258

266259
private void aboutBarItem_Click(object sender, EventArgs e)

DeadLock/Forms/FrmSettings.cs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ private void SaveSettings()
219219

220220
List<string> args = new List<string>();
221221

222-
if(_originalStartup != (tbtnAutoRun.ToggleState == ToggleButtonState.Active))
222+
if (_originalStartup != (tbtnAutoRun.ToggleState == ToggleButtonState.Active))
223223
{
224224
_originalStartup = tbtnAutoRun.ToggleState == ToggleButtonState.Active;
225225
args.Add(_originalStartup ? "0" : "1");
@@ -251,15 +251,7 @@ private void SaveSettings()
251251
/// <param name="args">A list of arguments.</param>
252252
private static void StartRegManager(IReadOnlyList<string> args)
253253
{
254-
string a = "";
255-
for (int i = 0; i < args.Count; i++)
256-
{
257-
a += args[i];
258-
if (i != args.Count -1)
259-
{
260-
a += " ";
261-
}
262-
}
254+
string a = string.Join(" ", args);
263255
Process process = new Process
264256
{
265257
StartInfo =
@@ -376,7 +368,7 @@ private void btnSave_Click(object sender, EventArgs e)
376368
private void btnSelectPath_Click(object sender, EventArgs e)
377369
{
378370
cboLanguage.SelectedIndex = 2;
379-
OpenFileDialog ofd = new OpenFileDialog {Filter = "XML (*.xml)|*.xml"};
371+
OpenFileDialog ofd = new OpenFileDialog { Filter = "XML (*.xml)|*.xml" };
380372
if (ofd.ShowDialog() == DialogResult.OK)
381373
{
382374
txtLanguagePath.Text = ofd.FileName;

0 commit comments

Comments
 (0)