' D. de Haas
' Amsterdam, Netherlands
' 29 October 2002
' ddhadam@yahoo.com

Option Explicit On 
Option Strict On

Public Class HighScore
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents ListBoxScores As System.Windows.Forms.ListBox
    Friend WithEvents LabelTheBest As System.Windows.Forms.Label
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.ListBoxScores = New System.Windows.Forms.ListBox()
        Me.LabelTheBest = New System.Windows.Forms.Label()
        Me.SuspendLayout()
        '
        'ListBoxScores
        '
        Me.ListBoxScores.Location = New System.Drawing.Point(8, 32)
        Me.ListBoxScores.Name = "ListBoxScores"
        Me.ListBoxScores.Size = New System.Drawing.Size(272, 225)
        Me.ListBoxScores.TabIndex = 0
        '
        'LabelTheBest
        '
        Me.LabelTheBest.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.LabelTheBest.Location = New System.Drawing.Point(8, 8)
        Me.LabelTheBest.Name = "LabelTheBest"
        Me.LabelTheBest.Size = New System.Drawing.Size(272, 16)
        Me.LabelTheBest.TabIndex = 2
        '
        'HighScore
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(290, 264)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.LabelTheBest, Me.ListBoxScores})
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "HighScore"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "Tetris.NET - HighScores"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Public WriteOnly Property Score() As DdH.HighScore
        Set(ByVal Value As DdH.HighScore)
            Dim sc As DdH.HighScore.ScoreItem
            Dim FirstScore As Boolean = True

            For Each sc In Value
                If FirstScore Then
                    Me.LabelTheBest.Text = sc.ToString
                    FirstScore = False
                Else
                    Me.ListBoxScores.Items.Add(sc.ToString)
                End If
            Next
        End Set
    End Property
End Class
