Skip to content

Commit

Permalink
Improve styling of ProjectCreationDialog (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
WiIIiam278 authored Feb 1, 2023
1 parent 4914b77 commit 59e9454
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 18 deletions.
4 changes: 2 additions & 2 deletions SerialLoops.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ VisualStudioVersion = 17.4.33205.214
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SerialLoops", "src\SerialLoops\SerialLoops.csproj", "{E049F009-138F-401A-9D5A-1977CB8DAF49}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SerialLoops.Tests", "test\SerialLoops.Tests\SerialLoops.Tests.csproj", "{0B5D20CC-9E91-4BC0-8A6E-0342ADCAC48D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SerialLoops.Tests", "test\SerialLoops.Tests\SerialLoops.Tests.csproj", "{0B5D20CC-9E91-4BC0-8A6E-0342ADCAC48D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SerialLoops.Lib", "src\SerialLoops.Lib\SerialLoops.Lib.csproj", "{CC729174-57CD-499A-B6E7-1FA6F9CE255F}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SerialLoops.Lib", "src\SerialLoops.Lib\SerialLoops.Lib.csproj", "{CC729174-57CD-499A-B6E7-1FA6F9CE255F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
81 changes: 65 additions & 16 deletions src/SerialLoops/ProjectCreationDialog.eto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,50 +26,94 @@ partial class ProjectCreationDialog : Dialog
void InitializeComponent()
{
Title = "Create New Project";
MinimumSize = new Size(400, 300);
MinimumSize = new Size(400, 275);
Padding = 10;

_nameBox = new();
_nameBox = new()
{
PlaceholderText = "Haroohie",
Size = new Size(150, 25)
};
_languageDropDown = new();
_languageDropDown.Items.AddRange(_availableLanguages.Select(a => new ListItem() { Text = a.Key, Key = a.Value }));
_languageDropDown.SelectedIndex = 0;
_romPath = new() { Text = NO_ROM_TEXT };
Command pickRomCommand = new();
pickRomCommand.Executed += PickRomCommand_Executed;
Command createCommand = new();
createCommand.Executed += CreateCommand_Executed;
Command cancelCommand = new();
cancelCommand.Executed += CancelCommand_Executed;

Content = new StackLayout
{
Spacing = 10,
HorizontalContentAlignment = HorizontalAlignment.Center,
Items =
{
new StackLayout
new GroupBox
{
Orientation = Orientation.Horizontal,
Items =
Text = "Project Options",
Padding = 5,
MinimumSize = new Size(300, 100),
Content = new StackLayout
{
"Name: ",
_nameBox,
Spacing = 10,
VerticalContentAlignment = VerticalAlignment.Center,
Items = {
new StackLayout
{
Orientation = Orientation.Horizontal,
HorizontalContentAlignment = HorizontalAlignment.Stretch,
Spacing = 10,
Items =
{
"Name",
_nameBox,
}
},
new StackLayout
{
Orientation = Orientation.Horizontal,
HorizontalContentAlignment = HorizontalAlignment.Stretch,
Spacing = 10,
Items =
{
"Language",
_languageDropDown,
}
}
}
}
},
new StackLayout
new GroupBox
{
Orientation = Orientation.Horizontal,
Items =
Text = "Select ROM",
Padding = 5,
MinimumSize = new Size(300, 80),
Content = new StackLayout
{
"Language: ",
_languageDropDown,
Orientation = Orientation.Horizontal,
Spacing = 10,
VerticalContentAlignment = VerticalAlignment.Center,
Items =
{
new Button { Text = "Open ROM", Command = pickRomCommand },
_romPath,
}
}
},
new StackLayout
{
Orientation = Orientation.Horizontal,
Padding = 5,
Spacing = 10,
Items =
{
new Button { Text = "Open ROM", Command = pickRomCommand },
_romPath,
new Button { Text = "Create", Command = createCommand },
new Button { Text = "Cancel", Command = cancelCommand }
}
},
new Button { Text = "Create", Command = createCommand },
}
};
}
Expand All @@ -88,7 +132,7 @@ protected override void OnLoad(EventArgs e)
}
base.OnLoad(e);
}

private void PickRomCommand_Executed(object sender, EventArgs e)
{
OpenFileDialog openFileDialog = new() { Title = "Open ROM", CheckFileExists = true };
Expand All @@ -99,6 +143,11 @@ private void PickRomCommand_Executed(object sender, EventArgs e)
}
}

private void CancelCommand_Executed(object sender, EventArgs e)
{
Close();
}

private void CreateCommand_Executed(object sender, EventArgs e)
{
if (_romPath.Text == NO_ROM_TEXT)
Expand Down

0 comments on commit 59e9454

Please sign in to comment.