'Display all of the available scoreboards that we can connect to.
Dim ScoreboardDialog As CustomLayoutDialog
ScoreboardDialog.ShowAsync("Choose Scoreboard", "", "", "", Null, True) 'Initialize the dialog to be displayed
ScoreboardDialog.SetSize(60%x, 400dip)
Wait For Dialog_Ready(pnl As Panel)
pnl.LoadLayout("CustomDialogLayout") 'Load the layout which contains the list view.
CLVDialog.PressedColor = Colors.ARGB(255, 0x7E, 0xB4, 0xFA)
'Lets sort through the available scoreboards and determine which ones are applicable to us.
Dim SportIdentified As Boolean = False
For I = 0 To ConfigDB.NumScoreboards-1 'Loop through each retrieved scoreboard from the database
SportIdentified = False
If ConfigDB.Scoreboards(I).Sport <> "" And ConfigDB.Scoreboards(I).Sport.Contains(",") = True Then 'We need to make sure we have proper sport configurations.
Dim Sports() As String = Regex.Split(",", ConfigDB.Scoreboards(i).Sport) 'Grab all supported sport types.
For Each Sport As String In Sports 'Iterate through the array of available sport IDs
If Common.Val(Sport) = ScoreEngine.GameOptions.Sport Then 'Bingo we have a sport that we are compatible with to operate in.
SportIdentified = True
Exit 'Exit the iteration.
End If
Next
End If
'Once we have a scoreboard that has a compatible sport, we need to add this scoreboard into the list of available scoreboards.
If SportIdentified = True Then
If ConfigDB.Scoreboards(I).InUse = True Then 'The scoreboard is already in-use.
CLVDialog.AddTextItem(ConfigDB.Scoreboards(I).FriendlyName & " - IN USE", I)
Else 'Scoreboard is available for use.
CLVDialog.AddTextItem(ConfigDB.Scoreboards(I).FriendlyName, I)
End If
End If
Next
If CLVDialog.Size = 0 Then 'We didn't find any compatible scoreboards
ScoreboardDialog.CloseDialog(DialogResponse.NEGATIVE)
MsgboxAsync("There are currently no available scoreboards configured for your sport that you have selected. Please try again", "No compatible scoreboards found")
Return
End If
Wait For CLVDialog_ItemClick (Index As Int, Value As Object)
Log("Selected item: " & Value)
ScoreboardDialog.CloseDialog(DialogResponse.POSITIVE)