Imports System.Threading

Public Class frmWorkDay
	Inherits System.Windows.Forms.Form

	Private Enum WorkDay
		Start = 0
		Break1 = 1
		Lunch = 2
		Break2 = 3
		GoHome = 4
	End Enum

	Private Enum Breaks
		None = -1
		Break1 = 0
		Lunch = 1
		Break2 = 2
		Home = 3
	End Enum

	Dim icn As Icon
	Dim dtTimes(4) As DateTime
	Dim tsBreaks(2) As TimeSpan
	Dim thw, thb As Thread
	Dim wdr, wdc As Integer
	Dim brr, brc As Integer
	Dim cbr As Breaks
	Dim off As TimeSpan
	Dim rnd As New Random

#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 SysMenu As System.Windows.Forms.ContextMenu
	Friend WithEvents SysIcon As System.Windows.Forms.NotifyIcon
	Friend WithEvents mnuExit As System.Windows.Forms.MenuItem
	Friend WithEvents mnuShow As System.Windows.Forms.MenuItem
	Friend WithEvents mnuHide As System.Windows.Forms.MenuItem
	Friend WithEvents mnuSep As System.Windows.Forms.MenuItem
	Friend WithEvents tmrWorkDay As System.Timers.Timer
	Friend WithEvents tmrBreak As System.Timers.Timer
	Friend WithEvents lblStart As System.Windows.Forms.Label
	Friend WithEvents dtpStart As System.Windows.Forms.DateTimePicker
	Friend WithEvents dtpBreak1 As System.Windows.Forms.DateTimePicker
	Friend WithEvents lblBreak1 As System.Windows.Forms.Label
	Friend WithEvents dtpLunch As System.Windows.Forms.DateTimePicker
	Friend WithEvents lblLunch As System.Windows.Forms.Label
	Friend WithEvents dtpBreak2 As System.Windows.Forms.DateTimePicker
	Friend WithEvents lblBreak2 As System.Windows.Forms.Label
	Friend WithEvents lblEnd As System.Windows.Forms.Label
	Friend WithEvents txtEnd As System.Windows.Forms.TextBox
	Friend WithEvents nudDay As System.Windows.Forms.NumericUpDown
	Friend WithEvents nudBreak1 As System.Windows.Forms.NumericUpDown
	Friend WithEvents nudLunch As System.Windows.Forms.NumericUpDown
	Friend WithEvents nudBreak2 As System.Windows.Forms.NumericUpDown
	Friend WithEvents mpbWork As CountDown.myProgressBar
	Friend WithEvents mpbBreak As CountDown.myProgressBar
	Friend WithEvents btnExit As System.Windows.Forms.Button
	Friend WithEvents tbcWorkDay As System.Windows.Forms.TabControl
	Friend WithEvents tbpWorkDay As System.Windows.Forms.TabPage
	Friend WithEvents tbpSettings As System.Windows.Forms.TabPage
	Friend WithEvents tmrWork As System.Timers.Timer
	Friend WithEvents chkText As System.Windows.Forms.CheckBox
	Friend WithEvents lblBreak As System.Windows.Forms.Label
	Friend WithEvents lblWorkDay As System.Windows.Forms.Label
	Friend WithEvents lblDuration As System.Windows.Forms.Label
	Friend WithEvents lblStartAt As System.Windows.Forms.Label
	Friend WithEvents tbpWorkColor As System.Windows.Forms.TabPage
	Friend WithEvents lblMinutes3 As System.Windows.Forms.Label
	Friend WithEvents lblMinutes2 As System.Windows.Forms.Label
	Friend WithEvents lblMinutes1 As System.Windows.Forms.Label
	Friend WithEvents lblHours As System.Windows.Forms.Label
	Friend WithEvents lblForground As System.Windows.Forms.Label
	Friend WithEvents btnFont As System.Windows.Forms.Button
	Friend WithEvents btnSave As System.Windows.Forms.Button
	Friend WithEvents btnRestore As System.Windows.Forms.Button
	Friend WithEvents tmrDemo As System.Windows.Forms.Timer
	Friend WithEvents cmbBars As System.Windows.Forms.ComboBox
	Friend WithEvents mpbTillNext As CountDown.myProgressBar
	Friend WithEvents lblProgressBar As System.Windows.Forms.Label
	Friend WithEvents mpbBar As CountDown.myProgressBar
	Friend WithEvents chkDisplayText As System.Windows.Forms.CheckBox
	Friend WithEvents nudGrdAngle As System.Windows.Forms.NumericUpDown
	Friend WithEvents lblGrdAngle As System.Windows.Forms.Label
	Friend WithEvents chkAngle As System.Windows.Forms.CheckBox
	Friend WithEvents chkWholebar As System.Windows.Forms.CheckBox
	Friend WithEvents cmbHatch As System.Windows.Forms.ComboBox
	Friend WithEvents lblHatch As System.Windows.Forms.Label
	Friend WithEvents cmbGrdStyle As System.Windows.Forms.ComboBox
	Friend WithEvents lblGrdStyle As System.Windows.Forms.Label
	Friend WithEvents lblGrdEnd As System.Windows.Forms.Label
	Friend WithEvents lblGrdStart As System.Windows.Forms.Label
	Friend WithEvents lblBackground As System.Windows.Forms.Label
	Friend WithEvents dlgFont As System.Windows.Forms.FontDialog
	Friend WithEvents dlgColor As System.Windows.Forms.ColorDialog
	Friend WithEvents lblAlpha As System.Windows.Forms.Label
	Friend WithEvents nudAlpha As System.Windows.Forms.NumericUpDown
	Friend WithEvents btnBarEnd As System.Windows.Forms.Button
	Friend WithEvents btnBarStart As System.Windows.Forms.Button
	Friend WithEvents btnForground As System.Windows.Forms.Button
	Friend WithEvents btnBackground As System.Windows.Forms.Button
	<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
		Me.components = New System.ComponentModel.Container
		Me.btnExit = New System.Windows.Forms.Button
		Me.SysMenu = New System.Windows.Forms.ContextMenu
		Me.mnuShow = New System.Windows.Forms.MenuItem
		Me.mnuHide = New System.Windows.Forms.MenuItem
		Me.mnuSep = New System.Windows.Forms.MenuItem
		Me.mnuExit = New System.Windows.Forms.MenuItem
		Me.SysIcon = New System.Windows.Forms.NotifyIcon(Me.components)
		Me.tmrWorkDay = New System.Timers.Timer
		Me.tmrBreak = New System.Timers.Timer
		Me.tbcWorkDay = New System.Windows.Forms.TabControl
		Me.tbpWorkDay = New System.Windows.Forms.TabPage
		Me.lblBreak = New System.Windows.Forms.Label
		Me.mpbBreak = New CountDown.myProgressBar
		Me.lblWorkDay = New System.Windows.Forms.Label
		Me.mpbWork = New CountDown.myProgressBar
		Me.mpbTillNext = New CountDown.myProgressBar
		Me.tbpSettings = New System.Windows.Forms.TabPage
		Me.lblMinutes3 = New System.Windows.Forms.Label
		Me.lblMinutes2 = New System.Windows.Forms.Label
		Me.lblMinutes1 = New System.Windows.Forms.Label
		Me.lblHours = New System.Windows.Forms.Label
		Me.nudBreak2 = New System.Windows.Forms.NumericUpDown
		Me.nudLunch = New System.Windows.Forms.NumericUpDown
		Me.nudBreak1 = New System.Windows.Forms.NumericUpDown
		Me.nudDay = New System.Windows.Forms.NumericUpDown
		Me.txtEnd = New System.Windows.Forms.TextBox
		Me.lblDuration = New System.Windows.Forms.Label
		Me.lblStartAt = New System.Windows.Forms.Label
		Me.lblEnd = New System.Windows.Forms.Label
		Me.dtpBreak2 = New System.Windows.Forms.DateTimePicker
		Me.lblBreak2 = New System.Windows.Forms.Label
		Me.dtpLunch = New System.Windows.Forms.DateTimePicker
		Me.lblLunch = New System.Windows.Forms.Label
		Me.dtpBreak1 = New System.Windows.Forms.DateTimePicker
		Me.lblBreak1 = New System.Windows.Forms.Label
		Me.dtpStart = New System.Windows.Forms.DateTimePicker
		Me.lblStart = New System.Windows.Forms.Label
		Me.chkText = New System.Windows.Forms.CheckBox
		Me.tbpWorkColor = New System.Windows.Forms.TabPage
		Me.btnBarEnd = New System.Windows.Forms.Button
		Me.btnBarStart = New System.Windows.Forms.Button
		Me.btnForground = New System.Windows.Forms.Button
		Me.btnBackground = New System.Windows.Forms.Button
		Me.nudAlpha = New System.Windows.Forms.NumericUpDown
		Me.lblAlpha = New System.Windows.Forms.Label
		Me.cmbBars = New System.Windows.Forms.ComboBox
		Me.lblProgressBar = New System.Windows.Forms.Label
		Me.btnRestore = New System.Windows.Forms.Button
		Me.btnSave = New System.Windows.Forms.Button
		Me.btnFont = New System.Windows.Forms.Button
		Me.lblForground = New System.Windows.Forms.Label
		Me.mpbBar = New CountDown.myProgressBar
		Me.chkDisplayText = New System.Windows.Forms.CheckBox
		Me.nudGrdAngle = New System.Windows.Forms.NumericUpDown
		Me.lblGrdAngle = New System.Windows.Forms.Label
		Me.chkAngle = New System.Windows.Forms.CheckBox
		Me.chkWholebar = New System.Windows.Forms.CheckBox
		Me.cmbHatch = New System.Windows.Forms.ComboBox
		Me.lblHatch = New System.Windows.Forms.Label
		Me.cmbGrdStyle = New System.Windows.Forms.ComboBox
		Me.lblGrdStyle = New System.Windows.Forms.Label
		Me.lblGrdEnd = New System.Windows.Forms.Label
		Me.lblGrdStart = New System.Windows.Forms.Label
		Me.lblBackground = New System.Windows.Forms.Label
		Me.tmrWork = New System.Timers.Timer
		Me.tmrDemo = New System.Windows.Forms.Timer(Me.components)
		Me.dlgFont = New System.Windows.Forms.FontDialog
		Me.dlgColor = New System.Windows.Forms.ColorDialog
		CType(Me.tmrWorkDay, System.ComponentModel.ISupportInitialize).BeginInit()
		CType(Me.tmrBreak, System.ComponentModel.ISupportInitialize).BeginInit()
		Me.tbcWorkDay.SuspendLayout()
		Me.tbpWorkDay.SuspendLayout()
		Me.tbpSettings.SuspendLayout()
		CType(Me.nudBreak2, System.ComponentModel.ISupportInitialize).BeginInit()
		CType(Me.nudLunch, System.ComponentModel.ISupportInitialize).BeginInit()
		CType(Me.nudBreak1, System.ComponentModel.ISupportInitialize).BeginInit()
		CType(Me.nudDay, System.ComponentModel.ISupportInitialize).BeginInit()
		Me.tbpWorkColor.SuspendLayout()
		CType(Me.nudAlpha, System.ComponentModel.ISupportInitialize).BeginInit()
		CType(Me.nudGrdAngle, System.ComponentModel.ISupportInitialize).BeginInit()
		CType(Me.tmrWork, System.ComponentModel.ISupportInitialize).BeginInit()
		Me.SuspendLayout()
		'
		'btnExit
		'
		Me.btnExit.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
		Me.btnExit.DialogResult = System.Windows.Forms.DialogResult.Cancel
		Me.btnExit.Location = New System.Drawing.Point(544, 296)
		Me.btnExit.Name = "btnExit"
		Me.btnExit.TabIndex = 1
		Me.btnExit.Text = "E&xit"
		'
		'SysMenu
		'
		Me.SysMenu.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuShow, Me.mnuHide, Me.mnuSep, Me.mnuExit})
		'
		'mnuShow
		'
		Me.mnuShow.Index = 0
		Me.mnuShow.Text = "&Show"
		'
		'mnuHide
		'
		Me.mnuHide.Index = 1
		Me.mnuHide.Text = "&Hide"
		'
		'mnuSep
		'
		Me.mnuSep.Index = 2
		Me.mnuSep.Text = "-"
		'
		'mnuExit
		'
		Me.mnuExit.Index = 3
		Me.mnuExit.Text = "E&xit"
		'
		'SysIcon
		'
		Me.SysIcon.ContextMenu = Me.SysMenu
		Me.SysIcon.Text = "NotifyIcon1"
		Me.SysIcon.Visible = True
		'
		'tmrWorkDay
		'
		Me.tmrWorkDay.Interval = 300000
		Me.tmrWorkDay.SynchronizingObject = Me
		'
		'tmrBreak
		'
		Me.tmrBreak.SynchronizingObject = Me
		'
		'tbcWorkDay
		'
		Me.tbcWorkDay.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
					Or System.Windows.Forms.AnchorStyles.Left) _
					Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
		Me.tbcWorkDay.Controls.Add(Me.tbpWorkDay)
		Me.tbcWorkDay.Controls.Add(Me.tbpSettings)
		Me.tbcWorkDay.Controls.Add(Me.tbpWorkColor)
		Me.tbcWorkDay.Location = New System.Drawing.Point(8, 8)
		Me.tbcWorkDay.Name = "tbcWorkDay"
		Me.tbcWorkDay.SelectedIndex = 0
		Me.tbcWorkDay.Size = New System.Drawing.Size(608, 280)
		Me.tbcWorkDay.SizeMode = System.Windows.Forms.TabSizeMode.FillToRight
		Me.tbcWorkDay.TabIndex = 0
		'
		'tbpWorkDay
		'
		Me.tbpWorkDay.Controls.Add(Me.lblBreak)
		Me.tbpWorkDay.Controls.Add(Me.mpbBreak)
		Me.tbpWorkDay.Controls.Add(Me.lblWorkDay)
		Me.tbpWorkDay.Controls.Add(Me.mpbWork)
		Me.tbpWorkDay.Controls.Add(Me.mpbTillNext)
		Me.tbpWorkDay.Location = New System.Drawing.Point(4, 24)
		Me.tbpWorkDay.Name = "tbpWorkDay"
		Me.tbpWorkDay.Size = New System.Drawing.Size(600, 252)
		Me.tbpWorkDay.TabIndex = 0
		Me.tbpWorkDay.Text = "Work Day"
		'
		'lblBreak
		'
		Me.lblBreak.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
		Me.lblBreak.Location = New System.Drawing.Point(16, 128)
		Me.lblBreak.Name = "lblBreak"
		Me.lblBreak.Size = New System.Drawing.Size(56, 112)
		Me.lblBreak.TabIndex = 2
		Me.lblBreak.Text = "Next Break"
		Me.lblBreak.TextAlign = System.Drawing.ContentAlignment.MiddleRight
		'
		'mpbBreak
		'
		Me.mpbBreak.Alpha = CType(255, Byte)
		Me.mpbBreak.Anchor = CType(((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left) _
					Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
		Me.mpbBreak.BackColor = System.Drawing.SystemColors.Control
		Me.mpbBreak.BarColor1 = System.Drawing.Color.DodgerBlue
		Me.mpbBreak.BarColor2 = System.Drawing.Color.OrangeRed
		Me.mpbBreak.Font = New System.Drawing.Font("Comic Sans MS", 36.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
		Me.mpbBreak.Gradient = CountDown.myProgressBar.GradientEnum.Continuous
		Me.mpbBreak.GradientAngle = 30.0!
		Me.mpbBreak.Hatch = CountDown.myProgressBar.HatchEnum.Shingle
		Me.mpbBreak.Location = New System.Drawing.Point(80, 128)
		Me.mpbBreak.Name = "mpbBreak"
		Me.mpbBreak.Size = New System.Drawing.Size(512, 112)
		Me.mpbBreak.TabIndex = 3
		Me.mpbBreak.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
		Me.mpbBreak.TextColor = System.Drawing.SystemColors.ControlText
		Me.mpbBreak.Value = CType(85, Long)
		Me.mpbBreak.Visible = False
		'
		'lblWorkDay
		'
		Me.lblWorkDay.Location = New System.Drawing.Point(16, 8)
		Me.lblWorkDay.Name = "lblWorkDay"
		Me.lblWorkDay.Size = New System.Drawing.Size(56, 112)
		Me.lblWorkDay.TabIndex = 0
		Me.lblWorkDay.Text = "Work Day"
		Me.lblWorkDay.TextAlign = System.Drawing.ContentAlignment.MiddleRight
		'
		'mpbWork
		'
		Me.mpbWork.Alpha = CType(255, Byte)
		Me.mpbWork.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
					Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
		Me.mpbWork.BackColor = System.Drawing.SystemColors.Control
		Me.mpbWork.BarColor2 = System.Drawing.Color.Lime
		Me.mpbWork.Font = New System.Drawing.Font("Comic Sans MS", 36.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
		Me.mpbWork.Gradient = CountDown.myProgressBar.GradientEnum.CustomAngle
		Me.mpbWork.GradientAngle = 45.0!
		Me.mpbWork.Hatch = CountDown.myProgressBar.HatchEnum.None
		Me.mpbWork.isAngleScaleable = False
		Me.mpbWork.Location = New System.Drawing.Point(80, 8)
		Me.mpbWork.Name = "mpbWork"
		Me.mpbWork.Size = New System.Drawing.Size(512, 112)
		Me.mpbWork.TabIndex = 1
		Me.mpbWork.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
		Me.mpbWork.TextColor = System.Drawing.SystemColors.ControlText
		Me.mpbWork.Value = CType(25, Long)
		'
		'mpbTillNext
		'
		Me.mpbTillNext.Alpha = CType(128, Byte)
		Me.mpbTillNext.Anchor = CType(((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left) _
					Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
		Me.mpbTillNext.BackColor = System.Drawing.SystemColors.Control
		Me.mpbTillNext.BarColor1 = System.Drawing.Color.OrangeRed
		Me.mpbTillNext.BarColor2 = System.Drawing.Color.FromArgb(CType(128, Byte), CType(30, Byte), CType(144, Byte), CType(255, Byte))
		Me.mpbTillNext.Font = New System.Drawing.Font("Comic Sans MS", 36.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
		Me.mpbTillNext.Gradient = CountDown.myProgressBar.GradientEnum.Rainbow
		Me.mpbTillNext.GradientAngle = 0.0!
		Me.mpbTillNext.Hatch = CountDown.myProgressBar.HatchEnum.None
		Me.mpbTillNext.Location = New System.Drawing.Point(80, 128)
		Me.mpbTillNext.Name = "mpbTillNext"
		Me.mpbTillNext.Size = New System.Drawing.Size(512, 112)
		Me.mpbTillNext.TabIndex = 4
		Me.mpbTillNext.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
		Me.mpbTillNext.TextColor = System.Drawing.SystemColors.ControlText
		Me.mpbTillNext.Value = CType(85, Long)
		'
		'tbpSettings
		'
		Me.tbpSettings.Controls.Add(Me.lblMinutes3)
		Me.tbpSettings.Controls.Add(Me.lblMinutes2)
		Me.tbpSettings.Controls.Add(Me.lblMinutes1)
		Me.tbpSettings.Controls.Add(Me.lblHours)
		Me.tbpSettings.Controls.Add(Me.nudBreak2)
		Me.tbpSettings.Controls.Add(Me.nudLunch)
		Me.tbpSettings.Controls.Add(Me.nudBreak1)
		Me.tbpSettings.Controls.Add(Me.nudDay)
		Me.tbpSettings.Controls.Add(Me.txtEnd)
		Me.tbpSettings.Controls.Add(Me.lblDuration)
		Me.tbpSettings.Controls.Add(Me.lblStartAt)
		Me.tbpSettings.Controls.Add(Me.lblEnd)
		Me.tbpSettings.Controls.Add(Me.dtpBreak2)
		Me.tbpSettings.Controls.Add(Me.lblBreak2)
		Me.tbpSettings.Controls.Add(Me.dtpLunch)
		Me.tbpSettings.Controls.Add(Me.lblLunch)
		Me.tbpSettings.Controls.Add(Me.dtpBreak1)
		Me.tbpSettings.Controls.Add(Me.lblBreak1)
		Me.tbpSettings.Controls.Add(Me.dtpStart)
		Me.tbpSettings.Controls.Add(Me.lblStart)
		Me.tbpSettings.Controls.Add(Me.chkText)
		Me.tbpSettings.Location = New System.Drawing.Point(4, 24)
		Me.tbpSettings.Name = "tbpSettings"
		Me.tbpSettings.Size = New System.Drawing.Size(600, 252)
		Me.tbpSettings.TabIndex = 1
		Me.tbpSettings.Text = "Time Settings"
		'
		'lblMinutes3
		'
		Me.lblMinutes3.Location = New System.Drawing.Point(256, 104)
		Me.lblMinutes3.Name = "lblMinutes3"
		Me.lblMinutes3.Size = New System.Drawing.Size(48, 21)
		Me.lblMinutes3.TabIndex = 15
		Me.lblMinutes3.Text = "Minutes"
		Me.lblMinutes3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
		'
		'lblMinutes2
		'
		Me.lblMinutes2.Location = New System.Drawing.Point(256, 80)
		Me.lblMinutes2.Name = "lblMinutes2"
		Me.lblMinutes2.Size = New System.Drawing.Size(48, 21)
		Me.lblMinutes2.TabIndex = 11
		Me.lblMinutes2.Text = "Minutes"
		Me.lblMinutes2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
		'
		'lblMinutes1
		'
		Me.lblMinutes1.Location = New System.Drawing.Point(256, 56)
		Me.lblMinutes1.Name = "lblMinutes1"
		Me.lblMinutes1.Size = New System.Drawing.Size(48, 21)
		Me.lblMinutes1.TabIndex = 7
		Me.lblMinutes1.Text = "Minutes"
		Me.lblMinutes1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
		'
		'lblHours
		'
		Me.lblHours.Location = New System.Drawing.Point(256, 32)
		Me.lblHours.Name = "lblHours"
		Me.lblHours.Size = New System.Drawing.Size(48, 21)
		Me.lblHours.TabIndex = 3
		Me.lblHours.Text = "Hours"
		Me.lblHours.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
		'
		'nudBreak2
		'
		Me.nudBreak2.Location = New System.Drawing.Point(208, 104)
		Me.nudBreak2.Maximum = New Decimal(New Integer() {60, 0, 0, 0})
		Me.nudBreak2.Minimum = New Decimal(New Integer() {1, 0, 0, 0})
		Me.nudBreak2.Name = "nudBreak2"
		Me.nudBreak2.Size = New System.Drawing.Size(48, 21)
		Me.nudBreak2.TabIndex = 14
		Me.nudBreak2.Value = New Decimal(New Integer() {1, 0, 0, 0})
		'
		'nudLunch
		'
		Me.nudLunch.Location = New System.Drawing.Point(208, 80)
		Me.nudLunch.Maximum = New Decimal(New Integer() {120, 0, 0, 0})
		Me.nudLunch.Minimum = New Decimal(New Integer() {1, 0, 0, 0})
		Me.nudLunch.Name = "nudLunch"
		Me.nudLunch.Size = New System.Drawing.Size(48, 21)
		Me.nudLunch.TabIndex = 10
		Me.nudLunch.Value = New Decimal(New Integer() {1, 0, 0, 0})
		'
		'nudBreak1
		'
		Me.nudBreak1.Location = New System.Drawing.Point(208, 56)
		Me.nudBreak1.Maximum = New Decimal(New Integer() {60, 0, 0, 0})
		Me.nudBreak1.Minimum = New Decimal(New Integer() {1, 0, 0, 0})
		Me.nudBreak1.Name = "nudBreak1"
		Me.nudBreak1.Size = New System.Drawing.Size(48, 21)
		Me.nudBreak1.TabIndex = 6
		Me.nudBreak1.Value = New Decimal(New Integer() {1, 0, 0, 0})
		'
		'nudDay
		'
		Me.nudDay.Location = New System.Drawing.Point(208, 32)
		Me.nudDay.Maximum = New Decimal(New Integer() {12, 0, 0, 0})
		Me.nudDay.Minimum = New Decimal(New Integer() {1, 0, 0, 0})
		Me.nudDay.Name = "nudDay"
		Me.nudDay.Size = New System.Drawing.Size(48, 21)
		Me.nudDay.TabIndex = 2
		Me.nudDay.Value = New Decimal(New Integer() {1, 0, 0, 0})
		'
		'txtEnd
		'
		Me.txtEnd.Location = New System.Drawing.Point(120, 128)
		Me.txtEnd.Name = "txtEnd"
		Me.txtEnd.ReadOnly = True
		Me.txtEnd.Size = New System.Drawing.Size(80, 21)
		Me.txtEnd.TabIndex = 17
		Me.txtEnd.TabStop = False
		Me.txtEnd.Text = "TextBox5"
		'
		'lblDuration
		'
		Me.lblDuration.Location = New System.Drawing.Point(208, 8)
		Me.lblDuration.Name = "lblDuration"
		Me.lblDuration.Size = New System.Drawing.Size(96, 23)
		Me.lblDuration.TabIndex = 1
		Me.lblDuration.Text = "Duration"
		Me.lblDuration.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
		'
		'lblStartAt
		'
		Me.lblStartAt.Location = New System.Drawing.Point(120, 8)
		Me.lblStartAt.Name = "lblStartAt"
		Me.lblStartAt.Size = New System.Drawing.Size(72, 23)
		Me.lblStartAt.TabIndex = 0
		Me.lblStartAt.Text = "Starts At"
		Me.lblStartAt.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
		'
		'lblEnd
		'
		Me.lblEnd.Location = New System.Drawing.Point(8, 128)
		Me.lblEnd.Name = "lblEnd"
		Me.lblEnd.TabIndex = 16
		Me.lblEnd.Text = "End:"
		Me.lblEnd.TextAlign = System.Drawing.ContentAlignment.MiddleRight
		'
		'dtpBreak2
		'
		Me.dtpBreak2.CustomFormat = "hh:mm tt"
		Me.dtpBreak2.Format = System.Windows.Forms.DateTimePickerFormat.Custom
		Me.dtpBreak2.Location = New System.Drawing.Point(120, 104)
		Me.dtpBreak2.Name = "dtpBreak2"
		Me.dtpBreak2.ShowUpDown = True
		Me.dtpBreak2.Size = New System.Drawing.Size(80, 21)
		Me.dtpBreak2.TabIndex = 13
		'
		'lblBreak2
		'
		Me.lblBreak2.Location = New System.Drawing.Point(8, 104)
		Me.lblBreak2.Name = "lblBreak2"
		Me.lblBreak2.TabIndex = 12
		Me.lblBreak2.Text = "Break-2:"
		Me.lblBreak2.TextAlign = System.Drawing.ContentAlignment.MiddleRight
		'
		'dtpLunch
		'
		Me.dtpLunch.CustomFormat = "hh:mm tt"
		Me.dtpLunch.Format = System.Windows.Forms.DateTimePickerFormat.Custom
		Me.dtpLunch.Location = New System.Drawing.Point(120, 80)
		Me.dtpLunch.Name = "dtpLunch"
		Me.dtpLunch.ShowUpDown = True
		Me.dtpLunch.Size = New System.Drawing.Size(80, 21)
		Me.dtpLunch.TabIndex = 9
		'
		'lblLunch
		'
		Me.lblLunch.Location = New System.Drawing.Point(8, 80)
		Me.lblLunch.Name = "lblLunch"
		Me.lblLunch.TabIndex = 8
		Me.lblLunch.Text = "Lunch:"
		Me.lblLunch.TextAlign = System.Drawing.ContentAlignment.MiddleRight
		'
		'dtpBreak1
		'
		Me.dtpBreak1.CustomFormat = "hh:mm tt"
		Me.dtpBreak1.Format = System.Windows.Forms.DateTimePickerFormat.Custom
		Me.dtpBreak1.Location = New System.Drawing.Point(120, 56)
		Me.dtpBreak1.Name = "dtpBreak1"
		Me.dtpBreak1.ShowUpDown = True
		Me.dtpBreak1.Size = New System.Drawing.Size(80, 21)
		Me.dtpBreak1.TabIndex = 5
		'
		'lblBreak1
		'
		Me.lblBreak1.Location = New System.Drawing.Point(8, 56)
		Me.lblBreak1.Name = "lblBreak1"
		Me.lblBreak1.TabIndex = 4
		Me.lblBreak1.Text = "Break-1:"
		Me.lblBreak1.TextAlign = System.Drawing.ContentAlignment.MiddleRight
		'
		'dtpStart
		'
		Me.dtpStart.CustomFormat = "hh:mm tt"
		Me.dtpStart.Format = System.Windows.Forms.DateTimePickerFormat.Custom
		Me.dtpStart.Location = New System.Drawing.Point(120, 32)
		Me.dtpStart.Name = "dtpStart"
		Me.dtpStart.ShowUpDown = True
		Me.dtpStart.Size = New System.Drawing.Size(80, 21)
		Me.dtpStart.TabIndex = 1
		'
		'lblStart
		'
		Me.lblStart.Location = New System.Drawing.Point(8, 32)
		Me.lblStart.Name = "lblStart"
		Me.lblStart.TabIndex = 2
		Me.lblStart.Text = "Start:"
		Me.lblStart.TextAlign = System.Drawing.ContentAlignment.MiddleRight
		'
		'chkText
		'
		Me.chkText.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
		Me.chkText.Checked = True
		Me.chkText.CheckState = System.Windows.Forms.CheckState.Checked
		Me.chkText.Location = New System.Drawing.Point(464, 8)
		Me.chkText.Name = "chkText"
		Me.chkText.Size = New System.Drawing.Size(128, 24)
		Me.chkText.TabIndex = 18
		Me.chkText.Text = "Display Time Text"
		'
		'tbpWorkColor
		'
		Me.tbpWorkColor.Controls.Add(Me.btnBarEnd)
		Me.tbpWorkColor.Controls.Add(Me.btnBarStart)
		Me.tbpWorkColor.Controls.Add(Me.btnForground)
		Me.tbpWorkColor.Controls.Add(Me.btnBackground)
		Me.tbpWorkColor.Controls.Add(Me.nudAlpha)
		Me.tbpWorkColor.Controls.Add(Me.lblAlpha)
		Me.tbpWorkColor.Controls.Add(Me.cmbBars)
		Me.tbpWorkColor.Controls.Add(Me.lblProgressBar)
		Me.tbpWorkColor.Controls.Add(Me.btnRestore)
		Me.tbpWorkColor.Controls.Add(Me.btnSave)
		Me.tbpWorkColor.Controls.Add(Me.btnFont)
		Me.tbpWorkColor.Controls.Add(Me.lblForground)
		Me.tbpWorkColor.Controls.Add(Me.mpbBar)
		Me.tbpWorkColor.Controls.Add(Me.chkDisplayText)
		Me.tbpWorkColor.Controls.Add(Me.nudGrdAngle)
		Me.tbpWorkColor.Controls.Add(Me.lblGrdAngle)
		Me.tbpWorkColor.Controls.Add(Me.chkAngle)
		Me.tbpWorkColor.Controls.Add(Me.chkWholebar)
		Me.tbpWorkColor.Controls.Add(Me.cmbHatch)
		Me.tbpWorkColor.Controls.Add(Me.lblHatch)
		Me.tbpWorkColor.Controls.Add(Me.cmbGrdStyle)
		Me.tbpWorkColor.Controls.Add(Me.lblGrdStyle)
		Me.tbpWorkColor.Controls.Add(Me.lblGrdEnd)
		Me.tbpWorkColor.Controls.Add(Me.lblGrdStart)
		Me.tbpWorkColor.Controls.Add(Me.lblBackground)
		Me.tbpWorkColor.Location = New System.Drawing.Point(4, 24)
		Me.tbpWorkColor.Name = "tbpWorkColor"
		Me.tbpWorkColor.Size = New System.Drawing.Size(600, 252)
		Me.tbpWorkColor.TabIndex = 2
		Me.tbpWorkColor.Text = "Progress Bar Settings"
		'
		'btnBarEnd
		'
		Me.btnBarEnd.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
					Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
		Me.btnBarEnd.FlatStyle = System.Windows.Forms.FlatStyle.Flat
		Me.btnBarEnd.Location = New System.Drawing.Point(112, 136)
		Me.btnBarEnd.Name = "btnBarEnd"
		Me.btnBarEnd.Size = New System.Drawing.Size(64, 23)
		Me.btnBarEnd.TabIndex = 9
		'
		'btnBarStart
		'
		Me.btnBarStart.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
					Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
		Me.btnBarStart.FlatStyle = System.Windows.Forms.FlatStyle.Flat
		Me.btnBarStart.Location = New System.Drawing.Point(112, 104)
		Me.btnBarStart.Name = "btnBarStart"
		Me.btnBarStart.Size = New System.Drawing.Size(64, 23)
		Me.btnBarStart.TabIndex = 7
		'
		'btnForground
		'
		Me.btnForground.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
					Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
		Me.btnForground.FlatStyle = System.Windows.Forms.FlatStyle.Flat
		Me.btnForground.Location = New System.Drawing.Point(112, 72)
		Me.btnForground.Name = "btnForground"
		Me.btnForground.Size = New System.Drawing.Size(64, 23)
		Me.btnForground.TabIndex = 5
		'
		'btnBackground
		'
		Me.btnBackground.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
					Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
		Me.btnBackground.FlatStyle = System.Windows.Forms.FlatStyle.Flat
		Me.btnBackground.Location = New System.Drawing.Point(112, 40)
		Me.btnBackground.Name = "btnBackground"
		Me.btnBackground.Size = New System.Drawing.Size(64, 23)
		Me.btnBackground.TabIndex = 3
		'
		'nudAlpha
		'
		Me.nudAlpha.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
		Me.nudAlpha.Location = New System.Drawing.Point(288, 136)
		Me.nudAlpha.Maximum = New Decimal(New Integer() {255, 0, 0, 0})
		Me.nudAlpha.Name = "nudAlpha"
		Me.nudAlpha.Size = New System.Drawing.Size(64, 21)
		Me.nudAlpha.TabIndex = 17
		Me.nudAlpha.Value = New Decimal(New Integer() {255, 0, 0, 0})
		'
		'lblAlpha
		'
		Me.lblAlpha.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
		Me.lblAlpha.Location = New System.Drawing.Point(192, 136)
		Me.lblAlpha.Name = "lblAlpha"
		Me.lblAlpha.Size = New System.Drawing.Size(88, 23)
		Me.lblAlpha.TabIndex = 16
		Me.lblAlpha.Text = "Alpha Blend"
		Me.lblAlpha.TextAlign = System.Drawing.ContentAlignment.MiddleRight
		'
		'cmbBars
		'
		Me.cmbBars.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
					Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
		Me.cmbBars.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
		Me.cmbBars.Items.AddRange(New Object() {"Work Day", "Till Next Break", "Break/Lunch Time"})
		Me.cmbBars.Location = New System.Drawing.Point(184, 8)
		Me.cmbBars.Name = "cmbBars"
		Me.cmbBars.Size = New System.Drawing.Size(216, 23)
		Me.cmbBars.TabIndex = 1
		'
		'lblProgressBar
		'
		Me.lblProgressBar.Location = New System.Drawing.Point(72, 8)
		Me.lblProgressBar.Name = "lblProgressBar"
		Me.lblProgressBar.TabIndex = 0
		Me.lblProgressBar.Text = "Progress Bar"
		Me.lblProgressBar.TextAlign = System.Drawing.ContentAlignment.MiddleRight
		'
		'btnRestore
		'
		Me.btnRestore.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
		Me.btnRestore.Location = New System.Drawing.Point(512, 136)
		Me.btnRestore.Name = "btnRestore"
		Me.btnRestore.TabIndex = 23
		Me.btnRestore.Text = "Restore"
		'
		'btnSave
		'
		Me.btnSave.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
		Me.btnSave.Location = New System.Drawing.Point(432, 136)
		Me.btnSave.Name = "btnSave"
		Me.btnSave.TabIndex = 22
		Me.btnSave.Text = "Save"
		'
		'btnFont
		'
		Me.btnFont.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
		Me.btnFont.Location = New System.Drawing.Point(472, 8)
		Me.btnFont.Name = "btnFont"
		Me.btnFont.TabIndex = 18
		Me.btnFont.Text = "Font"
		'
		'lblForground
		'
		Me.lblForground.Location = New System.Drawing.Point(8, 72)
		Me.lblForground.Name = "lblForground"
		Me.lblForground.TabIndex = 4
		Me.lblForground.Text = "Text Color"
		Me.lblForground.TextAlign = System.Drawing.ContentAlignment.MiddleRight
		'
		'mpbBar
		'
		Me.mpbBar.Alpha = CType(0, Byte)
		Me.mpbBar.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
					Or System.Windows.Forms.AnchorStyles.Left) _
					Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
		Me.mpbBar.BackColor = System.Drawing.SystemColors.Control
		Me.mpbBar.DisplayText = False
		Me.mpbBar.Gradient = CountDown.myProgressBar.GradientEnum.None
		Me.mpbBar.GradientAngle = 0.0!
		Me.mpbBar.Hatch = CountDown.myProgressBar.HatchEnum.None
		Me.mpbBar.Location = New System.Drawing.Point(8, 168)
		Me.mpbBar.Name = "mpbBar"
		Me.mpbBar.Size = New System.Drawing.Size(584, 80)
		Me.mpbBar.TabIndex = 18
		Me.mpbBar.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
		Me.mpbBar.TextColor = System.Drawing.SystemColors.ControlText
		'
		'chkDisplayText
		'
		Me.chkDisplayText.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
		Me.chkDisplayText.Location = New System.Drawing.Point(456, 104)
		Me.chkDisplayText.Name = "chkDisplayText"
		Me.chkDisplayText.Size = New System.Drawing.Size(128, 24)
		Me.chkDisplayText.TabIndex = 21
		Me.chkDisplayText.Text = "Display Time Text"
		'
		'nudGrdAngle
		'
		Me.nudGrdAngle.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
		Me.nudGrdAngle.Location = New System.Drawing.Point(288, 104)
		Me.nudGrdAngle.Maximum = New Decimal(New Integer() {360, 0, 0, 0})
		Me.nudGrdAngle.Minimum = New Decimal(New Integer() {360, 0, 0, -2147483648})
		Me.nudGrdAngle.Name = "nudGrdAngle"
		Me.nudGrdAngle.Size = New System.Drawing.Size(64, 21)
		Me.nudGrdAngle.TabIndex = 15
		'
		'lblGrdAngle
		'
		Me.lblGrdAngle.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
		Me.lblGrdAngle.Location = New System.Drawing.Point(192, 104)
		Me.lblGrdAngle.Name = "lblGrdAngle"
		Me.lblGrdAngle.Size = New System.Drawing.Size(88, 23)
		Me.lblGrdAngle.TabIndex = 14
		Me.lblGrdAngle.Text = "Gradient Angle"
		Me.lblGrdAngle.TextAlign = System.Drawing.ContentAlignment.MiddleRight
		'
		'chkAngle
		'
		Me.chkAngle.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
		Me.chkAngle.Location = New System.Drawing.Point(456, 72)
		Me.chkAngle.Name = "chkAngle"
		Me.chkAngle.Size = New System.Drawing.Size(128, 24)
		Me.chkAngle.TabIndex = 20
		Me.chkAngle.Text = "Angle is scalable"
		'
		'chkWholebar
		'
		Me.chkWholebar.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
		Me.chkWholebar.Location = New System.Drawing.Point(456, 40)
		Me.chkWholebar.Name = "chkWholebar"
		Me.chkWholebar.Size = New System.Drawing.Size(128, 24)
		Me.chkWholebar.TabIndex = 19
		Me.chkWholebar.Text = "Gradient Wholebar"
		'
		'cmbHatch
		'
		Me.cmbHatch.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
		Me.cmbHatch.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
		Me.cmbHatch.Location = New System.Drawing.Point(288, 72)
		Me.cmbHatch.Name = "cmbHatch"
		Me.cmbHatch.Size = New System.Drawing.Size(152, 23)
		Me.cmbHatch.TabIndex = 13
		'
		'lblHatch
		'
		Me.lblHatch.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
		Me.lblHatch.Location = New System.Drawing.Point(192, 72)
		Me.lblHatch.Name = "lblHatch"
		Me.lblHatch.Size = New System.Drawing.Size(88, 23)
		Me.lblHatch.TabIndex = 12
		Me.lblHatch.Text = "Hatch Style"
		Me.lblHatch.TextAlign = System.Drawing.ContentAlignment.MiddleRight
		'
		'cmbGrdStyle
		'
		Me.cmbGrdStyle.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
		Me.cmbGrdStyle.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
		Me.cmbGrdStyle.Location = New System.Drawing.Point(288, 40)
		Me.cmbGrdStyle.Name = "cmbGrdStyle"
		Me.cmbGrdStyle.Size = New System.Drawing.Size(152, 23)
		Me.cmbGrdStyle.TabIndex = 11
		'
		'lblGrdStyle
		'
		Me.lblGrdStyle.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
		Me.lblGrdStyle.Location = New System.Drawing.Point(192, 40)
		Me.lblGrdStyle.Name = "lblGrdStyle"
		Me.lblGrdStyle.Size = New System.Drawing.Size(88, 23)
		Me.lblGrdStyle.TabIndex = 10
		Me.lblGrdStyle.Text = "Gradient Style"
		Me.lblGrdStyle.TextAlign = System.Drawing.ContentAlignment.MiddleRight
		'
		'lblGrdEnd
		'
		Me.lblGrdEnd.Location = New System.Drawing.Point(8, 136)
		Me.lblGrdEnd.Name = "lblGrdEnd"
		Me.lblGrdEnd.TabIndex = 8
		Me.lblGrdEnd.Text = "Gradient End"
		Me.lblGrdEnd.TextAlign = System.Drawing.ContentAlignment.MiddleRight
		'
		'lblGrdStart
		'
		Me.lblGrdStart.Location = New System.Drawing.Point(8, 104)
		Me.lblGrdStart.Name = "lblGrdStart"
		Me.lblGrdStart.TabIndex = 6
		Me.lblGrdStart.Text = "Gradient Start"
		Me.lblGrdStart.TextAlign = System.Drawing.ContentAlignment.MiddleRight
		'
		'lblBackground
		'
		Me.lblBackground.Location = New System.Drawing.Point(8, 40)
		Me.lblBackground.Name = "lblBackground"
		Me.lblBackground.TabIndex = 2
		Me.lblBackground.Text = "Background"
		Me.lblBackground.TextAlign = System.Drawing.ContentAlignment.MiddleRight
		'
		'tmrWork
		'
		Me.tmrWork.SynchronizingObject = Me
		'
		'tmrDemo
		'
		Me.tmrDemo.Interval = 10
		'
		'dlgColor
		'
		Me.dlgColor.AnyColor = True
		Me.dlgColor.FullOpen = True
		'
		'frmWorkDay
		'
		Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
		Me.CancelButton = Me.btnExit
		Me.ClientSize = New System.Drawing.Size(624, 325)
		Me.Controls.Add(Me.tbcWorkDay)
		Me.Controls.Add(Me.btnExit)
		Me.Font = New System.Drawing.Font("Arial", 9.0!)
		Me.Name = "frmWorkDay"
		Me.ShowInTaskbar = False
		Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
		Me.Text = "My Work Day"
		Me.WindowState = System.Windows.Forms.FormWindowState.Minimized
		CType(Me.tmrWorkDay, System.ComponentModel.ISupportInitialize).EndInit()
		CType(Me.tmrBreak, System.ComponentModel.ISupportInitialize).EndInit()
		Me.tbcWorkDay.ResumeLayout(False)
		Me.tbpWorkDay.ResumeLayout(False)
		Me.tbpSettings.ResumeLayout(False)
		CType(Me.nudBreak2, System.ComponentModel.ISupportInitialize).EndInit()
		CType(Me.nudLunch, System.ComponentModel.ISupportInitialize).EndInit()
		CType(Me.nudBreak1, System.ComponentModel.ISupportInitialize).EndInit()
		CType(Me.nudDay, System.ComponentModel.ISupportInitialize).EndInit()
		Me.tbpWorkColor.ResumeLayout(False)
		CType(Me.nudAlpha, System.ComponentModel.ISupportInitialize).EndInit()
		CType(Me.nudGrdAngle, System.ComponentModel.ISupportInitialize).EndInit()
		CType(Me.tmrWork, System.ComponentModel.ISupportInitialize).EndInit()
		Me.ResumeLayout(False)

	End Sub

#End Region

#Region " Form Events "
	Private Sub frm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
		thw = New Thread(AddressOf DoNothing)
		thb = New Thread(AddressOf DoNothing)
		thw.Name = "WorkDayThread"
		thb.Name = "BreakThread"
		thw.Start()
		thb.Start()
		Dim thisExe As System.Reflection.Assembly
		thisExe = System.Reflection.Assembly.GetExecutingAssembly()
		Dim file As System.IO.Stream = thisExe.GetManifestResourceStream("CountDown.Hr0.bmp")
		Dim bmp As Bitmap = Image.FromStream(file)
		icn = Icon.FromHandle(bmp.GetHicon)
		file.Close()
		bmp.Dispose()
		Me.SysIcon.Icon = icn
		Me.Icon = icn
		off = New TimeSpan(0)
		Dim th As Thread = New Thread(AddressOf get_nist_time)
		th.Name = "NistThread"
		th.Start()
		'get_nist_time()

		'Me.SysIcon.ContextMenu = Me.SysMenu
		Me.dtpStart.Value = New DateTime(Now.Year, Now.Month, Now.Day, 8, 0, 0)
		Me.dtpBreak1.Value = New DateTime(Now.Year, Now.Month, Now.Day, 10, 0, 0)
		Me.dtpLunch.Value = New DateTime(Now.Year, Now.Month, Now.Day, 12, 0, 0)
		Me.dtpBreak2.Value = New DateTime(Now.Year, Now.Month, Now.Day, 15, 0, 0)
		Me.nudDay.Text = 8
		Me.nudBreak1.Text = 15
		Me.nudLunch.Text = 60
		Me.nudBreak2.Text = 1

		Me.cmbGrdStyle.Items.Clear()
		Me.cmbGrdStyle.Items.AddRange([Enum].GetNames(GetType(myProgressBar.GradientEnum)))
		Me.cmbHatch.Items.Clear()
		Me.cmbHatch.Items.AddRange([Enum].GetNames(GetType(myProgressBar.HatchEnum)))
		Me.cmbBars.SelectedIndex = 0
		If Me.mpbBar.Width > 5 Then Me.mpbBar.Maximum = Me.mpbBar.Width - 5
		Application.DoEvents()

		Me.UpdateTimes()
	End Sub

	Private Sub frm_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Closed
		Me.tmrBreak.Stop()
		Me.tmrWorkDay.Stop()
		Me.tmrWork.Stop()
		If thw.IsAlive Then thw.Abort()
		If thb.IsAlive Then thb.Abort()
		Me.SysIcon.Icon = Nothing
		End
	End Sub

	Private Sub frmWorkDay_Layout(ByVal sender As Object, ByVal e As System.Windows.Forms.LayoutEventArgs) Handles MyBase.Layout

		If e.AffectedProperty = "Bounds" And Me.WindowState <> FormWindowState.Minimized Then
			If Me.tbpWorkDay.Width > 0 And Me.tbpWorkDay.Height > 0 Then
				Me.mpbWork.Height = (Me.tbpWorkDay.Height - (Me.mpbWork.Top * 3)) \ 2
				Me.mpbWork.Width = Me.tbpWorkDay.Width - Me.mpbBreak.Left - 8

				Me.mpbBreak.SetBounds(Me.mpbWork.Left, (Me.mpbWork.Top * 2) + Me.mpbWork.Height, Me.mpbWork.Width, Me.mpbWork.Height)
				Me.mpbTillNext.SetBounds(Me.mpbWork.Left, (Me.mpbWork.Top * 2) + Me.mpbWork.Height, Me.mpbWork.Width, Me.mpbWork.Height)

			End If
		End If
		If Me.mpbBar.Width > 5 Then Me.mpbBar.Maximum = Me.mpbBar.Width - 5
		'Debug.WriteLine("Layout: " & e.AffectedProperty & " | WindowState: " & Me.WindowState.ToString)
		'Debug.WriteLine("Width: " & Me.mpbBreak.Width & " | Height: " & Me.mpbBreak.Height)
	End Sub

#End Region

#Region " Main Menu Events "

	Private Sub mnuExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuExit.Click, btnExit.Click
		Me.Close()
	End Sub

	Private Sub mnuHide_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuHide.Click
		Me.WindowState = FormWindowState.Minimized
	End Sub

	Private Sub SysIcon_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles SysIcon.DoubleClick, mnuShow.Click
		' Show the form when the user double clicks on the notify icon.

		' Set the WindowState to normal if the form is minimized.
		If (Me.WindowState = FormWindowState.Minimized) Then
			Me.WindowState = FormWindowState.Normal
		End If

		' Activate the form.
		Me.Activate()
	End Sub

#End Region

#Region " Timer Events "

	Private Sub tmrDemo_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrDemo.Tick
		Dim ts As TimeSpan
		If Me.mpbBar.Value < Me.mpbBar.Maximum Then
			Me.mpbBar.PerformStep()
		Else
			Me.mpbBar.Value = Me.mpbBar.Minimum
		End If
		ts = New TimeSpan(0, 0, 0, Me.mpbBar.Value, rnd.Next(0, 10) * 100)
		Me.mpbBar.Text = String.Format("{0:00}:{1:00}:{2:00}.{3:0}", ts.Hours, ts.Minutes, ts.Seconds, Math.Floor(ts.Milliseconds / 100))
	End Sub

	Private Sub tmrWorkDay_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) Handles tmrWorkDay.Elapsed
		Me.tmrWorkDay.Interval = 5 * 60 * 1000
		If wdr > 0 Then
			'thw = New Threading.Thread(AddressOf UpdateIcon)
			'thw.Start()
			UpdateIcon()
			GC.Collect()
		ElseIf myNow >= dtTimes(WorkDay.Start) Then
			wdc = 2
			wdr = 13
			Me.tmrWork.Start()
		Else
			GC.Collect()
		End If
	End Sub

	Private Sub tmrBreak_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) Handles tmrBreak.Elapsed
		Dim s As Integer
		Select Case cbr
			Case Breaks.Break1
				s = tsBreaks(Breaks.Break1).TotalSeconds \ 12
			Case Breaks.Break2
				s = tsBreaks(Breaks.Lunch).TotalSeconds \ 24
			Case Breaks.Lunch
				s = tsBreaks(Breaks.Break2).TotalSeconds \ 12
			Case Else
				Me.tmrBreak.Stop()
		End Select
		Me.tmrBreak.Interval = s * 1000
		thb = New Threading.Thread(AddressOf UpdateBreak)
		thb.Start()
	End Sub

	Private Sub tmrWork_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) Handles tmrWork.Elapsed
		Dim Cur As Date = myNow
		Dim ts As TimeSpan = dtTimes(WorkDay.GoHome).Subtract(Cur)
		Dim val As Long
		Dim mpb As myProgressBar

		If Me.chkText.Checked Then
			mpbWork.Text = String.Format("{0:00}:{1:00}:{2:00}.{3:0}", ts.Hours, ts.Minutes, ts.Seconds, Math.Floor(ts.Milliseconds / 100))
		Else
			mpbWork.Text = ""
		End If
		If Me.WindowState <> FormWindowState.Minimized Then mpbWork.Value = CLng(Cur.Subtract(dtTimes(WorkDay.Start)).TotalSeconds)
		Me.lblBreak.Text = "Next Break"
		mpb = Me.mpbTillNext
		Select Case cbr
			Case Breaks.None
				If Cur > dtTimes(WorkDay.Start) Then
					'If Cur < dtTimes(WorkDay.Break1) Then
					ts = dtTimes(WorkDay.Break1).Subtract(Cur)
					'End If
					mpb.Maximum = CLng(dtTimes(WorkDay.Break1).Subtract(dtTimes(WorkDay.Start)).TotalSeconds)
					val = CLng(Cur.Subtract(dtTimes(WorkDay.Start)).TotalSeconds)
				Else
					ts = New TimeSpan(0)
					val = 0
				End If
			Case Breaks.Break1
				If Cur < dtTimes(WorkDay.Break1).Add(tsBreaks(Breaks.Break1)) Then
					ts = dtTimes(WorkDay.Break1).Add(tsBreaks(Breaks.Break1)).Subtract(Cur)
					mpb = Me.mpbBreak
					mpb.Maximum = CLng(tsBreaks(Breaks.Break1).TotalSeconds)
					Me.lblBreak.Text = "Break Time"
				Else
					ts = dtTimes(WorkDay.Lunch).Subtract(Cur)
					mpb.Maximum = CLng(dtTimes(WorkDay.Lunch).Subtract(dtTimes(WorkDay.Break1)).TotalSeconds)
				End If
				val = CLng(Cur.Subtract(dtTimes(WorkDay.Break1)).TotalSeconds)
			Case Breaks.Lunch
				If Cur < dtTimes(WorkDay.Lunch).Add(tsBreaks(Breaks.Lunch)) Then
					ts = dtTimes(WorkDay.Lunch).Add(tsBreaks(Breaks.Lunch)).Subtract(Cur)
					mpb = Me.mpbBreak
					mpb.Maximum = CLng(tsBreaks(Breaks.Lunch).TotalSeconds)
					Me.lblBreak.Text = "Lunch Time"
				Else
					ts = dtTimes(WorkDay.Break2).Subtract(Cur)
					mpb.Maximum = CLng(dtTimes(WorkDay.Break2).Subtract(dtTimes(WorkDay.Lunch)).TotalSeconds)
				End If
				val = CLng(Cur.Subtract(dtTimes(WorkDay.Lunch)).TotalSeconds)
			Case Breaks.Break2
				If Cur < dtTimes(WorkDay.Break2).Add(tsBreaks(Breaks.Break2)) Then
					ts = dtTimes(WorkDay.Break2).Add(tsBreaks(Breaks.Break2)).Subtract(Cur)
					mpb = Me.mpbBreak
					mpb.Maximum = CLng(tsBreaks(Breaks.Break2).TotalSeconds)
					Me.lblBreak.Text = "Break Time"
				Else
					ts = dtTimes(WorkDay.GoHome).Subtract(Cur)
					mpb.Maximum = CLng(dtTimes(WorkDay.GoHome).Subtract(dtTimes(WorkDay.Break2)).TotalSeconds)
				End If
				val = CLng(Cur.Subtract(dtTimes(WorkDay.Break2)).TotalSeconds)
			Case Breaks.Home
				ts = New TimeSpan(0)
				val = 0
		End Select
		If ts.Ticks > 0 Then
			Me.SysIcon.Text = String.Format("{0:00}:{1:00}:{2:00}.{3:0}", ts.Hours, ts.Minutes, ts.Seconds, Math.Floor(ts.Milliseconds / 100))
			If Me.chkText.Checked Then
				mpb.Text = Me.SysIcon.Text
			Else
				mpb.Text = ""
			End If
			If Me.WindowState <> FormWindowState.Minimized Then mpb.Value = val
		Else
			mpb.Maximum = 0
			mpb.Value = 0
			Me.SysIcon.Text = "..."
			If wdr > 0 Then
				Me.tmrWork.Stop()
				'thw = New Threading.Thread(AddressOf UpdateIcon)
				'thw.Start()
				'Application.DoEvents()
				DisplayMsg()
				If cbr <> Breaks.Home Then Me.tmrWork.Start()
			End If
		End If
	End Sub

#End Region

#Region " Form Object Evetns "
	Private Sub PrintColor(ByVal c As Color)
		'Debug.WriteLine(c.Name & " : " & c.A & ", " & c.R & ", " & c.G & ", " & c.B & " -  " & c.ToString)
	End Sub

	Private Sub DoNothing()
	End Sub

	Private Sub dtpStart_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) _
	 Handles dtpStart.ValueChanged, dtpBreak1.ValueChanged, dtpLunch.ValueChanged, dtpBreak2.ValueChanged, _
	   nudDay.ValueChanged, nudBreak1.ValueChanged, nudLunch.ValueChanged, nudBreak2.ValueChanged
		If Me.Created And Me.tmrWorkDay.Enabled Then UpdateTimes()
	End Sub

	Private ReadOnly Property myNow() As Date
		Get
			Return Now.Add(off)
		End Get
	End Property

	Private Function GetDate(ByRef dtp As DateTimePicker) As DateTime
		Dim dt As Date = dtp.Value
		Dim Cur As Date = myNow
		If (Not dtp.Equals(Me.dtpStart)) AndAlso ((dtp.Value.Hour < Me.dtpStart.Value.Hour) Or _
		 ((dtp.Value.Hour = Me.dtpStart.Value.Hour) And (dtp.Value.Minute < Me.dtpStart.Value.Minute))) Then
			Return (New DateTime(Cur.Year, Cur.Month, Cur.Day, dt.Hour, dt.Minute, 0)).AddDays(1)
		Else
			Return New DateTime(Cur.Year, Cur.Month, Cur.Day, dt.Hour, dt.Minute, 0)
		End If
	End Function

	Private Sub get_nist_time()
		Dim dt As DateTime
		Dim x As Integer
		Dim d, l As Long
		Dim r As Random = New Random
		Dim sntp As InternetTime.SNTPClient = New InternetTime.SNTPClient("129.6.15.28")

		d = 0
		For x = 1 To 5
			If x > 1 Then System.Threading.Thread.CurrentThread.Sleep(r.Next(10, 2501))
			sntp.Connect(False)
			d += sntp.LocalClockOffset
		Next
		d = d \ 5
		'off = New TimeSpan(0, 0, 0, 0, d)
		off = New TimeSpan(0, 0, 0, 0, 0)
	End Sub


	Private Sub cmbBars_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbBars.SelectedIndexChanged, btnRestore.Click
		Select Case cmbBars.SelectedIndex
			Case 0
				myProgressBar.Copy(Me.mpbWork, Me.mpbBar)
			Case 1
				myProgressBar.Copy(Me.mpbTillNext, Me.mpbBar)
			Case 2
				myProgressBar.Copy(Me.mpbBreak, Me.mpbBar)
		End Select
		With Me.mpbBar
			Me.btnBackground.BackColor = .BackColor
			Me.btnForground.BackColor = .TextColor
			Me.btnBarStart.BackColor = .BarColor1
			Me.btnBarEnd.BackColor = .BarColor2
			Me.cmbGrdStyle.Text = .Gradient.ToString
			Me.cmbHatch.Text = .Hatch.ToString
			Me.nudGrdAngle.Value = .GradientAngle
			Me.chkAngle.Checked = .isAngleScaleable
			Me.chkDisplayText.Checked = .DisplayText
			Me.chkWholebar.Checked = .GradientWholeBar
			Me.nudAlpha.Value = .Alpha
			.Text = "0:12:34.5"
			.Minimum = 0
			.Value = 0
		End With
	End Sub

	Private Sub tbcWorkDay_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tbcWorkDay.SelectedIndexChanged
		tmrDemo.Enabled = tbcWorkDay.SelectedIndex = 2
	End Sub

	Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
		With Me.mpbBar
			.BackColor = Me.btnBackground.BackColor
			.TextColor = Me.btnForground.BackColor
			.BarColor1 = Me.btnBarStart.BackColor
			.BarColor2 = Me.btnBarEnd.BackColor
			.Gradient = Me.cmbGrdStyle.Text
			.Hatch = Me.cmbHatch.Text
			.GradientAngle = Me.nudGrdAngle.Value
			.isAngleScaleable = Me.chkAngle.Checked
			.DisplayText = Me.chkDisplayText.Checked
			.GradientWholeBar = Me.chkWholebar.Checked
		End With
		Select Case cmbBars.SelectedIndex
			Case 0
				myProgressBar.Copy(Me.mpbBar, Me.mpbWork)
			Case 1
				myProgressBar.Copy(Me.mpbBar, Me.mpbTillNext)
			Case 2
				myProgressBar.Copy(Me.mpbBar, Me.mpbBreak)
		End Select
	End Sub

	Private Sub picBackground_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBackground.Click
		Me.dlgColor.Color = Me.mpbBar.BackColor
		If Me.dlgColor.ShowDialog = DialogResult.OK Then
			Me.btnBackground.BackColor = Me.dlgColor.Color
			Me.mpbBar.BackColor = Me.btnBackground.BackColor
		End If
	End Sub

	Private Sub picForground_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnForground.Click
		Me.dlgColor.Color = Me.mpbBar.TextColor
		If Me.dlgColor.ShowDialog = DialogResult.OK Then
			Me.btnForground.BackColor = Me.dlgColor.Color
			Me.mpbBar.TextColor = Me.btnForground.BackColor
		End If
	End Sub

	Private Sub picBarStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBarStart.Click
		Me.dlgColor.Color = Me.mpbBar.BarColor1
		If Me.dlgColor.ShowDialog = DialogResult.OK Then
			Me.btnBarStart.BackColor = Me.dlgColor.Color
			Me.mpbBar.BarColor1 = Me.btnBarStart.BackColor
		End If
	End Sub

	Private Sub picBarEnd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBarEnd.Click
		Me.dlgColor.Color = Me.mpbBar.BarColor2
		If Me.dlgColor.ShowDialog = DialogResult.OK Then
			Me.btnBarEnd.BackColor = Me.dlgColor.Color
			Me.mpbBar.BarColor2 = Me.btnBarEnd.BackColor
		End If
	End Sub

	Private Sub cmbGrdStyle_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbGrdStyle.SelectedIndexChanged
		Me.mpbBar.Gradient = CType([Enum].Parse(GetType(myProgressBar.GradientEnum), Me.cmbGrdStyle.Text), myProgressBar.GradientEnum)
	End Sub

	Private Sub nudGrdAngle_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nudGrdAngle.ValueChanged, nudGrdAngle.Leave
		Me.mpbBar.GradientAngle = Me.nudGrdAngle.Value
	End Sub

	Private Sub nudAlpha_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nudAlpha.ValueChanged, nudAlpha.Leave
		Me.mpbBar.Alpha = Me.nudAlpha.Value
	End Sub

	Private Sub cmbHatch_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbHatch.SelectedIndexChanged
		Me.mpbBar.Hatch = CType([Enum].Parse(GetType(myProgressBar.HatchEnum), Me.cmbHatch.Text), myProgressBar.HatchEnum)
	End Sub

	Private Sub chkWholebar_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkWholebar.CheckedChanged
		Me.mpbBar.GradientWholeBar = Me.chkWholebar.Checked
	End Sub

	Private Sub chkAngle_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkAngle.CheckedChanged
		Me.mpbBar.isAngleScaleable = Me.chkAngle.Checked
	End Sub

	Private Sub chkDisplayText_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkDisplayText.CheckedChanged
		Me.mpbBar.DisplayText = Me.chkDisplayText.Checked
	End Sub

	Private Sub btnFont_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFont.Click
		Me.dlgFont.Font = Me.mpbBar.Font
		Me.dlgFont.Color = Me.mpbBar.ForeColor
		If Me.dlgFont.ShowDialog = DialogResult.OK Then
			Me.mpbBar.Font = Me.dlgFont.Font
			Me.btnForground.BackColor = Me.dlgFont.Color
			Me.mpbBar.ForeColor = Me.dlgFont.Color
		End If
	End Sub
#End Region

#Region " Update Procedures "
	Private Sub UpdateIcon()
		Dim bmp As Bitmap

		bmp = icn.ToBitmap
		bmp.SetPixel(wdc, wdr, Color.LightGreen)
		wdc += 1
		If wdc > 13 Then
			wdc = 2
			Select Case wdr
				Case 12
					wdr -= 2
				Case 9
					wdr -= 3
				Case 5
					wdr -= 2
				Case Else
					wdr -= 1
			End Select
		End If
		icn = Icon.FromHandle(bmp.GetHicon)
		Me.SysIcon.Icon = icn
		Me.Icon = icn
		bmp.Dispose()
	End Sub

	Private Sub DisplayMsg()
		Dim msg, title As String
		Dim Cur As Date = myNow
		Dim bmp As Bitmap

		msg = ""
		title = ""
		bmp = icn.ToBitmap
		If Cur >= dtTimes(WorkDay.Break1) AndAlso Cur < dtTimes(WorkDay.Break1).Add(tsBreaks(Breaks.Break1)) AndAlso cbr <> Breaks.Break1 Then
			For brc = 2 To 13
				bmp.SetPixel(brc, 11, Color.Red)
			Next
			cbr = Breaks.Break1
			brr = 11
			msg = "It's the first break of the day. Have fun for " & Me.tsBreaks(Breaks.Break1).TotalMinutes & " minutes."
			title = "Break Time"
		ElseIf Cur >= dtTimes(WorkDay.Lunch) AndAlso Cur < dtTimes(WorkDay.Lunch).Add(tsBreaks(Breaks.Lunch)) AndAlso cbr <> Breaks.Lunch Then
			For brc = 2 To 13
				bmp.SetPixel(brc, 8, Color.Red)
				bmp.SetPixel(brc, 7, Color.Red)
			Next
			cbr = Breaks.Lunch
			brr = 8
			msg = "It's lunch time. Go have some food and get some energy for another half of the day." & vbCrLf & "Enjoy your lunch and don't think about anything else for antoher " & tsBreaks(Breaks.Lunch).TotalMinutes & " minutes."
			title = "Lunch Time"
		ElseIf Cur >= dtTimes(WorkDay.Break2) AndAlso Cur < dtTimes(WorkDay.Break2).Add(tsBreaks(Breaks.Break2)) AndAlso cbr <> Breaks.Break2 Then
			For brc = 2 To 13
				bmp.SetPixel(brc, 4, Color.Red)
			Next
			cbr = Breaks.Break2
			brr = 4
			msg = "It's the final break of the day. Have fun for " & Me.tsBreaks(Breaks.Break2).TotalMinutes & " minutes."
			title = "Break Time"
		ElseIf Cur >= dtTimes(WorkDay.GoHome).Subtract(New TimeSpan(0, 2, 0)) AndAlso cbr <> Breaks.Home Then
			Me.tmrBreak.Stop()
			Me.tmrWorkDay.Stop()
			Me.tmrWork.Stop()
			For brc = 1 To 14
				bmp.SetPixel(brc, 1, Color.Red)
				bmp.SetPixel(brc, 14, Color.Red)
			Next
			For brr = 1 To 14
				bmp.SetPixel(1, brr, Color.Red)
				bmp.SetPixel(14, brr, Color.Red)
			Next
			cbr = Breaks.Home
			msg = "You have worked so hard today. Now it's time to go home." & vbCrLf & "Go home and have some rest and let me have it too. GOOOOOOD NIGHT!!!!"
			title = "End Of The Day"
		End If
		icn = Icon.FromHandle(bmp.GetHicon)
		bmp.Dispose()
		Me.SysIcon.Icon = icn
		Me.Icon = icn
		If msg.Length > 0 Then
			If cbr <> Breaks.Home And cbr <> Breaks.None Then
				brc = 2
				Me.mpbTillNext.Visible = False
				Me.mpbBreak.Visible = True
				Me.tmrBreak.Interval = 100
				Me.tmrBreak.Start()
			End If

			Dim frm As New frmBreak
			frm.TimeOut = 30
			frm.Title = title
			frm.Message = msg
			frm.EndIt = cbr = Breaks.Home
			frm.Show()
		End If
	End Sub

	Private Sub UpdateBreak()
		Dim bmp As Bitmap

		bmp = icn.ToBitmap
		bmp.SetPixel(brc, brr, Color.Blue)
		icn = Icon.FromHandle(bmp.GetHicon)
		bmp.Dispose()
		Me.SysIcon.Icon = icn
		Me.Icon = icn
		If cbr = Breaks.Lunch Then
			If brr = 7 Then
				brr = 8
				If brc < 8 Then
					brc = 15 - brc
				Else
					brc = 15 - brc + 1
				End If
			Else
				brr = 7
			End If
		Else
			brc += 1
			If wdc > 13 Then
				Me.tmrBreak.Stop()
				Me.mpbBreak.Visible = False
				Me.mpbTillNext.Visible = True
			End If
		End If
	End Sub

	Private Sub UpdateTimes()
		Me.tmrBreak.Stop()
		Me.tmrWorkDay.Stop()
		Me.tmrWork.Stop()
		If (Not thb Is Nothing) AndAlso thb.IsAlive Then thb.Abort()
		If (Not thw Is Nothing) AndAlso thw.IsAlive Then thw.Abort()

		Dim min As Integer
		Dim thisExe As System.Reflection.Assembly
		thisExe = System.Reflection.Assembly.GetExecutingAssembly()
		Dim file As System.IO.Stream = thisExe.GetManifestResourceStream("CountDown.Hr0.bmp")
		Dim bmp As Bitmap = Image.FromStream(file)
		icn = Icon.FromHandle(bmp.GetHicon)
		file.Close()
		bmp.Dispose()
		Me.SysIcon.Icon = icn
		Me.Icon = icn

		dtTimes(WorkDay.Start) = GetDate(Me.dtpStart)
		dtTimes(WorkDay.Break1) = GetDate(Me.dtpBreak1)
		dtTimes(WorkDay.Lunch) = GetDate(Me.dtpLunch)
		dtTimes(WorkDay.Break2) = GetDate(Me.dtpBreak2)
		tsBreaks(Breaks.Break1) = New TimeSpan(0, Me.nudBreak1.Value, 0)
		tsBreaks(Breaks.Lunch) = New TimeSpan(0, Me.nudLunch.Value, 0)
		tsBreaks(Breaks.Break2) = New TimeSpan(0, Me.nudBreak2.Value, 0)
		dtTimes(WorkDay.GoHome) = dtTimes(WorkDay.Start).AddHours(Me.nudDay.Value).Add(tsBreaks(Breaks.Lunch))
		Me.txtEnd.Text = dtTimes(WorkDay.GoHome).ToString("hh:mm tt")

		wdr = -1
		wdc = -1
		brr = -1
		brc = -1
		cbr = Breaks.None
		mpbWork.Minimum = 0
		mpbWork.Maximum = CLng(dtTimes(WorkDay.GoHome).Subtract(dtTimes(WorkDay.Start)).TotalSeconds)
		mpbWork.Value = 0
		mpbBreak.Maximum = 0
		mpbBreak.Value = 0
		Dim Cur As Date = myNow

		min = 0
		If Cur >= dtTimes(WorkDay.Start) Then
			Dim ts As TimeSpan = Cur.Subtract(dtTimes(WorkDay.Start))
			min = Math.Floor(ts.TotalMinutes)
			bmp = icn.ToBitmap
			wdc = 2
			wdr = 13
			mpbWork.Value = CLng(ts.TotalSeconds)

			Do While min > 4
				bmp.SetPixel(wdc, wdr, Color.Lime)
				wdc += 1
				min -= 5
				If wdc > 13 Then
					wdc = 2
					Select Case wdr
						Case 12
							wdr -= 2
							brr = 11
						Case 9
							wdr -= 3
							brr = 8
							min -= tsBreaks(Breaks.Lunch).TotalMinutes
						Case 5
							wdr -= 2
							brr = 4
						Case 2
							Exit Do
						Case Else
							wdr -= 1
					End Select
				End If
			Loop
			If brr > 0 Then
				If Cur >= dtTimes(WorkDay.Break1) Then
					SetBreakLine(bmp, 11, WorkDay.Break1, Breaks.Break1)
				End If
				If Cur >= dtTimes(WorkDay.Lunch) Then
					ts = Cur.Subtract(dtTimes(WorkDay.Lunch))
					Dim sec As Integer
					Dim s As Integer
					brr = 8
					If Math.Ceiling(ts.TotalMinutes) >= tsBreaks(Breaks.Lunch).TotalMinutes Then
						For brc = 2 To 13
							bmp.SetPixel(brc, 8, Color.Blue)
							bmp.SetPixel(brc, 7, Color.Blue)
						Next
					Else
						sec = Math.Ceiling(ts.TotalSeconds)
						s = sec \ 24
						For brc = 2 To 13
							bmp.SetPixel(brc, 8, Color.Red)
							bmp.SetPixel(brc, 7, Color.Red)
						Next
						brc = 2
						Do While sec >= s
							If brr = 7 Then
								bmp.SetPixel(brc, brr, Color.Blue)
								brr = 8
								If brc < 8 Then
									brc = 15 - brc
								Else
									brc = 15 - brc + 1
								End If
							Else
								bmp.SetPixel(brc, brr, Color.Blue)
								brr = 7
							End If
							sec -= s
						Loop
						Me.tmrBreak.Interval = s * 1000
						Me.tmrBreak.Start()
					End If
					cbr = Breaks.Lunch
				End If
				If Cur >= dtTimes(WorkDay.Break2) Then
					SetBreakLine(bmp, 4, WorkDay.Break2, Breaks.Break2)
				End If
			End If
			icn = Icon.FromHandle(bmp.GetHicon)
			bmp.Dispose()
			Me.SysIcon.Icon = icn
			Me.Icon = icn
			Me.tmrWork.Start()
		End If

		If (cbr = Breaks.Break1 AndAlso Cur >= dtTimes(WorkDay.Break1) AndAlso Cur < dtTimes(WorkDay.Break1).Add(tsBreaks(Breaks.Break1))) OrElse _
		 (cbr = Breaks.Lunch AndAlso Cur >= dtTimes(WorkDay.Lunch) AndAlso Cur < dtTimes(WorkDay.Lunch).Add(tsBreaks(Breaks.Lunch))) OrElse _
		 (cbr = Breaks.Break2 AndAlso Cur >= dtTimes(WorkDay.Break2) AndAlso Cur < dtTimes(WorkDay.Break2).Add(tsBreaks(Breaks.Break2))) Then
			Me.mpbTillNext.Visible = True
			Me.mpbBreak.Visible = False
		Else
			Me.mpbTillNext.Visible = True
			Me.mpbBreak.Visible = False
		End If

		Dim dt As DateTime
		Cur = myNow
		If Cur.Minute >= 55 Then
			dt = (New DateTime(Cur.Year, Cur.Month, Cur.Day, Cur.Hour, 0, 0, 0)).AddHours(1)
		Else
			min = Cur.Minute
			min += 5 - (min Mod 5)
			dt = New DateTime(Cur.Year, Cur.Month, Cur.Day, Cur.Hour, min, 0, 0)
		End If
		Me.tmrWorkDay.Interval = dt.Subtract(Cur).TotalMilliseconds - 10
		Me.tmrWorkDay.Start()
	End Sub

	Private Sub SetBreakLine(ByRef bmp As Bitmap, ByVal r As Integer, ByVal w As WorkDay, ByVal b As Breaks)
		Dim ts As TimeSpan = myNow.Subtract(dtTimes(w))
		Dim sec As Integer
		Dim s As Integer
		brr = r
		cbr = b
		If Math.Ceiling(ts.TotalMinutes) >= tsBreaks(b).TotalMinutes Then
			For brc = 2 To 13
				bmp.SetPixel(brc, brr, Color.Blue)
			Next
		Else
			sec = Math.Ceiling(ts.TotalSeconds)
			s = sec \ 12
			For brc = 2 To 13
				bmp.SetPixel(brc, brr, Color.Red)
			Next
			brc = 2
			Do While sec >= s
				bmp.SetPixel(brc, brr, Color.Blue)
				brc += 1
				sec -= s
			Loop
			Me.tmrBreak.Interval = s * 1000
			Me.tmrBreak.Start()
		End If
	End Sub
#End Region

End Class
