Imports System.IO
Imports System.Runtime.Serialization.Formatters.Binary
Imports System.Runtime.Serialization
Imports System.Collections
Imports System.Threading
Imports System.ComponentModel
Imports System.Windows.Forms
Public Class Form1
Dim thd1 As Threading.Thread
Private Sub btnDone2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDone2.Click
Dim result As String
Dim days As Integer
Dim txt As String = "Calculating Schedule"
Dim g As Graphics = pnlWoDur.CreateGraphics
Dim brush1 As New System.Drawing.SolidBrush(Color.Black)
Dim fntTxt As New Font("Times New Roman", 12, FontStyle.Bold)
Dim nn As Integer
Dim str As String
pnlWoDur.Controls.Add(newProgBar)
newProgBar.Top = 300
newProgBar.Left = 200
newProgBar.Anchor = AnchorStyles.Bottom
' Splitter2.Location = New Point(0, 488)
newProgBar.Label1.BackColor = Color.LightGray
newProgBar.lblTime.BackColor = Color.LightGray
newProgBar.lblLocation.BackColor = Color.LightGray
newProgBar.lblTime.Text = ""
newProgBar.lblLocation.Text = ""
'newProgBar.Refresh()
' Splitter2.Update()
newProgBar.step = 1
newProgBar.performStep()
newProgBar.Visible = True
newProgBar.CreateControl()
'newProgBar.lblTime.Text = Now
'newProgBar.lblTime.Refresh()
newProgBar.Refresh()
AddHandler newProgBar.btnAbort.Click, AddressOf abort
newProgBar.btnAbort.Focus()
Try
_schStDate = System.Convert.ToDateTime(txtSt2.Text)
_schEndDate = System.Convert.ToDateTime(txtEnd2.Text)
days = _schEndDate.Subtract(_schStDate).Days
Catch ex As Exception
result = MessageBox.Show("Dates Not Valid", "Date Error", MessageBoxButtons.RetryCancel)
If result = DialogResult.Retry Then
txtSt2.Text = ""
txtEnd2.Text = ""
newProgBar.Visible = False
Results1.lstResult2.Items.Clear()
'pnlWoDur.Visible = False
Exit Sub
ElseIf result = DialogResult.Cancel Then
txtSt2.Text = ""
txtEnd2.Text = ""
pnlSelTime.Visible = False
newProgBar.Visible = False
Results1.lstResult2.Items.Clear()
'pnlWoDur.Visible = False
Exit Sub
End If
End Try
If _schStDate > _schEndDate Then
result = MessageBox.Show("Dates Not Valid", "Date Error", MessageBoxButtons.RetryCancel)
If result = DialogResult.Retry Then
txtSt2.Text = ""
txtEnd2.Text = ""
newProgBar.Visible = False
Results1.lstResult2.Items.Clear()
Exit Sub
ElseIf result = DialogResult.Cancel Then
txtSt2.Text = ""
txtEnd2.Text = ""
pnlSelTime.Visible = False
newProgBar.Visible = False
Results1.lstResult2.Items.Clear()
Exit Sub
End If
End If
pnlSelTime.Visible = False
_okToPaint = True
'''-4-6-07
'g.Dispose()
'''
_isChanged = True
'''+/-6-1-07
[B] thd1 = New Threading.Thread(AddressOf Schedule)
thd1.Start()
[/B] '''
g.Dispose()
End Sub
Private Sub Schedule()
Dim inputStart As String
Dim inputEnd As String
'lstResult.Items.Clear()
If Results1.lstResult2.Items.Count > 0 Then
Results1.lstResult2.Items.Clear()
End If
'need to clear woColl and Res coll here
For i = WoColl.Count To 1 Step -1
WoColl.Remove(i)
Next
For i = ResColl.Count To 1 Step -1
ResColl.Remove(i)
Next
' abort()
_otDispCalc = False
ReDim _otStAry(-1) 'clear arrays
ReDim _otEndAry(-1)
ReDim _otYRefAry(-1)
ReDim _woTxtAry(-1)
ReDim _woGrAry(-1)
ReDim _WoLineAry(-1)
ReDim _empTxtAry(-1)
ReDim _empGrAry(-1)
ReDim _empRLineAry(-1)
ReDim _woGrAry2(-1)
ReDim _empGrAry2(-1)
_fillLocArys3 = True
_fillLocArys4 = True
_fillLocArys2 = True
_fillLocArys = True
_avTimeHash.Clear()
_initFloatBaseLine = Nothing
_initGroupK = Nothing
ReDim _dltMaxAry(-1)
_schStDateGhost = _schStDate
GetResInfo() 'adds to resColl
GetWoInfo() 'adds to woColl
'''+2-25-07
If WoColl.Count = 0 Then
Results1.lstResult2.Items.Add("No Work Orders Selected for Schedule")
dispSch1()
Exit Sub
End If
'''
CalculatePriority() 'calc fuzzy Pri
SetLogDep() 'sets woColl up in order of logic/dependencies
dispSch1() 'displays res/avtime/work sch
'''
newProgBar.performStep()
pnlWoDur.Controls.Remove(newProgBar)
'added 10-29-06 to make emp sch ref start correctly
_schStDate = _schStDateGhost
'
End Sub
end class