Public Class Form1
Public Result, Time1, Time2, Time3, Time4, Time5, sttime1, sttime2, sttime3, sttime4, sttime5 As Double
Public Name1, Name2, Name3, Name4, name5 As String
Public t1repeatcount, t2repeatcount, t3repeatcount, t4repeatcount, t5repeatcount As Integer
Private Sub t1name_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles t1name.TextChanged
TabPage1.Text = t1name.Text
If t1name.Text = "" Then
TabPage1.Text = "Timer 1"
End If
resp_t1.Text = "Name has changed to '" & t1name.Text & "'."
If t1name.Text = "" Then
resp_t1.Text = "Name was resetted."
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If t1name.Text = "" Then
Name1 = "Timer 1"
Else
Name1 = t1name.Text
End If
Try
Time1 = t1time.Text - 1
Catch ex As Exception
End Try
sttime1 = t1time.Text
Timer_1.Interval = 1000
Timer_1.Start()
resp_t1.Text = "Timer started for " & Time1 + 1 & " Seconds."
End Sub
Private Sub Timer_1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer_1.Tick
t1remtime.Text = Time1
If Time1 = 0 Then
resp_t1.Text = "Timer finished his work sucefully."
Timer_1.Stop()
If checkboxshutdown.Checked And Comboshutdown.SelectedIndex = 0 Then
If cbreboot.Checked Then
Shell("cmd /c " & Chr(34) & "shutdown -r" & Chr(34))
Else
Shell("cmd /c " & Chr(34) & "shutdown -s" & Chr(34))
End If
End If
Beep()
If RadioButton1.Checked Then
My.Computer.Audio.PlaySystemSound(Media.SystemSoun ds.Asterisk)
ElseIf RadioButton2.Checked Then
My.Computer.Audio.PlaySystemSound(Media.SystemSoun ds.Exclamation)
ElseIf RadioButton3.Checked Then
My.Computer.Audio.PlaySystemSound(Media.SystemSoun ds.Hand)
ElseIf RadioButton4.Checked Then
My.Computer.Audio.PlaySystemSound(Media.SystemSoun ds.Question)
End If
If CheckBox1.Checked Then
If cbownnot.Checked = False Then
MsgBox(Name1 & " has finished.")
Else
MsgBox(tbownnot.Text)
End If
End If
If t1repeat.Checked Then
t1repeatcount = t1repeatcount + 1
t1lblrep.Text = t1repeatcount
Button1.PerformClick()
End If
End If
Time1 = Time1 - 1
ProgressBar1.Minimum = 0
ProgressBar1.Maximum = sttime1
Try
ProgressBar1.Value = Time1 + 1
Catch ex As Exception
End Try
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If t2name.Text = "" Then
Name2 = "Timer 2"
Else
Name2 = t2name.Text
End If
Try
Time2 = t2time.Text - 1
Catch ex As Exception
End Try
sttime2 = t2time.Text
Timer_2.Interval = 1000
Timer_2.Start()
resp_t2.Text = "Timer started for " & Time2 + 1 & " Seconds."
End Sub
Private Sub Timer_2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer_2.Tick
t2remtime.Text = Time2
If Time2 = 0 Then
resp_t2.Text = "Timer finished his work sucefully."
Timer_2.Stop()
If checkboxshutdown.Checked And Comboshutdown.SelectedIndex = 1 Then
If cbreboot.Checked Then
Shell("cmd /c " & Chr(34) & "shutdown -r" & Chr(34))
Else
Shell("cmd /c " & Chr(34) & "shutdown -s" & Chr(34))
End If
End If
Beep()
If RadioButton1.Checked Then
My.Computer.Audio.PlaySystemSound(Media.SystemSoun ds.Asterisk)
ElseIf RadioButton2.Checked Then
My.Computer.Audio.PlaySystemSound(Media.SystemSoun ds.Exclamation)
ElseIf RadioButton3.Checked Then
My.Computer.Audio.PlaySystemSound(Media.SystemSoun ds.Hand)
Else
My.Computer.Audio.PlaySystemSound(Media.SystemSoun ds.Question)
End If
If CheckBox1.Checked Then
If cbownnot.Checked = False Then
MsgBox(Name2 & " has finished.")
Else
MsgBox(tbownnot.Text)
End If
End If
If t1repeat.Checked Then
t1repeatcount = t1repeatcount + 1
t1lblrep.Text = t1repeatcount
Button1.PerformClick()
End If
End If
Time2 = Time2 - 1
ProgressBar2.Minimum = 0
ProgressBar2.Maximum = sttime2
Try
ProgressBar2.Value = Time2 + 1
Catch ex As Exception
End Try
End Sub
Private Sub t2name_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles t2name.TextChanged
TabPage2.Text = t2name.Text
If t2name.Text = "" Then
TabPage2.Text = "Timer 2"
End If
resp_t2.Text = "Name has changed to '" & t2name.Text & "'."
If t2name.Text = "" Then
resp_t2.Text = "Name was resetted."
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If t3name.Text = "" Then
Name3 = "Timer 3"
Else
Name3 = t3name.Text
End If
Try
Time3 = t3time.Text - 1
Catch ex As Exception
End Try
sttime3 = t3time.Text
Timer_3.Interval = 1000
Timer_3.Start()
resp_t3.Text = "Timer started for " & Time3 + 1 & " Seconds."
End Sub
Private Sub Timer_3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer_3.Tick
t3remtime.Text = Time3
If Time3 = 0 Then
resp_t3.Text = "Timer finished his work sucefully."
Timer_3.Stop()
If checkboxshutdown.Checked And Comboshutdown.SelectedIndex = 2 Then
If cbreboot.Checked Then
Shell("cmd /c " & Chr(34) & "shutdown -r" & Chr(34))
Else
Shell("cmd /c " & Chr(34) & "shutdown -s" & Chr(34))
End If
End If
Beep()
If RadioButton1.Checked Then
My.Computer.Audio.PlaySystemSound(Media.SystemSoun ds.Asterisk)
ElseIf RadioButton2.Checked Then
My.Computer.Audio.PlaySystemSound(Media.SystemSoun ds.Exclamation)
ElseIf RadioButton3.Checked Then
My.Computer.Audio.PlaySystemSound(Media.SystemSoun ds.Hand)
Else
My.Computer.Audio.PlaySystemSound(Media.SystemSoun ds.Question)
End If
If CheckBox1.Checked Then
If cbownnot.Checked = False Then
MsgBox(Name3 & " has finished.")
Else
MsgBox(tbownnot.Text)
End If
End If
If t1repeat.Checked Then
t1repeatcount = t1repeatcount + 1
t1lblrep.Text = t1repeatcount
Button1.PerformClick()
End If
End If
Time3 = Time3 - 1
ProgressBar3.Minimum = 0
ProgressBar3.Maximum = sttime3
Try
ProgressBar3.Value = Time3 + 1
Catch ex As Exception
End Try
End Sub
Private Sub t3name_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles t3name.TextChanged
TabPage3.Text = t3name.Text
If t3name.Text = "" Then
TabPage3.Text = "Timer 3"
End If
resp_t3.Text = "Name has changed to '" & t3name.Text & "'."
If t3name.Text = "" Then
resp_t3.Text = "Name was resetted."
End If
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim hours, minutes, seconds As Double
If tbhours.Text = "" Then
hours = 0
Else
hours = CDbl(tbhours.Text)
End If
If tbmin.Text = "" Then
minutes = 0
Else
minutes = CDbl(tbmin.Text)
End If
If tbsec.Text = "" Then
seconds = 0
Else
seconds = CDbl(tbsec.Text)
End If
Result = (seconds * 1) + (minutes * 60) + (hours * 3600)
lblcalc.Text = "seconds"
tbres.Text = Result
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Select Case ComboBox1.SelectedIndex
Case 0
t1time.Text = Result
Case 1
t2time.Text = Result
Case 2
t3time.Text = Result
Case 3
t4time.Text = Result
Case 4
t5time.Text = Result
End Select
End Sub
Private Sub t4name_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles t4name.TextChanged
TabPage4.Text = t4name.Text
If t4name.Text = "" Then
TabPage4.Text = "Timer 4"
End If
resp_t4.Text = "Name has changed to '" & t4name.Text & "'."
If t4name.Text = "" Then
resp_t4.Text = "Name was resetted."
End If
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
If t4name.Text = "" Then
Name4 = "Timer 4"
Else
Name4 = t4name.Text
End If
Try
Time4 = t4time.Text - 1
Catch ex As Exception
End Try
sttime4 = t4time.Text
Timer_4.Interval = 1000
Timer_4.Start()
resp_t4.Text = "Timer started for " & Time4 + 1 & " Seconds."
End Sub
Private Sub Timer_4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer_4.Tick
t4remtime.Text = Time4
If Time4 = 0 Then
resp_t4.Text = "Timer finished his work sucefully."
Timer_4.Stop()
If checkboxshutdown.Checked And Comboshutdown.SelectedIndex = 3 Then
If cbreboot.Checked Then
Shell("cmd /c " & Chr(34) & "shutdown -r" & Chr(34))
Else
Shell("cmd /c " & Chr(34) & "shutdown -s" & Chr(34))
End If
End If
Beep()
If RadioButton1.Checked Then
My.Computer.Audio.PlaySystemSound(Media.SystemSoun ds.Asterisk)
ElseIf RadioButton2.Checked Then
My.Computer.Audio.PlaySystemSound(Media.SystemSoun ds.Exclamation)
ElseIf RadioButton3.Checked Then
My.Computer.Audio.PlaySystemSound(Media.SystemSoun ds.Hand)
Else
My.Computer.Audio.PlaySystemSound(Media.SystemSoun ds.Question)
End If
If CheckBox1.Checked Then
If cbownnot.Checked = False Then
MsgBox(Name4 & " has finished.")
Else
MsgBox(tbownnot.Text)
End If
End If
If t1repeat.Checked Then
t1repeatcount = t1repeatcount + 1
t1lblrep.Text = t1repeatcount
Button1.PerformClick()
End If
End If
Time4 = Time4 - 1
ProgressBar4.Minimum = 0
ProgressBar4.Maximum = sttime4
Try
ProgressBar4.Value = Time4 + 1
Catch ex As Exception
End Try
End Sub
Private Sub t5name_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles t5name.TextChanged
TabPage5.Text = t5name.Text
If t5name.Text = "" Then
TabPage5.Text = "Timer 5"
End If
resp_t5.Text = "Name has changed to '" & t5name.Text & "'."
If t5name.Text = "" Then
resp_t5.Text = "Name was resetted."
End If
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
If t5name.Text = "" Then
name5 = "Timer 5"
Else
name5 = t5name.Text
End If
Try
Time5 = t5time.Text - 1
Catch ex As Exception
End Try
sttime5 = t5time.Text
Timer_5.Interval = 1000
Timer_5.Start()
resp_t5.Text = "Timer started for " & Time5 + 1 & " Seconds."
End Sub
Private Sub Timer_5_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer_5.Tick
t5remtime.Text = Time5
If Time5 = 0 Then
resp_t5.Text = "Timer finished his work sucefully."
Timer_5.Stop()
If checkboxshutdown.Checked And Comboshutdown.SelectedIndex = 4 Then
If cbreboot.Checked Then
Shell("cmd /c " & Chr(34) & "shutdown -r" & Chr(34))
Else
Shell("cmd /c " & Chr(34) & "shutdown -s" & Chr(34))
End If
End If
Beep()
If RadioButton1.Checked Then
My.Computer.Audio.PlaySystemSound(Media.SystemSoun ds.Asterisk)
ElseIf RadioButton2.Checked Then
My.Computer.Audio.PlaySystemSound(Media.SystemSoun ds.Exclamation)
ElseIf RadioButton3.Checked Then
My.Computer.Audio.PlaySystemSound(Media.SystemSoun ds.Hand)
Else
My.Computer.Audio.PlaySystemSound(Media.SystemSoun ds.Question)
End If
If CheckBox1.Checked Then
If cbownnot.Checked = False Then
MsgBox(name5 & " has finished.")
Else
MsgBox(tbownnot.Text)
End If
End If
If t1repeat.Checked Then
t1repeatcount = t1repeatcount + 1
t1lblrep.Text = t1repeatcount
Button1.PerformClick()
End If
End If
Time5 = Time5 - 1
ProgressBar5.Minimum = 0
ProgressBar5.Maximum = sttime5
Try
ProgressBar5.Value = Time5 + 1
Catch ex As Exception
End Try
End Sub
Private Sub RadioButton1_Checked(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
My.Computer.Audio.PlaySystemSound(Media.SystemSoun ds.Asterisk)
End Sub
Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
My.Computer.Audio.PlaySystemSound(Media.SystemSoun ds.Exclamation)
End Sub
Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
My.Computer.Audio.PlaySystemSound(Media.SystemSoun ds.Hand)
End Sub
Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton4.CheckedChanged
My.Computer.Audio.PlaySystemSound(Media.SystemSoun ds.Beep)
End Sub
Private Sub NotifyIcon1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles NotifyIcon1.Click
Me.WindowState = FormWindowState.Normal
Me.ShowInTaskbar = True
NotifyIcon1.Visible = False
End Sub
Private Sub Form1_SizeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.SizeChanged
If Me.WindowState = FormWindowState.Minimized Then
Me.ShowInTaskbar = False
NotifyIcon1.Visible = True
NotifyIcon1.Text = "Running some Timers 4 you."
End If
End Sub
Private Sub cbownnot_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbownnot.CheckedChanged
tbownnot.Visible = True
If cbownnot.Checked = False Then
tbownnot.Visible = False
End If
End Sub
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
cbownnot.Visible = True
If CheckBox1.Checked = False Then
cbownnot.Visible = False
tbownnot.Visible = False
cbownnot.Checked = False
End If
End Sub
Private Sub checkboxshutdown_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles checkboxshutdown.CheckedChanged
If checkboxshutdown.Checked Then
Comboshutdown.Enabled = True
cbreboot.Enabled = True
Else
Comboshutdown.Enabled = False
cbreboot.Enabled = False
cbreboot.Checked = False
End If
End Sub
Private Sub t1repeat_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles t1repeat.CheckedChanged
t1repeatcount = 0
t1lblrep.Text = 0
End Sub
Private Sub t2repeat_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles t2repeat.CheckedChanged
t2repeatcount = 0
t2lblrep.Text = 0
End Sub
Private Sub t3repeat_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles t3repeat.CheckedChanged
t3repeatcount = 0
t3lblrep.Text = 0
End Sub
Private Sub t4repeat_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles t4repeat.CheckedChanged
t4repeatcount = 0
t4lblrep.Text = 0
End Sub
Private Sub t5repeat_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles t5repeat.CheckedChanged
t5repeatcount = 0
t5lblrep.Text = 0
End Sub
End Class