Skip to content

Commit 942e68f

Browse files
committed
Add adjustment of controls depending on the language
1 parent 8953486 commit 942e68f

File tree

3 files changed

+48
-13
lines changed

3 files changed

+48
-13
lines changed

GitAutoUpdateGUI/FormMain.Designer.cs

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

GitAutoUpdateGUI/FormMain.cs

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ private void LoadSettingsAtStartup()
8383
SetLanguage(Settings.Default.LastLanguageUsed);
8484
CheckGitBashBinary();
8585
CheckGitBashPathInWinPath();
86+
AdjustAllControls();
8687
}
8788

8889
private void CheckGitBashPathInWinPath()
@@ -420,12 +421,42 @@ private void frenchToolStripMenuItem_Click(object sender, EventArgs e)
420421
{
421422
_currentLanguage = Language.French.ToString();
422423
SetLanguage(Language.French.ToString());
424+
AdjustAllControls();
423425
}
424426

425427
private void englishToolStripMenuItem_Click(object sender, EventArgs e)
426428
{
427429
_currentLanguage = Language.English.ToString();
428430
SetLanguage(Language.English.ToString());
431+
AdjustAllControls();
432+
}
433+
434+
private void AdjustAllControls()
435+
{
436+
AdjustControls(labelChooseVSVersion, comboBoxVSVersion, labelPickDirectory, buttonVSVersionGetPath, textBoxVSProjectPath);
437+
AdjustControls(checkBoxGitInPath, buttonAddGitBinaryToWinPath);
438+
AdjustControls(checkBoxGitBashInstalled, buttonGitBashBinPath, textBoxGitBashBinariesPath);
439+
AdjustControls(buttonClearLogTextBox, buttonScannWholePC, buttonLoadVSProjects, buttonUpdateVSProjects, checkBoxOnlyGenerateScriptFile);
440+
AdjustControls(checkBoxUnlistVSSolution, textBoxUnlistOldSolution, checkBoxCaseSensitive);
441+
AdjustControls(buttonClearAll, buttonCheckAll, buttonCheckUncheckAll, labelSelectVSProjects);
442+
}
443+
444+
private static void AdjustControls(params Control[] listOfControls )
445+
{
446+
int position = listOfControls[0].Width + 33; // 33 is the initial padding
447+
bool isFirstControl = true;
448+
foreach (Control control in listOfControls)
449+
{
450+
if (isFirstControl)
451+
{
452+
isFirstControl = false;
453+
}
454+
else
455+
{
456+
control.Left = position + 10;
457+
position += control.Width;
458+
}
459+
}
429460
}
430461

431462
private void SetLanguage(string myLanguage)
@@ -1447,7 +1478,6 @@ private void buttonCheckAll_Click(object sender, EventArgs e)
14471478
private void buttonAddGitBinaryToWinPath_Click(object sender, EventArgs e)
14481479
{
14491480
// Path = %path% + textBoxGitBashBinariesPath.text minus "git.exe"
1450-
// TODO add implementation code
14511481
var winPath = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.Machine);
14521482
#if Debug
14531483
MessageBox.Show("Here is your current Windows Path variable: " + winPath);

GitAutoUpdateGUI/Logger.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ public static class Logger
3232

3333
public static void Add(TextBoxBase textBox, string message)
3434
{
35+
if (textBox.Text == "Log")
36+
{
37+
textBox.Text = string.Empty;
38+
}
39+
3540
textBox.Text += DateTime.Now + OneSpace + Dash + OneSpace + message + Crlf;
3641
}
3742

0 commit comments

Comments
 (0)