Skip to content

Commit 389d455

Browse files
committedSep 17, 2020
Code updated
1 parent 02ab6b7 commit 389d455

8 files changed

+39
-43
lines changed
 

‎Simon says/App.config

+5
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,9 @@
33
<startup>
44
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
55
</startup>
6+
<runtime>
7+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
8+
<probing privatePath="dlls"/>
9+
</assemblyBinding>
10+
</runtime>
611
</configuration>

‎Simon says/MainForm.Designer.cs

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Simon says/MainForm.cs

+13-2
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ private void OnCorrectSequence(object sender, CorrectEventArgs e)
190190

191191
private void OnGameOver(object sender, OverEventArgs e)
192192
{
193-
MessageBox.Show("Game over.\nTotal score: " + e.Score.ToString());
193+
MessageBox.Show("Your total score is: " + e.Score.ToString(),"Game over");
194194
this.simonBoard.ScoreTotal = 0;
195195
}
196196

@@ -225,6 +225,15 @@ private void frmSimon_FormClosing(object sender, FormClosingEventArgs e)
225225
SaveProgramSettings(_programSettings);
226226
}
227227

228+
private void frmSimon_Shown(object sender, EventArgs e)
229+
{
230+
// Send Close event to the splash screen
231+
using (var closeSplashEvent = new System.Threading.EventWaitHandle(false, System.Threading.EventResetMode.ManualReset, "CloseSplashScreenEvent"))
232+
{
233+
closeSplashEvent.Set();
234+
}
235+
}
236+
228237
private void frmSimon_Resize(object sender, EventArgs e)
229238
{
230239
// Force the client area to be painted again
@@ -274,7 +283,9 @@ private void toolStripMain_Start_Click(object sender, EventArgs e)
274283
private void toolStripMain_Stop_Click(object sender, EventArgs e)
275284
{
276285
_Game.Stop();
286+
string strScore = simonBoard.ScoreTotal.ToString();
277287
this.simonBoard.Stop();
288+
MessageBox.Show("Your total score is: " + strScore, "Game stopped");
278289
}
279290
private void toolStripMain_Settings_Click(object sender, EventArgs e)
280291
{
@@ -500,8 +511,8 @@ private void LoadDefaultSettings(ProgramSettings<string, string> settings)
500511
}
501512

502513

503-
#endregion Application settings
504514

515+
#endregion Application settings
505516

506517
}
507518
}

‎Simon says/MainForm.resx

-34
Original file line numberDiff line numberDiff line change
@@ -229,38 +229,4 @@
229229
<metadata name="statusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
230230
<value>143, 17</value>
231231
</metadata>
232-
<data name="simonBoard.DefaultButtonList" mimetype="application/x-microsoft.net.object.binary.base64">
233-
<value>
234-
AAEAAAD/////AQAAAAAAAAAMAgAAAKMDbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1u
235-
ZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLlNpbmdsZSwgbXNj
236-
b3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdh
237-
NWM1NjE5MzRlMDg5XSxbU3lzdGVtLlN0cmluZywgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3Vs
238-
dHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0sIG1zY29ybGliLCBW
239-
ZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0
240-
ZTA4OV1dLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tl
241-
eVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAAERTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5MaXN0
242-
YDFbW1N5c3RlbS5WYWx1ZVR1cGxlYDNbW1N5c3RlbS5JbnQzMgMA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X7////IVN5c3RlbS5WYWx1ZVR1cGxlYDNbW1N5c3RlbS5JbnQzMgMAAAAFSXRlbTEFSXRl
256-
bTIFSXRlbTMAAAEICwQAAAAAAAAAAABEQwYGAAAACEZGMDAwMEZGAfn////7////AQAAAAAAg0MGCAAA
257-
AAhGRkZGRkYwMAH3////+////wIAAAAAAMRDBgoAAAAIRkYwMEZGMDAB9f////v///8DAAAAAAClQwYM
258-
AAAACEZGRkYwMDAwAfP////7////BAAAAACAiUMGDgAAAAhGRmM3MTU4NQHx////+////wUAAAAAgIlD
259-
BhAAAAAIRkY4MDAwODAB7/////v///8GAAAAAICJQwYSAAAACEZGOGEyYmUyAe3////7////BwAAAACA
260-
iUMGFAAAAAhGRjBkOThiYQHr////+////wgAAAAAgIlDBhYAAAAIRkY5YWNkMzIB6f////v///8JAAAA
261-
AICJQwYYAAAACEZGZmZhNTAwAef////7////AAAAAAAAAAAKAeb////7////AAAAAAAAAAAKAeX////7
262-
////AAAAAAAAAAAKAeT////7////AAAAAAAAAAAKAeP////7////AAAAAAAAAAAKAeL////7////AAAA
263-
AAAAAAAKCw==
264-
</value>
265-
</data>
266232
</root>

