-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfrmOptions.vb
611 lines (482 loc) · 24.9 KB
/
frmOptions.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
Option Strict Off
Option Explicit On
Imports System.ComponentModel
Imports System.IO
Friend Class frmOptions
Inherits Form
' -------------------------------------------------------------------------------
' Dart Scorekeeper
'
' Written by Matthew Monroe
' Started in July 1999
' Ported to .NET in 2011
'
' E-mail: [email protected] or [email protected]
' Repository: https://github.com/alchemistmatt
'
' -------------------------------------------------------------------------------
'
' Licensed under the Apache License, Version 2.0; you may not use this file except
' in compliance with the License. You may obtain a copy of the License at
' http://www.apache.org/licenses/LICENSE-2.0
Private Const FONT_SIZE_MINIMUM As Short = 8
Private Const FONT_SIZE_MAXIMUM As Short = 38
Private mOptionsChangedLocal As Boolean
Private mFormLoaded As Boolean
Public Sub ReadIniFile()
Dim srInFile As StreamReader
Dim strLineIn As String
Dim KeyString As String
Dim x As Short
Dim intValue As Short
Try
If Not File.Exists(IniFilePath) Then
' Must re-create the .ini file
WriteIniFile(True)
End If
If Not File.Exists(IniFilePath) Then
MessageBox.Show("Ini file not found: " & IniFilePath, "File Missing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Exit Sub
End If
glbPlayerCount = 0
ReDim glbPlayers(MAX_PLAYER_COUNT)
srInFile = New StreamReader(New FileStream(IniFilePath, FileMode.Open, FileAccess.Read, FileShare.Read))
Do While srInFile.Peek() >= 0
strLineIn = srInFile.ReadLine
x = strLineIn.IndexOf("=")
If x > 0 Then
KeyString = strLineIn.Substring(x + 1)
Select Case strLineIn.Substring(0, x)
Case "TotalHits" : glbHitAndRotateStats.TotalHits = CInt(KeyString)
Case "HitsBetweenRotate" : glbHitAndRotateStats.HitsBetweenRotate = CInt(KeyString)
Case "CurrentRavenNumber" : glbHitAndRotateStats.CurrentWinmauNumber = CInt(KeyString)
Case "CurrentWinmauNumber" : glbHitAndRotateStats.CurrentWinmauNumber = CInt(KeyString)
Case "LastRotateHit" : glbHitAndRotateStats.LastRotateHit = CInt(KeyString)
Case "RotateBoardClockwise" : glbHitAndRotateStats.RotateBoardClockwise = CBool(KeyString)
Case "CutThroatCricket" : glbBoolCutThroatCricket = CBool(KeyString)
Case "CutThroatScoringMode" : glbCutThroatMode = CInt(KeyString)
Case "Default301StartScore" : glbDefault301StartScore = CInt(KeyString)
Case "ScoreFontSize" : glbScoreFontSize = CInt(KeyString)
Case "Require301DoubleIn" : glbBoolRequireDoubleIn = CBool(KeyString)
Case "Require301DoubleOut" : glbBoolRequireDoubleOut = CBool(KeyString)
Case "PlayWaveFile" : glbBoolPlayWaveFileForPlayer = CBool(KeyString)
Case "MinimumScoreToPlaySound" : glbMinimumScoreToPlaySound = CInt(KeyString)
Case "ScoreAreaSize"
intValue = CInt(KeyString)
If intValue >= sasScoreAreaSizeConstants.sasNormal And intValue <= sasScoreAreaSizeConstants.sasSmall Then
glbScoreAreaSizeVal = intValue
End If
Case "DartBoardSize"
intValue = CInt(KeyString)
If intValue >= bsBoardSizeConstants.bsSmall And intValue <= bsBoardSizeConstants.bsHuge Then
glbDartBoardSizeVal = intValue
End If
Case "Player"
If glbPlayerCount < MAX_PLAYER_COUNT Then
glbPlayerCount += 1
glbPlayers(glbPlayerCount) = String.Copy(KeyString)
End If
Case Else
' Unknown Key Name
Console.WriteLine("Unknown entry in .Ini file: " & strLineIn)
End Select
End If
Loop
srInFile.Close()
Try
SetFontSizes()
Catch ex As Exception
HandleException("ReadIniFile.SetFontSizes", ex)
End Try
Try
UpdateDartBoardSize()
Catch ex As Exception
HandleException("ReadIniFile.UpdateDartBoardSize", ex)
End Try
Try
UpdateScoreAreaSize()
Catch ex As Exception
HandleException("ReadIniFile.UpdateScoreAreaSize", ex)
End Try
If glbPlayerCount = 0 Then
glbPlayerCount = 4
glbPlayers(0) = String.Empty
For x = 1 To glbPlayerCount
glbPlayers(x) = "Player " & (x).ToString
Next x
End If
UpdateRotateStatus()
Catch ex As Exception
HandleException("ReadIniFile", ex)
End Try
End Sub
Private Sub SetFontSizes()
If glbScoreFontSize = 0 Then glbScoreFontSize = DEFAULT_SCORE_FONT_SIZE
frmCricket.SetScoreFontSizes(False)
End Sub
Private Sub ShowDefaultOptions()
Try
txtHitsBetweenRotate.Text = "1000"
chkRotateBoardClockwise.CheckState = CheckState.Unchecked
chkCutThroatCricket.CheckState = CheckState.Checked
optScoringModeLowScoreWins.Checked = True
txtDefault301StartScore.Text = "301"
chkPlaySounds.CheckState = CheckState.Checked
txtMinimumScoreToPlaySound.Text = "60"
cboScoreAreaSize.SelectedIndex = sasScoreAreaSizeConstants.sasNormal
cboDartBoardSize.SelectedIndex = bsBoardSizeConstants.bsMedium
cboScoreFontSize.SelectedIndex = DEFAULT_SCORE_FONT_SIZE - FONT_SIZE_MINIMUM
Catch ex As Exception
HandleException("Options->ShowDefaultOptions", ex)
End Try
End Sub
Private Sub UpdateRotateStatus()
' Determines if the board needs to be rotated and says which direction to rotate it
Dim x, NewWinmau, y As Short
' NumberOrder contains every other number on the board, in order, clockwise around the board
Dim NumberOrder() As Integer = New Integer() {20, 18, 13, 10, 2, 3, 7, 8, 14, 12}
Try
If glbHitAndRotateStats.HitsBetweenRotate = 0 Then glbHitAndRotateStats.HitsBetweenRotate = 1000
If glbHitAndRotateStats.TotalHits > glbHitAndRotateStats.LastRotateHit + glbHitAndRotateStats.HitsBetweenRotate Then
For x = 0 To NumberOrder.Length - 1
If glbHitAndRotateStats.CurrentWinmauNumber = NumberOrder(x) Then
If glbHitAndRotateStats.RotateBoardClockwise = False Then
y = x - 1
If y < 0 Then y = 9
Else
y = x + 1
If y > 9 Then y = 0
End If
NewWinmau = NumberOrder(y)
Exit For
End If
Next x
If x > 9 Then
' No match
NewWinmau = 8
End If
glbHitAndRotateStats.CurrentWinmauNumber = NewWinmau
glbHitAndRotateStats.LastRotateHit = glbHitAndRotateStats.TotalHits
Dim strMessage As String
strMessage = glbHitAndRotateStats.HitsBetweenRotate & " hits have occured since the last dart board rotation. Please rotate the board so the word Winmau lines up with the number " & NewWinmau
MessageBox.Show(strMessage, "Rotate Board", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
frmDarts.lblWinmau.Text = "Winmau at " & glbHitAndRotateStats.CurrentWinmauNumber.ToString()
Catch ex As Exception
HandleException("UpdateRotateStatus", ex)
End Try
End Sub
Public Sub UpdateScoreAreaSize()
frmCricket.SetScoreAreaSize(glbScoreAreaSizeVal)
End Sub
Public Sub WriteIniFile(Initialize As Boolean)
Dim x As Short
Dim swOutFile As StreamWriter
UpdateRotateStatus()
Try
swOutFile = New StreamWriter(New FileStream(IniFilePath, FileMode.Create, FileAccess.Write, FileShare.Read))
swOutFile.WriteLine("; Darts Ini File (v" & My.Application.Info.Version.Major & "." & My.Application.Info.Version.Minor & " Build " & My.Application.Info.Version.Revision & ")")
If Initialize Then
swOutFile.WriteLine("TotalHits=0")
swOutFile.WriteLine("HitsBetweenRotate=1000")
swOutFile.WriteLine("CurrentWinmauNumber=14")
swOutFile.WriteLine("LastRotateHit=0")
swOutFile.WriteLine("RotateBoardClockwise=True")
swOutFile.WriteLine("CutThroatCricket=-1")
swOutFile.WriteLine("CutThroatScoringMode=0")
swOutFile.WriteLine("Default301StartScore=301")
swOutFile.WriteLine("Require301DoubleIn=True")
swOutFile.WriteLine("Require301DoubleOut=True")
swOutFile.WriteLine("ScoreFontSize=12")
swOutFile.WriteLine("PlayWaveFile=True")
swOutFile.WriteLine("MinimumScoreToPlaySound=60")
swOutFile.WriteLine("DartBoardSize=1")
For x = 0 To 3
swOutFile.WriteLine("Player=Player " & (x + 1).ToString())
Next x
Else
swOutFile.WriteLine("TotalHits=" & glbHitAndRotateStats.TotalHits)
swOutFile.WriteLine("HitsBetweenRotate=" & glbHitAndRotateStats.HitsBetweenRotate)
swOutFile.WriteLine("CurrentWinmauNumber=" & glbHitAndRotateStats.CurrentWinmauNumber)
swOutFile.WriteLine("LastRotateHit=" & glbHitAndRotateStats.LastRotateHit)
swOutFile.WriteLine("RotateBoardClockwise=" & glbHitAndRotateStats.RotateBoardClockwise)
swOutFile.WriteLine("CutThroatCricket=" & glbBoolCutThroatCricket)
swOutFile.WriteLine("CutThroatScoringMode=" & glbCutThroatMode)
swOutFile.WriteLine("Default301StartScore=" & glbDefault301StartScore)
swOutFile.WriteLine("Require301DoubleIn=" & glbBoolRequireDoubleIn)
swOutFile.WriteLine("Require301DoubleOut=" & glbBoolRequireDoubleOut)
swOutFile.WriteLine("ScoreFontSize=" & glbScoreFontSize)
swOutFile.WriteLine("PlayWaveFile=" & glbBoolPlayWaveFileForPlayer)
swOutFile.WriteLine("MinimumScoreToPlaySound=" & glbMinimumScoreToPlaySound)
swOutFile.WriteLine("ScoreAreaSize=" & glbScoreAreaSizeVal)
swOutFile.WriteLine("DartBoardSize=" & glbDartBoardSizeVal)
glbPlayers(0) = String.Empty
For x = 1 To glbPlayerCount
swOutFile.WriteLine("Player=" & glbPlayers(x))
Next x
End If
swOutFile.Close()
Catch ex As Exception
HandleException("WriteIniFile", ex)
End Try
End Sub
Private Sub cboDartBoardSize_SelectedIndexChanged(eventSender As Object, eventArgs As EventArgs) Handles cboDartBoardSize.SelectedIndexChanged
If mFormLoaded Then
mOptionsChangedLocal = True
glbDartBoardSizeVal = cboDartBoardSize.SelectedIndex
UpdateDartBoardSize()
End If
End Sub
Private Sub cboScoreAreaSize_SelectedIndexChanged(eventSender As Object, eventArgs As EventArgs) Handles cboScoreAreaSize.SelectedIndexChanged
If mFormLoaded Then
mOptionsChangedLocal = True
glbScoreAreaSizeVal = cboScoreAreaSize.SelectedIndex
UpdateScoreAreaSize()
End If
End Sub
Private Sub cboScoreFontSize_SelectedIndexChanged(eventSender As Object, eventArgs As EventArgs) Handles cboScoreFontSize.SelectedIndexChanged
If mFormLoaded Then
mOptionsChangedLocal = True
glbScoreFontSize = CStr(cboScoreFontSize.SelectedItem)
SetFontSizes()
End If
End Sub
Private Sub chkCutThroatCricket_CheckedChanged(sender As Object, e As EventArgs) Handles chkCutThroatCricket.CheckedChanged
If mFormLoaded Then
mOptionsChangedLocal = True
glbBoolCutThroatCricket = CChkBox(chkCutThroatCricket)
optScoringModeLowScoreWins.Enabled = glbBoolCutThroatCricket
optScoringModeHighScoreWins.Enabled = glbBoolCutThroatCricket
End If
End Sub
Private Sub chkRotateBoardClockwise_CheckedChanged(sender As Object, e As EventArgs) Handles chkRotateBoardClockwise.CheckedChanged
If mFormLoaded Then
mOptionsChangedLocal = True
glbHitAndRotateStats.RotateBoardClockwise = CChkBox(chkRotateBoardClockwise)
End If
End Sub
Private Sub chkPlaySounds_CheckedChanged(sender As Object, e As EventArgs) Handles chkPlaySounds.CheckedChanged
If mFormLoaded Then
mOptionsChangedLocal = True
glbBoolPlayWaveFileForPlayer = CChkBox(chkPlaySounds)
End If
End Sub
Private Sub cmdCancel_Click(eventSender As Object, eventArgs As EventArgs) Handles cmdCancel.Click
Dim eResponse As DialogResult
If mOptionsChangedLocal Then
' Abort changes by reloading data from file
eResponse = MessageBox.Show("Are you sure you want to cancel any changes made?", "Cancel Changes", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2)
If eResponse = DialogResult.Yes Then
ReadIniFile()
Else
Exit Sub
End If
End If
Me.Close()
End Sub
Private Sub cmdClose_Click(eventSender As Object, eventArgs As EventArgs) Handles cmdClose.Click
' Save Changes
If mOptionsChangedLocal = True Then
WriteIniFile(False)
SetFontSizes()
End If
Me.Close()
End Sub
Private Sub cmdDefaults_Click(eventSender As Object, eventArgs As EventArgs) Handles cmdDefaults.Click
ShowDefaultOptions()
End Sub
Private Sub frmOptions_Load(eventSender As Object, eventArgs As EventArgs) Handles MyBase.Load
Dim intFontSize As Short
Try
mFormLoaded = False
' Set height and width
Me.Width = 427
Me.Height = 510
' Position form in window
Me.Left = (Screen.PrimaryScreen.Bounds.Width - Me.Width) / 2
Me.Top = (Screen.PrimaryScreen.Bounds.Height - Me.Height) / 3
mOptionsChangedLocal = False
' Fill textboxes and correctly check the checkboxes
If glbBoolCutThroatCricket Then
chkCutThroatCricket.CheckState = CheckState.Checked
Else
chkCutThroatCricket.CheckState = CheckState.Unchecked
End If
optScoringModeLowScoreWins.Enabled = glbBoolCutThroatCricket
optScoringModeHighScoreWins.Enabled = glbBoolCutThroatCricket
If glbCutThroatMode = ctCutThroatModeConstants.LowScoreWindows Then
optScoringModeLowScoreWins.Checked = True
Else
optScoringModeHighScoreWins.Checked = True
End If
With glbHitAndRotateStats
txtTotalHits.Text = CStr(.TotalHits)
txtHitsBetweenRotate.Text = CStr(.HitsBetweenRotate)
txtCurrentWinmauNumber.Text = CStr(.CurrentWinmauNumber)
txtLastRotateHit.Text = CStr(.LastRotateHit)
If .RotateBoardClockwise Then
chkRotateBoardClockwise.CheckState = CheckState.Checked
Else
chkRotateBoardClockwise.CheckState = CheckState.Unchecked
End If
End With
txtDefault301StartScore.Text = CStr(glbDefault301StartScore)
If glbBoolPlayWaveFileForPlayer Then
chkPlaySounds.CheckState = CheckState.Checked
Else
chkPlaySounds.CheckState = CheckState.Unchecked
End If
txtMinimumScoreToPlaySound.Text = CStr(glbMinimumScoreToPlaySound)
' Populate the combo boxes
With cboScoreFontSize
.Items.Clear()
For intFontSize = FONT_SIZE_MINIMUM To FONT_SIZE_MAXIMUM
.Items.Add(Trim(CStr(intFontSize)))
If intFontSize = glbScoreFontSize Then
.SelectedIndex = .Items.Count - 1
End If
Next intFontSize
If .SelectedIndex < 0 Then
.SelectedIndex = DEFAULT_SCORE_FONT_SIZE - FONT_SIZE_MINIMUM
End If
End With
With cboScoreAreaSize
.Items.Clear()
.Items.Add("Normal")
.Items.Add("Small")
.SelectedIndex = glbScoreAreaSizeVal
End With
With cboDartBoardSize
.Items.Clear()
.Items.Add("Small")
.Items.Add("Medium")
.Items.Add("Large")
.Items.Add("Huge")
.SelectedIndex = glbDartBoardSizeVal
End With
Catch ex As Exception
HandleException("frmOptions.Form_Load", ex)
End Try
mFormLoaded = True
End Sub
Private Sub txtCurrentWinmauNumber_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtCurrentWinmauNumber.KeyPress
TextBoxKeyPressHandler(txtCurrentWinmauNumber, e, True)
End Sub
Private Sub txtCurrentWinmauNumber_Validating(sender As Object, e As CancelEventArgs) Handles txtCurrentWinmauNumber.Validating
Dim intNewValue As Integer
If mFormLoaded Then
If Not Integer.TryParse(txtCurrentWinmauNumber.Text, intNewValue) Then
intNewValue = 20
txtCurrentWinmauNumber.Text = intNewValue.ToString()
End If
' NumberOrder contains every other number on the board, in order, clockwise around the board
Dim NumberOrder() As Integer = New Integer() {20, 18, 13, 10, 2, 3, 7, 8, 14, 12}
If Array.IndexOf(NumberOrder, intNewValue) >= 0 Then
If glbHitAndRotateStats.CurrentWinmauNumber <> intNewValue Then
mOptionsChangedLocal = True
glbHitAndRotateStats.CurrentWinmauNumber = intNewValue
End If
Else
MessageBox.Show("Invalid value; Must be 20, 18, 13, 10, 2, 3, 7, 8, 14, or 12", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
e.Cancel = True
End If
End If
End Sub
Private Sub txtDefault301StartScore_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtDefault301StartScore.KeyPress
TextBoxKeyPressHandler(txtDefault301StartScore, e, True)
End Sub
Private Sub txtDefault301StartScore_Validating(sender As Object, e As CancelEventArgs) Handles txtDefault301StartScore.Validating
Dim intNewValue As Integer
If mFormLoaded Then
If Integer.TryParse(txtDefault301StartScore.Text, intNewValue) Then
If intNewValue >= 0 AndAlso intNewValue <= 50000 Then
mOptionsChangedLocal = True
glbDefault301StartScore = intNewValue
Else
MessageBox.Show("Invalid value; must be between 0 and 50,000", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
e.Cancel = True
End If
End If
End If
End Sub
Private Sub txtHitsBetweenRotate_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtHitsBetweenRotate.KeyPress
TextBoxKeyPressHandler(txtHitsBetweenRotate, e, True)
End Sub
Private Sub txtHitsBetweenRotate_Validating(sender As Object, e As CancelEventArgs) Handles txtHitsBetweenRotate.Validating
Dim intNewValue As Integer
If mFormLoaded Then
If Integer.TryParse(txtHitsBetweenRotate.Text, intNewValue) Then
If intNewValue >= 0 AndAlso intNewValue <= 100000 Then
mOptionsChangedLocal = True
glbHitAndRotateStats.HitsBetweenRotate = intNewValue
Else
MessageBox.Show("Invalid value; must be between 0 and 100,000", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
e.Cancel = True
End If
End If
End If
End Sub
Private Sub txtLastRotateHit_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtLastRotateHit.KeyPress
TextBoxKeyPressHandler(txtLastRotateHit, e, True)
End Sub
Private Sub txtLastRotateHit_Validating(sender As Object, e As CancelEventArgs) Handles txtLastRotateHit.Validating
Dim intNewValue As Integer
If mFormLoaded Then
If Integer.TryParse(txtLastRotateHit.Text, intNewValue) Then
If intNewValue >= 0 AndAlso intNewValue <= 2000000000 Then
mOptionsChangedLocal = True
glbHitAndRotateStats.LastRotateHit = intNewValue
Else
MessageBox.Show("Invalid value; must be between 0 and 2,000,000,000", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
e.Cancel = True
End If
End If
End If
End Sub
Private Sub txtMinimumScoreToPlaySound_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtMinimumScoreToPlaySound.KeyPress
TextBoxKeyPressHandler(txtMinimumScoreToPlaySound, e, True)
End Sub
Private Sub txtMinimumScoreToPlaySound_Validating(sender As Object, e As CancelEventArgs) Handles txtMinimumScoreToPlaySound.Validating
Dim intMinimumScore As Integer
If mFormLoaded Then
If Integer.TryParse(txtMinimumScoreToPlaySound.Text, intMinimumScore) Then
If intMinimumScore >= 0 AndAlso intMinimumScore <= 300 Then
mOptionsChangedLocal = True
glbMinimumScoreToPlaySound = intMinimumScore
Else
MessageBox.Show("Invalid value; must be between 0 and 300", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
e.Cancel = True
End If
End If
End If
End Sub
Private Sub txtTotalHits_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtTotalHits.KeyPress
TextBoxKeyPressHandler(txtTotalHits, e, True)
End Sub
Private Sub txtTotalHits_Validating(sender As Object, e As CancelEventArgs) Handles txtTotalHits.Validating
Dim intTotalHits As Integer
If mFormLoaded Then
If Integer.TryParse(txtTotalHits.Text, intTotalHits) Then
If intTotalHits >= 0 AndAlso intTotalHits <= MAX_TOTAL_HITS Then
mOptionsChangedLocal = True
glbHitAndRotateStats.TotalHits = intTotalHits
Else
MessageBox.Show("Invalid value for Total Hits; must be between 0 and " & MAX_TOTAL_HITS.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
e.Cancel = True
End If
End If
End If
End Sub
Private Sub optScoringModeLowScoreWins_CheckedChanged(sender As Object, e As EventArgs) Handles optScoringModeLowScoreWins.CheckedChanged
If mFormLoaded Then
mOptionsChangedLocal = True
glbCutThroatMode = ctCutThroatModeConstants.LowScoreWindows
End If
End Sub
Private Sub optScoringModeHighScoreWins_CheckedChanged(sender As Object, e As EventArgs) Handles optScoringModeHighScoreWins.CheckedChanged
If mFormLoaded Then
mOptionsChangedLocal = True
glbCutThroatMode = ctCutThroatModeConstants.HighScoreWindows
End If
End Sub
End Class