Option Strict Off
Option Explicit On
Friend Class ProgressWindow
	Inherits System.Windows.Forms.Form
	Public current As Short
	Public max As Short
	Public lastupdate As Short
	Public updateinterval As Short
	
	Private Sub ProgressWindow_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
		current = 0
		max = 100
		lastupdate = 0
		updateinterval = 8
	End Sub
	
	Public Sub setcurrent(ByVal c As Short)
		If c >= lastupdate + updateinterval Or current = max Then
			ProgressA.Value = c
			lastupdate = c
			Me.Refresh()
		End If
	End Sub
	
	Public Sub setmax(ByVal m As Short)
		max = m
		ProgressA.Maximum = m
		lastupdate = 0
	End Sub

    Private Sub ProgressWindow_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
        Select Case e.CloseReason
            Case CloseReason.UserClosing
                Hide()
                e.Cancel = True
        End Select
    End Sub
End Class