‎Simon says/Simon says.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@
175175
<Content Include="images\settings.ico">
176176
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
177177
</Content>
178+
<Content Include="images\Simon splash.png" />
178179
<Content Include="images\simon.ico">
179180
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
180181
</Content>

‎Simon says/images/simon splash.png

79.9 KB
Loading

‎SimonBoard/CustomBoard.Designer.cs

+5-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎SimonBoard/CustomBoard.cs

+14-4
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,7 @@ protected override void OnPaint(PaintEventArgs e)
511511
dc.FillRectangle(solidBrush, rc);
512512

513513
ComputeBoardRectangles();
514+
AlignLabels();
514515

515516
// Draw outer circle
516517
solidBrush = new SolidBrush(_OuterColor);
@@ -533,6 +534,10 @@ protected override void OnResize(EventArgs e)
533534
base.OnResize(e);
534535

535536
System.Diagnostics.Debug.WriteLine("Board OnResize 1 — Values: "+ String.Join(", ", _buttons.Select(c => c.Value).ToArray()));
537+
538+
// If the window is minimized, there is no need to redraw the board and buttons
539+
if (this.ParentForm == null) return; // There's a resize event before the parent is assigned
540+
if (this.ParentForm.WindowState == FormWindowState.Minimized) return;
536541

537542
//Invalidate();
538543
AlignLabels();
@@ -639,11 +644,15 @@ private void AlignLabels()
639644
// ComputeBoardRectangles();
640645

641646
// Score text boxes
642-
lblScoreCurrent.Width = Convert.ToInt32(0.9 * _InnerRect.Width);
643-
lblScoreCurrent.Height = Convert.ToInt32(0.2 * lblScoreCurrent.Width);
647+
//lblScoreCurrent.Width = Convert.ToInt32(0.9 * _InnerRect.Width);
648+
//lblScoreCurrent.Height = Convert.ToInt32(0.2 * lblScoreCurrent.Width);
649+
//lblScoreCurrent.Font = new Font(lblScoreCurrent.Font.FontFamily.Name, 0.65f * lblScoreCurrent.Height);
650+
lblScoreCurrent.Font = new Font(lblScoreCurrent.Font.FontFamily.Name, 0.12f * _InnerRect.Width);
644651
lblScoreCurrent.Location = new Point((this.ClientRectangle.Width - lblScoreCurrent.Width) / 2, this.ClientRectangle.Height / 2 - lblScoreCurrent.Height);
645-
lblScoreTotal.Width = Convert.ToInt32(0.9 * _InnerRect.Width);
646-
lblScoreTotal.Height = Convert.ToInt32(0.2 * lblScoreTotal.Width);
652+
//lblScoreTotal.Width = Convert.ToInt32(0.9 * _InnerRect.Width);
653+
//lblScoreTotal.Height = Convert.ToInt32(0.2 * lblScoreTotal.Width);
654+
//lblScoreTotal.Font = new Font(lblScoreTotal.Font.FontFamily.Name, 0.65f * lblScoreTotal.Height);
655+
lblScoreTotal.Font = new Font(lblScoreTotal.Font.FontFamily.Name, 0.12f * _InnerRect.Width);
647656
lblScoreTotal.Location = new Point((this.ClientRectangle.Width - lblScoreTotal.Width) / 2, this.ClientRectangle.Height / 2 );
648657
}
649658

@@ -687,6 +696,7 @@ public void Stop()
687696
{
688697
_buttons[i].Clicked = false;
689698
}
699+
ScoreTotal = 0;
690700
}
691701
}
692702

0 commit comments

Comments
 (0)
Please sign in to comment.