|
Public Class frmTest
Dim i As Int16 = 0
Dim index As Int16 = 0
Dim Failed As Int16 = 0
Private Sub tmr_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmr.Tick
If i > 50 Then
tmr.Interval = 10
Else
tmr.Interval = 20
End If
stat.Items.Item(index).Status = StatusItem.CurrentStatus.Running
stat.Items.Item(index).Value = i
i += 1
If i > 50 And index = 1 Then
stat.Items.Item(index).Status = StatusItem.CurrentStatus.Failed
index += 1
Failed += 1
i = 0
End If
If i = 100 Then
stat.Items.Item(index).Status = StatusItem.CurrentStatus.Complete
index += 1
i = 0
If index > stat.Items.Count - 1 Then
lbl.Text = "Tasks have completed, " & failed & " task failed"
tmr.Stop()
tmr.Enabled = False
End If
End If
End Sub
Private Sub frmTest_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Reset()
End Sub
Private Sub btnTitle_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTitle.Click
If stat.ShowTitle Then
stat.ShowTitle = False
Else
stat.ShowTitle = True
End If
End Sub
Private Sub btnColor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnColor.Click
Dim cl As New ColorDialog
If cl.ShowDialog = Windows.Forms.DialogResult.OK Then
stat.LineColor = cl.Color
End If
End Sub
Private Sub btnCompleted_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCompleted.Click
Dim dg As New OpenFileDialog
dg.Filter = "Images|*.gif;*.jpg;*.png"
If dg.ShowDialog = Windows.Forms.DialogResult.OK Then
stat.CompleteImage = Image.FromFile(dg.FileName)
End If
End Sub
Private Sub btnFailed_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFailed.Click
Dim dg As New OpenFileDialog
dg.Filter = "Images|*.gif;*.jpg;*.png"
If dg.ShowDialog = Windows.Forms.DialogResult.OK Then
stat.FailedImage = Image.FromFile(dg.FileName)
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Reset()
End Sub
Public Sub Reset()
Dim item As StatusItem
For Each item In stat.Items
item.Status = StatusItem.CurrentStatus.Pending
Next
i = 0
index = 0
Failed = 0
stat.FailedImage = img.Images.Item(0)
stat.CompleteImage = img.Images.Item(1)
stat.LineColor = Color.Silver
stat.ShowTitle = True
lbl.Text = ""
tmr.Enabled = True
tmr.Start()
End Sub
Private Sub stat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles stat.Click
End Sub
End Class
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Shaps currently works as the Senior Networks Administrator for a small IT company in Australia. He is also involved in various software developments, for Windows, Windows Mobile, iPhone, Mac and occasionally the web. His central focus in this area, is User Interface design.
If he had spare time, he'd play some tunes, read a book or visit the gym. Until then, he writes small applications for the iPhone that help improve his productivity at work.