Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Drawing
Imports System.Threading
Imports System.Windows.Forms
Imports System.Math
Public Class Planet1Form
Inherits System.Windows.Forms.Form
' 23-12-2010 First Release - Copied from Planet
' 23-12-2010 Holdst (state) and Holdrev (Revolution) added - See StartAsyncButton
Private WithEvents startAsyncButton As System.Windows.Forms.Button
Private WithEvents cancelAsyncButton As System.Windows.Forms.Button
Private WithEvents endAsyncButton As System.Windows.Forms.Button
Private WithEvents MonitorButton As System.Windows.Forms.Button
Private WithEvents backgroundWorkerpp1 As System.ComponentModel.BackgroundWorker
Private WithEvents backgroundWorkerpp2 As System.ComponentModel.BackgroundWorker
Private WithEvents backgroundWorkerpp3 As System.ComponentModel.BackgroundWorker
Private WithEvents backgroundWorkerpp4 As System.ComponentModel.BackgroundWorker
Private WithEvents backgroundWorkerpp5 As System.ComponentModel.BackgroundWorker
Private StateL As System.Windows.Forms.Label
Private ProcL, nProcL, tdeltaL, seccntL, nplL As System.Windows.Forms.Label
Private Label1, Label2, Label3(2), Label4, Label5, Label6 As System.Windows.Forms.Label
Private ResultLabelpp1, ResultLabelpp2, ResultLabelpp3, ResultLabelpp4, ResultLabelpp5 As System.Windows.Forms.Label
Private StateTpp1, StateTpp2, StateTpp3, StateTpp4, StateTpp5 As System.Windows.Forms.TextBox
Private ProcTpp1, ProcTpp2, ProcTpp3, ProcTpp4, ProcTpp5 As System.Windows.Forms.TextBox
Private nProcT, tdeltaT, seccntT, nplT As System.Windows.Forms.TextBox
Private x1T, x2T, x3T, x4T As System.Windows.Forms.TextBox
Private y1T, y2T, y3T, y4T As System.Windows.Forms.TextBox
Private r1T, r2T, r3T, r4T As System.Windows.Forms.TextBox
Private pl1T, pl2T, pl3T, pl4T As System.Windows.Forms.TextBox
Private rev1T, rev2T, rev3T, rev4T As System.Windows.Forms.TextBox
Private hh, dhh, dd, ddd As Integer
Public x(idim), y(idim), z(idim)
Public vx(idim), vy(idim), vz(idim)
Public ax(idim), ay(idim), az(idim)
Public Rev(idim) As Integer ' revolution counter
Public pl_itercnt(idim) As Integer ' iteration counter per planet
Public m(idim)
Public itercnt(5), seccnt(5)
Public np, lnp, nplanets, nplanetsl, holdst, holdrev As Integer
Public state(5) As Integer
Const StartSt As Integer = 1, ActiveSt As Integer = 2, StopSt As Integer = 0, CancelSt As Integer = 3, Endst = 0
Const StartSt1 As Integer = 4
Const idim As Integer = 100
Public dt, dtl As Single ' delta t
Public Sub New()
InitializeComponent()
InitializeForm()
End Sub 'New
Private Sub startAsyncButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles startAsyncButton.Click
Dim mesg, answer As String
If holdst = 1 Then
holdst = 0
Exit Sub
End If
If backgroundWorkerpp1.IsBusy <> True Then
mesg = "Enter Hold Revolution"
answer = InputBox(mesg, "Hold rev", "-1")
holdrev = Val(answer)
' Start the asynchronous operation.
backgroundWorkerpp1.RunWorkerAsync()
np = 1
ProcTpp1.Text = 1
ResultLabelpp1.Text = " "
ResultLabelpp2.Text = " "
ResultLabelpp3.Text = " "
ResultLabelpp4.Text = " "
ResultLabelpp5.Text = " "
Else
If backgroundWorkerpp2.IsBusy <> True Then
' Start the asynchronous operation.
backgroundWorkerpp2.RunWorkerAsync()
np = 2
ProcTpp2.Text = 2
Else
If backgroundWorkerpp3.IsBusy <> True Then
' Start the asynchronous operation.
backgroundWorkerpp3.RunWorkerAsync()
np = 3
ProcTpp3.Text = 3
Else
If backgroundWorkerpp4.IsBusy <> True Then
' Start the asynchronous operation.
backgroundWorkerpp4.RunWorkerAsync()
np = 4
ProcTpp4.Text = 4
Else
If backgroundWorkerpp5.IsBusy <> True Then
' Start the asynchronous operation.
backgroundWorkerpp5.RunWorkerAsync()
np = 5
ProcTpp5.Text = 5
End If
End If
End If
End If
End If
NProcT.Text = np
For i = 0 To 5
itercnt(i) = -1 : seccnt(i) = -1
Next
End Sub
Private Sub cancelAsyncButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cancelAsyncButton.Click
If holdst > 0 Then holdst = 0
If np = 0 Then Exit Sub
' Update control panel
If np = 1 Then
ProcTpp1.Text = " "
Else
If np = 2 Then
ProcTpp2.Text = " "
Else
If np = 3 Then
ProcTpp3.Text = " "
Else
If np = 4 Then
ProcTpp4.Text = " "
Else
ProcTpp5.Text = " "
End If
End If
End If
End If
np = np - 1
NProcT.Text = np
For i = 0 To 5
itercnt(i) = -1 : seccnt(i) = -1
Next
End Sub
Private Sub EndSyncButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles endAsyncButton.Click
If holdst > 0 Then holdst = 0
If np > 0 Then
Debug.Print("Click End" + Str(np))
np = -1 ' np end state
Else
Test()
Debug.Print("Click End - no Error")
End
End If
End Sub
Private Sub MonitorButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MonitorButton.Click
StateTpp1.Text = state(1)
StateTpp2.Text = state(2)
StateTpp3.Text = state(3)
StateTpp4.Text = state(4)
StateTpp5.Text = state(5)
End Sub
' This event handler 1 is where the time-consuming work is done.
Private Sub backgroundWorker1_DoWork(ByVal sender As System.Object, _
ByVal e As DoWorkEventArgs) Handles backgroundWorkerpp1.DoWork
Dim worker As BackgroundWorker = CType(sender, BackgroundWorker)
Dim i, j, pstr As Integer
Dim sec1, sec2 As Integer
Dim dx, dy, dz, r2, r, a, ynew As Double
Dim b As String
sec1 = Second(Now)
pstr = 0 ' Processor start = 1-1
holdst = 0
b = tdeltaT.Text : dt = Val(b) ' Delta t
If dt = 0 Then dt = 0.02
b = nplT.Text : nplanets = Val(b)
If nplanets < 1 Then nplanets = 1
If nplanets > idim Then nplanets = idim
Debug.Print("PP1 Load " + Str(1) + " dt = " + Str(dt))
Init()
Do
' If pl_itercnt(0) Mod 10000 = 0 Then Debug.Print(Str(pl_itercnt(0)) + " x" + Str(x(1)) + Str(y(1)) + " v" + Str(vx(1)) + Str(vy(1)) + " a" + Str(ax(1)) + Str(ay(1)) + Str(az(1)))
If Rev(1) = holdrev Then
' Hold
holdst = 1
worker.ReportProgress(-1)
holdrev = -1
End If
If holdst = 1 Then
System.Threading.Thread.Sleep(1)
GoTo loop1
End If
itercnt(1) = itercnt(1) + 1
If np = -1 Then ' end state
If lnp > 0 Then
state(lnp) = CancelSt
lnp = lnp - 1
Else
np = 0
Debug.Print("PP1 End")
End
End If
Else
If np < lnp Then
state(lnp) = CancelSt
End If
lnp = np ' make local - Only P1
End If
If lnp > 1 Then state(2) = StartSt ' Start P1
If lnp > 2 Then state(3) = StartSt ' start p2
If lnp > 3 Then state(4) = StartSt ' Start P3
If lnp > 4 Then state(5) = StartSt ' Start P3
If lnp > 0 Then
For i = pstr To nplanets Step lnp
ax(i) = 0 : ay(i) = 0 : az(i) = 0
For j = 0 To nplanets
If i <> j Then
dx = x(i) - x(j) : dy = y(i) - y(j) : dz = z(i) - z(j)
r2 = (dx * dx + dy * dy + dz * dz) : r = Sqrt(r2)
a = m(j) / (r2 * r)
ax(i) = ax(i) + a * dx
ay(i) = ay(i) + a * dy
az(i) = az(i) + a * dz
End If
Next
vx(i) = vx(i) - ax(i) * dt
vy(i) = vy(i) - ay(i) * dt
vz(i) = vz(i) - az(i) * dt
Next
End If
If lnp > 1 Then
Do
Loop Until state(2) = StopSt And state(3) = StopSt And state(4) = StopSt And state(5) = StopSt
End If
If lnp > 1 Then state(2) = StartSt1 ' Start P1
If lnp > 2 Then state(3) = StartSt1 ' start p2
If lnp > 3 Then state(4) = StartSt1 ' Start P3
If lnp > 4 Then state(5) = StartSt1 ' Start P3
If lnp > 0 Then
For i = pstr To nplanets Step lnp
x(i) = x(i) + vx(i) * dt
ynew = y(i) + vy(i) * dt
If y(i) < 0 And ynew > 0 Then Rev(i) = Rev(i) + 1
y(i) = ynew
z(i) = z(i) + vz(i) * dt
pl_itercnt(i) = pl_itercnt(i) + 1
Next
End If
If lnp > 1 Then
Do
Loop Until state(2) = StopSt And state(3) = StopSt And state(4) = StopSt And state(5) = StopSt
' Test()
End If
If state(1) = CancelSt Then
e.Cancel = True
state(1) = Endst
Debug.Print("PP1 Cancelst " + Str(state(1)))
Exit Sub
Else
' Perform a time consuming operation and report progress.
sec2 = Second(Now)
If sec2 <> sec1 Then
System.Threading.Thread.Sleep(1)
sec1 = Second(Now)
seccnt(1) = seccnt(1) + 1
If seccnt(1) <= 0 Then
itercnt(1) = 0
worker.ReportProgress(0)
Else
worker.ReportProgress(itercnt(1) / seccnt(1))
End If
'cnt = 0
End If
End If
Loop1:
Loop
End Sub
' This event handler 1 updates the progress.
Private Sub backgroundWorkerpp1_ProgressChanged(ByVal sender As System.Object, _
ByVal e As ProgressChangedEventArgs) Handles backgroundWorkerpp1.ProgressChanged
Dim pl As Integer
Dim r As Double
If holdst = 0 Then
ResultLabelpp1.Text = (e.ProgressPercentage.ToString())
End If
seccntT.Text = Str(seccnt(1))
If dt <> dtl Then
tdeltaT.Text = dt ' delta t
dtl = dt
End If
If nplanets <> nplanetsl Then
nplT.Text = nplanets ' n of planets
nplanetsl = nplanets
End If
pl = Val(pl1T.Text)
If pl < 0 Then pl = 0
x1T.Text = Str(Int(x(pl)))
y1T.Text = Str(Int(y(pl)))
r = Sqrt(x(pl) * x(pl) + y(pl) * y(pl))
r1T.Text = r
rev1T.Text = Str(Rev(pl))
pl = Val(pl2T.Text)
If pl < 0 Then pl = 0
x2T.Text = Str(Int(x(pl)))
y2T.Text = Str(Int(y(pl)))
r = Sqrt(x(pl) * x(pl) + y(pl) * y(pl))
r2T.Text = r
rev2T.Text = Str(Rev(pl))
pl = Val(pl3T.Text)
If pl < 0 Then pl = 0
x3T.Text = Str(Int(x(pl)))
y3T.Text = Str(Int(y(pl)))
r = Sqrt(x(pl) * x(pl) + y(pl) * y(pl))
r3T.Text = r
rev3T.Text = Str(Rev(pl))
pl = Val(pl4T.Text)
If pl < 0 Then pl = 0
x4T.Text = Str(Int(x(pl)))
y4T.Text = Str(Int(y(pl)))
r = Sqrt(x(pl) * x(pl) + y(pl) * y(pl))
r4T.Text = r
rev4T.Text = Str(Rev(pl))
End Sub
' This event handler 1 deals with the results of the background operation.
Private Sub backgroundWorkerpp1_RunWorkerCompleted(ByVal sender As System.Object, _
ByVal e As RunWorkerCompletedEventArgs) Handles backgroundWorkerpp1.RunWorkerCompleted
If e.Cancelled = True Then
ResultLabelpp1.Text = "Canceled!"
ElseIf e.Error IsNot Nothing Then
ResultLabelpp1.Text = "Error: " & e.Error.Message
Else
ResultLabelpp1.Text = "Done!"
End If
End Sub
' This event handler 2 is where the time-consuming work is done.
Private Sub backgroundWorkerpp2_DoWork(ByVal sender As System.Object, ByVal e As DoWorkEventArgs) Handles backgroundWorkerpp2.DoWork
Dim worker As BackgroundWorker = CType(sender, BackgroundWorker)
Dim i, j, pstr As Integer
Dim sec1, sec2 As Integer
Dim dx, dy, dz, r2, r, a, ynew As Double
sec1 = Second(Now)
pstr = 1
Debug.Print("PP2 Load " + Str(2))
Do
If holdst = 1 Then
System.Threading.Thread.Sleep(1)
GoTo loop1
End If
itercnt(2) = itercnt(2) + 1
If state(2) = StartSt Then
state(2) = ActiveSt
For i = pstr To nplanets Step lnp
ax(i) = 0 : ay(i) = 0 : az(i) = 0
For j = 0 To nplanets
If i <> j Then
dx = x(i) - x(j) : dy = y(i) - y(j) : dz = z(i) - z(j)
r2 = (dx * dx + dy * dy + dz * dz) : r = Sqrt(r2)
a = m(j) / (r2 * r)
ax(i) = ax(i) - a * dx
ay(i) = ay(i) - a * dy
az(i) = az(i) - a * dz
End If
Next
vx(i) = vx(i) + ax(i) * dt
vy(i) = vy(i) + ay(i) * dt
vz(i) = vz(i) + az(i) * dt
Next
state(2) = StopSt
End If
If state(2) = StartSt1 Then
state(2) = ActiveSt
For i = pstr To nplanets Step lnp
x(i) = x(i) + vx(i) * dt
ynew = y(i) + vy(i) * dt
If y(i) < 0 And ynew > 0 Then Rev(i) = Rev(i) + 1
y(i) = ynew
z(i) = z(i) + vz(i) * dt
pl_itercnt(i) = pl_itercnt(i) + 1
Next
state(2) = StopSt
End If
' If (worker.CancellationPending = True) Or state(2) = CancelSt Then
If state(2) = CancelSt Then
e.Cancel = True
state(2) = Endst
Debug.Print("PP2 Cancelst " + Str(state(2)))
Exit Sub
Else
sec2 = Second(Now)
If sec2 <> sec1 Then
System.Threading.Thread.Sleep(1)
sec1 = Second(Now)
seccnt(2) = seccnt(2) + 1
If seccnt(2) <= 0 Then
itercnt(2) = 0
worker.ReportProgress(0)
Else
worker.ReportProgress(itercnt(2) / seccnt(2))
End If
End If
End If
loop1:
Loop
End Sub
' This event handler 2 updates the progress.
Private Sub backgroundWorkerpp2_ProgressChanged(ByVal sender As System.Object, _
ByVal e As ProgressChangedEventArgs) Handles backgroundWorkerpp2.ProgressChanged
ResultLabelpp2.Text = (e.ProgressPercentage.ToString())
End Sub
' This event handler 2 deals with the results of the background operation.
Private Sub backgroundWorkerpp2_RunWorkerCompleted(ByVal sender As System.Object, _
ByVal e As RunWorkerCompletedEventArgs) Handles backgroundWorkerpp2.RunWorkerCompleted
If e.Cancelled = True Then
ResultLabelpp2.Text = "Canceled!"
ElseIf e.Error IsNot Nothing Then
ResultLabelpp2.Text = "Error: " & e.Error.Message
Else
ResultLabelpp2.Text = "Done!"
End If
End Sub
' This event handler 3 is where the time-consuming work is done.
Private Sub backgroundWorkerpp3_DoWork(ByVal sender As System.Object, _
ByVal e As DoWorkEventArgs) Handles backgroundWorkerpp3.DoWork
Dim worker As BackgroundWorker = CType(sender, BackgroundWorker)
Dim i, j, pstr As Integer
Dim sec1, sec2 As Integer
Dim dx, dy, dz, r2, r, a, ynew As Double
sec1 = Second(Now)
pstr = 2
Debug.Print("PP3 Load " + Str(3))
Do
If holdst = 1 Then
System.Threading.Thread.Sleep(1)
GoTo loop1
End If
itercnt(3) = itercnt(3) + 1
If state(3) = StartSt Then
state(3) = ActiveSt
For i = pstr To nplanets Step lnp
ax(i) = 0 : ay(i) = 0 : az(i) = 0
For j = 0 To nplanets
If i <> j Then
dx = x(i) - x(j) : dy = y(i) - y(j) : dz = z(i) - z(j)
r2 = (dx * dx + dy * dy + dz * dz) : r = Sqrt(r2)
a = m(j) / (r2 * r)
ax(i) = ax(i) - a * dx
ay(i) = ay(i) - a * dy
az(i) = az(i) - a * dz
End If
Next
vx(i) = vx(i) + ax(i) * dt
vy(i) = vy(i) + ay(i) * dt
vz(i) = vz(i) + az(i) * dt
Next
state(3) = StopSt
End If
If state(3) = StartSt1 Then
state(3) = ActiveSt
For i = pstr To nplanets Step lnp
x(i) = x(i) + vx(i) * dt
ynew = y(i) + vy(i) * dt
If y(i) < 0 And ynew > 0 Then Rev(i) = Rev(i) + 1
y(i) = ynew
z(i) = z(i) + vz(i) * dt
pl_itercnt(i) = pl_itercnt(i) + 1
Next
state(3) = StopSt
End If
If state(3) = CancelSt Then
e.Cancel = True
state(3) = Endst
Debug.Print("PP3 Cancelst " + Str(state(3)))
Exit Sub
Else
sec2 = Second(Now)
If sec2 <> sec1 Then
System.Threading.Thread.Sleep(1)
sec1 = Second(Now)
seccnt(3) = seccnt(3) + 1
If seccnt(3) <= 0 Then
itercnt(3) = 0
worker.ReportProgress(0)
Else
worker.ReportProgress(itercnt(3) / seccnt(3))
End If
End If
End If
loop1:
Loop
End Sub
' This event handler 3 updates the progress.
Private Sub backgroundWorkerpp3_ProgressChanged(ByVal sender As System.Object, _
ByVal e As ProgressChangedEventArgs) Handles backgroundWorkerpp3.ProgressChanged
ResultLabelpp3.Text = (e.ProgressPercentage.ToString())
End Sub
' This event handler 3 deals with the results of the background operation.
Private Sub backgroundWorkerpp3_RunWorkerCompleted(ByVal sender As System.Object, _
ByVal e As RunWorkerCompletedEventArgs) Handles backgroundWorkerpp3.RunWorkerCompleted
If e.Cancelled = True Then
ResultLabelpp3.Text = "Canceled!"
ElseIf e.Error IsNot Nothing Then
ResultLabelpp3.Text = "Error: " & e.Error.Message
Else
ResultLabelpp3.Text = "Done!"
End If
End Sub
' This event handler 4 is where the time-consuming work is done.
Private Sub backgroundWorkerpp4_DoWork(ByVal sender As System.Object, ByVal e As DoWorkEventArgs) Handles backgroundWorkerpp4.DoWork
Dim worker As BackgroundWorker = CType(sender, BackgroundWorker)
Dim i, j, pstr As Integer
Dim sec1, sec2 As Integer
Dim dx, dy, dz, r2, r, a, ynew As Double
sec1 = Second(Now)
Debug.Print("PP4 Load " + Str(4))
pstr = 3
Do
If holdst = 1 Then
System.Threading.Thread.Sleep(1)
GoTo loop1
End If
itercnt(4) = itercnt(4) + 1
If state(4) = StartSt Then
state(4) = ActiveSt
For i = pstr To nplanets Step lnp
ax(i) = 0 : ay(i) = 0 : az(i) = 0
For j = 0 To nplanets
If i <> j Then
dx = x(i) - x(j) : dy = y(i) - y(j) : dz = z(i) - z(j)
r2 = (dx * dx + dy * dy + dz * dz) : r = Sqrt(r2)
a = m(j) / (r2 * r)
ax(i) = ax(i) - a * dx
ay(i) = ay(i) - a * dy
az(i) = az(i) - a * dz
End If
Next
vx(i) = vx(i) + ax(i) * dt
vy(i) = vy(i) + ay(i) * dt
vz(i) = vz(i) + az(i) * dt
Next
state(4) = StopSt
End If
If state(4) = StartSt1 Then
state(4) = ActiveSt
For i = pstr To nplanets Step lnp
x(i) = x(i) + vx(i) * dt
ynew = y(i) + vy(i) * dt
If y(i) < 0 And ynew > 0 Then Rev(i) = Rev(i) + 1
y(i) = ynew
z(i) = z(i) + vz(i) * dt
pl_itercnt(i) = pl_itercnt(i) + 1
Next
state(4) = StopSt
End If
If state(4) = CancelSt Then
e.Cancel = True
state(4) = Endst
Debug.Print("PP4 Cancelst " + Str(state(4)))
Exit Sub
Else
sec2 = Second(Now)
If sec2 <> sec1 Then
System.Threading.Thread.Sleep(1)
sec1 = Second(Now)
seccnt(4) = seccnt(4) + 1
If seccnt(4) <= 0 Then
itercnt(4) = 0
worker.ReportProgress(0)
Else
worker.ReportProgress(itercnt(4) / seccnt(4))
End If
End If
End If
loop1:
Loop
End Sub
' This event handler 4 updates the progress.
Private Sub backgroundWorkerpp4_ProgressChanged(ByVal sender As System.Object, _
ByVal e As ProgressChangedEventArgs) Handles backgroundWorkerpp4.ProgressChanged
ResultLabelpp4.Text = (e.ProgressPercentage.ToString())
End Sub
' This event handler 4 deals with the results of the background operation.
Private Sub backgroundWorkerpp4_RunWorkerCompleted(ByVal sender As System.Object, _
ByVal e As RunWorkerCompletedEventArgs) Handles backgroundWorkerpp4.RunWorkerCompleted
If e.Cancelled = True Then
ResultLabelpp4.Text = "Canceled!"
ElseIf e.Error IsNot Nothing Then
ResultLabelpp4.Text = "Error: " & e.Error.Message
Else
ResultLabelpp4.Text = "Done!"
End If
End Sub
' This event handler 5 is where the time-consuming work is done.
Private Sub backgroundWorkerpp5_DoWork(ByVal sender As System.Object, ByVal e As DoWorkEventArgs) Handles backgroundWorkerpp5.DoWork
Dim worker As BackgroundWorker = CType(sender, BackgroundWorker)
Dim i, j, pstr As Integer
Dim sec1, sec2 As Integer
Dim dx, dy, dz, r2, r, a As Double
sec1 = Second(Now)
Debug.Print("PP5 Load " + Str(5))
pstr = 4
Do
If holdst = 1 Then
System.Threading.Thread.Sleep(1)
GoTo loop1
End If
itercnt(5) = itercnt(5) + 1
If state(5) = StartSt Then
state(5) = ActiveSt
For i = pstr To nplanets Step lnp
ax(i) = 0 : ay(i) = 0 : az(i) = 0
For j = 0 To nplanets
If i <> j Then
dx = x(i) - x(j) : dy = y(i) - y(j) : dz = z(i) - z(j)
r2 = (dx * dx + dy * dy + dz * dz) : r = Sqrt(r2)
a = m(j) / (r2 * r)
ax(i) = ax(i) - a * dx
ay(i) = ay(i) - a * dy
az(i) = az(i) - a * dz
End If
Next
vx(i) = vx(i) + ax(i) * dt
vy(i) = vy(i) + ay(i) * dt
vz(i) = vz(i) + az(i) * dt
Next
state(5) = StopSt
End If
If state(5) = StartSt1 Then
state(5) = ActiveSt
For i = pstr To nplanets Step lnp
x(i) = x(i) + vx(i) * dt
y(i) = y(i) + vy(i) * dt
z(i) = z(i) + vz(i) * dt
pl_itercnt(i) = pl_itercnt(i) + 1
Next
state(5) = StopSt
End If
If state(5) = CancelSt Then
e.Cancel = True
state(5) = Endst
Debug.Print("pp5 Cancelst " + Str(state(5)))
Exit Sub
Else
sec2 = Second(Now)
If sec2 <> sec1 Then
System.Threading.Thread.Sleep(1)
sec1 = Second(Now)
seccnt(5) = seccnt(5) + 1
If seccnt(5) <= 0 Then
itercnt(5) = 0
worker.ReportProgress(0)
Else
worker.ReportProgress(itercnt(5) / seccnt(5))
End If
End If
End If
loop1:
Loop
End Sub
' This event handler 5 updates the progress.
Private Sub backgroundWorkerpp5_ProgressChanged(ByVal sender As System.Object, _
ByVal e As ProgressChangedEventArgs) Handles backgroundWorkerpp5.ProgressChanged
ResultLabelpp5.Text = (e.ProgressPercentage.ToString())
End Sub
' This event handler 5 deals with the results of the background operation.
Private Sub backgroundWorkerpp5_RunWorkerCompleted(ByVal sender As System.Object, _
ByVal e As RunWorkerCompletedEventArgs) Handles backgroundWorkerpp5.RunWorkerCompleted
If e.Cancelled = True Then
ResultLabelpp5.Text = "Canceled!"
ElseIf e.Error IsNot Nothing Then
ResultLabelpp5.Text = "Error: " & e.Error.Message
Else
ResultLabelpp5.Text = "Done!"
End If
End Sub
Private Sub Init()
Dim i As Integer
For i = 0 To idim
x(i) = 0 : y(i) = 0 : z(i) = 0
vx(i) = 0 : vy(i) = 0 : vz(i) = 0
ax(i) = 0 : ay(i) = 0 : az(i) = 0
pl_itercnt(i) = 0
Rev(i) = 0 ' Revolution counter
Next
m(0) = 1000
For i = 1 To nplanets
m(i) = 0
x(i) = 1000 + (i - 1) * 100
If x(i) <> 0 Then vy(i) = Sqrt(m(0) / x(i))
Next
Printa(x, Str(pl_itercnt(0)) + " x")
Printa(vy, Str(pl_itercnt(0)) + " vy")
End Sub
Private Sub Test()
Dim a As String
Dim i, j As Integer
For i = 0 To nplanets - 1
If pl_itercnt(i) <> pl_itercnt(i + 1) Then
a = "Test error j "
For j = 0 To nplanets
a = a + Str(j) + " pl_itercnt(j) " + Str(pl_itercnt(j)) + " "
Next j
Debug.Print(a)
End
End If
Next i
End Sub
Private Sub Printa(ByVal xp(), ByVal str1)
Dim b As String
Dim j As Integer
b = str1
For j = 0 To nplanets
b = b + Str(j) + " " + Str(xp(j)) + " "
Next j
Debug.Print(b)
End Sub
Private Sub InitializeForm()
Me.startAsyncButton = New System.Windows.Forms.Button
Me.cancelAsyncButton = New System.Windows.Forms.Button
Me.endAsyncButton = New System.Windows.Forms.Button
Me.MonitorButton = New System.Windows.Forms.Button
Me.StateL = New System.Windows.Forms.Label
Me.StateTpp1 = New System.Windows.Forms.TextBox
Me.StateTpp2 = New System.Windows.Forms.TextBox
Me.StateTpp3 = New System.Windows.Forms.TextBox
Me.StateTpp4 = New System.Windows.Forms.TextBox
Me.StateTpp5 = New System.Windows.Forms.TextBox
Me.ProcL = New System.Windows.Forms.Label
Me.ProcTpp1 = New System.Windows.Forms.TextBox
Me.ProcTpp2 = New System.Windows.Forms.TextBox
Me.ProcTpp3 = New System.Windows.Forms.TextBox
Me.ProcTpp4 = New System.Windows.Forms.TextBox
Me.ProcTpp5 = New System.Windows.Forms.TextBox
Me.Label2 = New System.Windows.Forms.Label
Me.ResultLabelpp1 = New System.Windows.Forms.Label
Me.ResultLabelpp2 = New System.Windows.Forms.Label
Me.ResultLabelpp3 = New System.Windows.Forms.Label
Me.ResultLabelpp4 = New System.Windows.Forms.Label
Me.ResultLabelpp5 = New System.Windows.Forms.Label
Me.nProcL = New System.Windows.Forms.Label
Me.nProcT = New System.Windows.Forms.TextBox
Me.tdeltaL = New System.Windows.Forms.Label
Me.tdeltaT = New System.Windows.Forms.TextBox
Me.seccntL = New System.Windows.Forms.Label
Me.seccntT = New System.Windows.Forms.TextBox
Me.nplL = New System.Windows.Forms.Label
Me.nplT = New System.Windows.Forms.TextBox
Me.Label1 = New System.Windows.Forms.Label
Me.Label3(2) = New System.Windows.Forms.Label
Me.Label4 = New System.Windows.Forms.Label
Me.Label5 = New System.Windows.Forms.Label
Me.Label6 = New System.Windows.Forms.Label
Me.pl1T = New System.Windows.Forms.TextBox
Me.pl2T = New System.Windows.Forms.TextBox
Me.pl3T = New System.Windows.Forms.TextBox
Me.pl4T = New System.Windows.Forms.TextBox
Me.x1T = New System.Windows.Forms.TextBox
Me.x2T = New System.Windows.Forms.TextBox
Me.x3T = New System.Windows.Forms.TextBox
Me.x4T = New System.Windows.Forms.TextBox
Me.y1T = New System.Windows.Forms.TextBox
Me.y2T = New System.Windows.Forms.TextBox
Me.y3T = New System.Windows.Forms.TextBox
Me.y4T = New System.Windows.Forms.TextBox
Me.r1T = New System.Windows.Forms.TextBox
Me.r2T = New System.Windows.Forms.TextBox
Me.r3T = New System.Windows.Forms.TextBox
Me.r4T = New System.Windows.Forms.TextBox
Me.rev1T = New System.Windows.Forms.TextBox
Me.rev2T = New System.Windows.Forms.TextBox
Me.rev3T = New System.Windows.Forms.TextBox
Me.rev4T = New System.Windows.Forms.TextBox
Me.backgroundWorkerpp1 = New System.ComponentModel.BackgroundWorker
Me.backgroundWorkerpp2 = New System.ComponentModel.BackgroundWorker
Me.backgroundWorkerpp3 = New System.ComponentModel.BackgroundWorker
Me.backgroundWorkerpp4 = New System.ComponentModel.BackgroundWorker
Me.backgroundWorkerpp5 = New System.ComponentModel.BackgroundWorker
Me.SuspendLayout()
'
'Row 1
'
hh = 12 : dhh = 34
Me.StateL.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.StateL.Location = New System.Drawing.Point(3, hh)
Me.StateL.Name = "StateL"
Me.StateL.Size = New System.Drawing.Size(32, 13)
Me.StateL.TabIndex = 4
Me.StateL.Text = "State"
Me.StateL.TextAlign = System.Drawing.ContentAlignment.TopLeft
dd = 60 : ddd = 70
Me.StateTpp1.Location = New System.Drawing.Point(dd, hh)
Me.StateTpp1.Name = "StateTpp1"
Me.StateTpp1.Size = New System.Drawing.Size(64, 20)
Me.StateTpp1.TabIndex = 5
Me.StateTpp1.Text = ""
dd = dd + ddd
Me.StateTpp2.Location = New System.Drawing.Point(dd, hh)
Me.StateTpp2.Name = "StateTpp2"
Me.StateTpp2.Size = New System.Drawing.Size(64, 20)
Me.StateTpp2.TabIndex = 6
Me.StateTpp2.Text = ""
dd = dd + ddd
Me.StateTpp3.Location = New System.Drawing.Point(dd, hh)
Me.StateTpp3.Name = "StateTpp3"
Me.StateTpp3.Size = New System.Drawing.Size(64, 20)
Me.StateTpp3.TabIndex = 7
Me.StateTpp3.Text = ""
dd = dd + ddd
Me.StateTpp4.Location = New System.Drawing.Point(dd, hh)
Me.StateTpp4.Name = "StateTpp4"
Me.StateTpp4.Size = New System.Drawing.Size(64, 20)
Me.StateTpp4.TabIndex = 8
Me.StateTpp4.Text = ""
dd = dd + ddd
Me.StateTpp5.Location = New System.Drawing.Point(dd, hh)
Me.StateTpp5.Name = "StateTpp5"
Me.StateTpp5.Size = New System.Drawing.Size(64, 20)
Me.StateTpp5.TabIndex = 9
Me.StateTpp5.Text = ""
'
'Row 2
'
hh = hh + dhh
Me.ProcL.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.ProcL.Location = New System.Drawing.Point(3, hh)
Me.ProcL.Name = "ProcL"
Me.ProcL.Size = New System.Drawing.Size(39, 13)
Me.ProcL.TabIndex = 10
Me.ProcL.Text = "Proc #"
Me.ProcL.TextAlign = System.Drawing.ContentAlignment.TopLeft
dd = 60
Me.ProcTpp1.Location = New System.Drawing.Point(dd, hh)
Me.ProcTpp1.Name = "ProcTpp1"
Me.ProcTpp1.Size = New System.Drawing.Size(64, 20)
Me.ProcTpp1.TabIndex = 11
Me.ProcTpp1.Text = ""
dd = dd + ddd
Me.ProcTpp2.Location = New System.Drawing.Point(dd, hh)
Me.ProcTpp2.Name = "ProcTpp2"
Me.ProcTpp2.Size = New System.Drawing.Size(64, 20)
Me.ProcTpp2.TabIndex = 12
Me.ProcTpp2.Text = ""
dd = dd + ddd
Me.ProcTpp3.Location = New System.Drawing.Point(dd, hh)
Me.ProcTpp3.Name = "ProcTpp3"
Me.ProcTpp3.Size = New System.Drawing.Size(64, 20)
Me.ProcTpp3.TabIndex = 13
Me.ProcTpp3.Text = ""
dd = dd + ddd
Me.ProcTpp4.Location = New System.Drawing.Point(dd, hh)
Me.ProcTpp4.Name = "ProcTpp4"
Me.ProcTpp4.Size = New System.Drawing.Size(64, 20)
Me.ProcTpp4.TabIndex = 14
Me.ProcTpp4.Text = ""
dd = dd + ddd
Me.ProcTpp5.Location = New System.Drawing.Point(dd, hh)
Me.ProcTpp5.Name = "ProcTpp5"
Me.ProcTpp5.Size = New System.Drawing.Size(64, 20)
Me.ProcTpp5.TabIndex = 15
Me.ProcTpp5.Text = ""
'
'Row 3
'
hh = hh + dhh
Me.Label2.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.Label2.Location = New System.Drawing.Point(3, hh)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(67, 13)
Me.Label2.TabIndex = 16
Me.Label2.Text = "Performance"
Me.Label2.TextAlign = System.Drawing.ContentAlignment.TopLeft
dd = 85
Me.ResultLabelpp1.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.ResultLabelpp1.Location = New System.Drawing.Point(dd, hh)
Me.ResultLabelpp1.Name = "ResultLabelpp1"
Me.ResultLabelpp1.Size = New System.Drawing.Size(70, 13)
Me.ResultLabelpp1.TabIndex = 3
Me.ResultLabelpp1.Text = "pp1"
Me.ResultLabelpp1.TextAlign = System.Drawing.ContentAlignment.TopLeft
dd = dd + ddd
Me.ResultLabelpp2.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.ResultLabelpp2.Location = New System.Drawing.Point(dd, hh)
Me.ResultLabelpp2.Name = "ResultLabelpp2"
Me.ResultLabelpp2.Size = New System.Drawing.Size(60, 13)
Me.ResultLabelpp2.TabIndex = 3
Me.ResultLabelpp2.Text = "pp2"
Me.ResultLabelpp2.TextAlign = System.Drawing.ContentAlignment.TopLeft
dd = dd + ddd
Me.ResultLabelpp3.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.ResultLabelpp3.Location = New System.Drawing.Point(dd, hh)
Me.ResultLabelpp3.Name = "ResultLabelpp3"
Me.ResultLabelpp3.Size = New System.Drawing.Size(70, 13)
Me.ResultLabelpp3.TabIndex = 3
Me.ResultLabelpp3.Text = "pp3"
Me.ResultLabelpp3.TextAlign = System.Drawing.ContentAlignment.TopLeft
dd = dd + ddd
Me.ResultLabelpp4.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.ResultLabelpp4.Location = New System.Drawing.Point(dd, hh)
Me.ResultLabelpp4.Name = "ResultLabelpp4"
Me.ResultLabelpp4.Size = New System.Drawing.Size(60, 13)
Me.ResultLabelpp4.TabIndex = 3
Me.ResultLabelpp4.Text = "pp4"
Me.ResultLabelpp4.TextAlign = System.Drawing.ContentAlignment.TopLeft
dd = dd + ddd
Me.ResultLabelpp5.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.ResultLabelpp5.Location = New System.Drawing.Point(dd, hh)
Me.ResultLabelpp5.Name = "ResultLabelpp5"
Me.ResultLabelpp5.Size = New System.Drawing.Size(70, 13)
Me.ResultLabelpp5.TabIndex = 3
Me.ResultLabelpp5.Text = "pp5"
Me.ResultLabelpp5.TextAlign = System.Drawing.ContentAlignment.TopLeft
'
'Row 4
'
dd = 80 : ddd = 95
hh = hh + dhh
Me.nProcL.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.nProcL.Location = New System.Drawing.Point(dd - 60, hh)
Me.nProcL.Name = "nProcL"
Me.nProcL.Size = New System.Drawing.Size(55, 13)
Me.nProcL.TabIndex = 3
Me.nProcL.Text = "# Proc"
Me.nProcL.TextAlign = System.Drawing.ContentAlignment.TopRight
Me.nProcT.Location = New System.Drawing.Point(dd, hh)
Me.nProcT.Name = "nProcT"
Me.nProcT.Size = New System.Drawing.Size(40, 20)
Me.nProcT.TabIndex = 3
Me.nProcT.Text = "0"
Me.nProcT.TextAlign = System.Drawing.ContentAlignment.TopLeft ' = right
dd = dd + ddd
Me.tdeltaL.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.tdeltaL.Location = New System.Drawing.Point(dd - 60, hh)
Me.tdeltaL.Name = "tdeltaL"
Me.tdeltaL.Size = New System.Drawing.Size(55, 13)
Me.tdeltaL.TabIndex = 3
Me.tdeltaL.Text = "delta t"
Me.tdeltaL.TextAlign = System.Drawing.ContentAlignment.TopRight
Me.tdeltaT.Location = New System.Drawing.Point(dd, hh)
Me.tdeltaT.Name = "tdeltaT"
Me.tdeltaT.Size = New System.Drawing.Size(40, 20)
Me.tdeltaT.TabIndex = 3
Me.tdeltaT.Text = "0.02"
Me.tdeltaT.TextAlign = System.Drawing.ContentAlignment.TopLeft ' = right
dd = dd + ddd
Me.seccntL.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.seccntL.Location = New System.Drawing.Point(dd - 60, hh)
Me.seccntL.Name = "seccntL"
Me.seccntL.Size = New System.Drawing.Size(55, 13)
Me.seccntL.TabIndex = 3
Me.seccntL.Text = "sec"
Me.seccntL.TextAlign = System.Drawing.ContentAlignment.TopRight
Me.seccntT.Location = New System.Drawing.Point(dd, hh)
Me.seccntT.Name = "seccntT"
Me.seccntT.Size = New System.Drawing.Size(40, 20)
Me.seccntT.TabIndex = 3
Me.seccntT.Text = "1"
'Me.seccntT.TextAlign = System.Drawing.ContentAlignment.TopRight
Me.seccntT.TextAlign = System.Drawing.ContentAlignment.TopLeft ' = right
dd = dd + ddd
Me.nplL.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.nplL.Location = New System.Drawing.Point(dd - 60, hh)
Me.nplL.Name = "nplL"
Me.nplL.Size = New System.Drawing.Size(55, 13)
Me.nplL.TabIndex = 3
Me.nplL.Text = "# planets"
Me.nplL.TextAlign = System.Drawing.ContentAlignment.TopRight
Me.nplT.Location = New System.Drawing.Point(dd, hh)
Me.nplT.Name = "nplT"
Me.nplT.Size = New System.Drawing.Size(40, 20)
Me.nplT.TabIndex = 3
Me.nplT.Text = "10"
Me.nplT.TextAlign = System.Drawing.ContentAlignment.TopLeft 'Right
'
' row 5 startAsyncButton cancelAsyncButton endAsyncButton MonitorButton
'
dd = 60
hh = hh + dhh
Me.startAsyncButton.Location = New System.Drawing.Point(dd, hh)
Me.startAsyncButton.Name = "startAsyncButton"
Me.startAsyncButton.Size = New System.Drawing.Size(63, 25)
Me.startAsyncButton.TabIndex = 0
Me.startAsyncButton.Text = "Start"
dd = dd + ddd
Me.cancelAsyncButton.Enabled = True
Me.cancelAsyncButton.Location = New System.Drawing.Point(dd, hh)
Me.cancelAsyncButton.Name = "cancelAsyncButton"
Me.cancelAsyncButton.Size = New System.Drawing.Size(63, 25)
Me.cancelAsyncButton.TabIndex = 1
Me.cancelAsyncButton.Text = "Cancel"
dd = dd + ddd
Me.endAsyncButton.Location = New System.Drawing.Point(dd, hh)
Me.endAsyncButton.Name = "EndAsyncButton"
Me.endAsyncButton.Size = New System.Drawing.Size(63, 25)
Me.endAsyncButton.TabIndex = 2
Me.endAsyncButton.Text = "End"
dd = dd + ddd
Me.MonitorButton.Location = New System.Drawing.Point(dd, hh)
Me.MonitorButton.Name = "MonitorButton"
Me.MonitorButton.Size = New System.Drawing.Size(63, 25)
Me.MonitorButton.TabIndex = 3
Me.MonitorButton.Text = "Monitor"
'
'Row 6 Planet x y r rev
'
dd = 80
hh = hh + dhh
Me.Label1.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.Label1.Location = New System.Drawing.Point(6, hh)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(40, 13)
Me.Label1.TabIndex = 3
Me.Label1.Text = "Planet"
Me.Label1.TextAlign = System.Drawing.ContentAlignment.TopLeft
Me.Label3(2).BorderStyle = System.Windows.Forms.BorderStyle.None
Me.Label3(2).Location = New System.Drawing.Point(dd, hh)
Me.Label3(2).Name = "Label3(2)"
Me.Label3(2).Size = New System.Drawing.Size(12, 13)
Me.Label3(2).TabIndex = 3
Me.Label3(2).Text = "x"
Me.Label3(2).TextAlign = System.Drawing.ContentAlignment.TopLeft
dd = dd + ddd
Me.Label4.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.Label4.Location = New System.Drawing.Point(dd, hh)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(15, 13)
Me.Label4.TabIndex = 3
Me.Label4.Text = "y"
Me.Label4.TextAlign = System.Drawing.ContentAlignment.TopLeft
dd = dd + ddd
Me.Label5.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.Label5.Location = New System.Drawing.Point(dd, hh)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(12, 13)
Me.Label5.TabIndex = 3
Me.Label5.Text = "r"
Me.Label5.TextAlign = System.Drawing.ContentAlignment.TopLeft
dd = dd + ddd
Me.Label6.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.Label6.Location = New System.Drawing.Point(dd, hh)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(22, 13)
Me.Label6.TabIndex = 3
Me.Label6.Text = "rev"
Me.Label6.TextAlign = System.Drawing.ContentAlignment.TopLeft
'
'Row 7 Planet 1
'
dhh = 25
hh = hh + dhh 'hh=200
Me.pl1T.Location = New System.Drawing.Point(13, hh)
Me.pl1T.Name = "pl1T"
Me.pl1T.Size = New System.Drawing.Size(21, 20)
Me.pl1T.TabIndex = 3
Me.pl1T.Text = "1"
Me.pl1T.TextAlign = System.Drawing.ContentAlignment.TopLeft ' right !
dd = 60
Me.x1T.Location = New System.Drawing.Point(dd, hh)
Me.x1T.Name = "x1T"
Me.x1T.Size = New System.Drawing.Size(61, 20)
Me.x1T.TabIndex = 3
Me.x1T.Text = "0"
Me.x1T.TextAlign = System.Drawing.ContentAlignment.TopLeft
dd = dd + ddd
Me.y1T.Location = New System.Drawing.Point(dd, hh)
Me.y1T.Name = "y1T"
Me.y1T.Size = New System.Drawing.Size(61, 20)
Me.y1T.TabIndex = 3
Me.y1T.Text = "0"
Me.y1T.TextAlign = System.Drawing.ContentAlignment.TopLeft
dd = dd + ddd
Me.r1T.Location = New System.Drawing.Point(dd, hh)
Me.r1T.Name = "r1T"
Me.r1T.Size = New System.Drawing.Size(61, 20)
Me.r1T.TabIndex = 3
Me.r1T.Text = "0"
dd = dd + ddd
Me.rev1T.Location = New System.Drawing.Point(dd, hh)
Me.rev1T.Name = "rev1T"
Me.rev1T.Size = New System.Drawing.Size(61, 20)
Me.rev1T.TabIndex = 3
Me.rev1T.Text = "0"
Me.rev1T.TextAlign = System.Drawing.ContentAlignment.TopLeft ' right !
'
'Row 8 Planet 2
'
hh = hh + dhh
Me.pl2T.Location = New System.Drawing.Point(13, hh)
Me.pl2T.Name = "pl2T"
Me.pl2T.Size = New System.Drawing.Size(21, 20)
Me.pl2T.TabIndex = 3
Me.pl2T.Text = "2"
Me.pl2T.TextAlign = System.Drawing.ContentAlignment.TopLeft ' right !
dd = 60
Me.x2T.Location = New System.Drawing.Point(dd, hh)
Me.x2T.Name = "x2T"
Me.x2T.Size = New System.Drawing.Size(61, 20)
Me.x2T.TabIndex = 3
Me.x2T.Text = "0"
Me.x2T.TextAlign = System.Drawing.ContentAlignment.TopLeft
dd = dd + ddd
Me.y2T.Location = New System.Drawing.Point(dd, hh)
Me.y2T.Name = "y2T"
Me.y2T.Size = New System.Drawing.Size(61, 20)
Me.y2T.TabIndex = 3
Me.y2T.Text = "0"
Me.y2T.TextAlign = System.Drawing.ContentAlignment.TopLeft
dd = dd + ddd
Me.r2T.Location = New System.Drawing.Point(dd, hh)
Me.r2T.Name = "r2T"
Me.r2T.Size = New System.Drawing.Size(61, 20)
Me.r2T.TabIndex = 3
Me.r2T.Text = "0"
dd = dd + ddd
Me.rev2T.Location = New System.Drawing.Point(dd, hh)
Me.rev2T.Name = "rev2T"
Me.rev2T.Size = New System.Drawing.Size(61, 20)
Me.rev2T.TabIndex = 3
Me.rev2T.Text = "0"
Me.rev2T.TextAlign = System.Drawing.ContentAlignment.TopLeft ' right !
'
'Row 9 Planet 3
'
hh = hh + dhh
Me.pl3T.Location = New System.Drawing.Point(13, hh)
Me.pl3T.Name = "pl3T"
Me.pl3T.Size = New System.Drawing.Size(21, 20)
Me.pl3T.TabIndex = 3
Me.pl3T.Text = "3"
Me.pl3T.TextAlign = System.Drawing.ContentAlignment.TopLeft
dd = 60
Me.x3T.Location = New System.Drawing.Point(dd, hh)
Me.x3T.Name = "x3T"
Me.x3T.Size = New System.Drawing.Size(61, 20)
Me.x3T.TabIndex = 3
Me.x3T.Text = "0"
Me.x3T.TextAlign = System.Drawing.ContentAlignment.TopLeft
dd = dd + ddd
Me.y3T.Location = New System.Drawing.Point(dd, hh)
Me.y3T.Name = "y3T"
Me.y3T.Size = New System.Drawing.Size(61, 20)
Me.y3T.TabIndex = 3
Me.y3T.Text = "0"
Me.y3T.TextAlign = System.Drawing.ContentAlignment.TopLeft
dd = dd + ddd
Me.r3T.Location = New System.Drawing.Point(dd, hh)
Me.r3T.Name = "r3T"
Me.r3T.Size = New System.Drawing.Size(61, 20)
Me.r3T.TabIndex = 3
Me.r3T.Text = "0"
dd = dd + ddd
Me.rev3T.Location = New System.Drawing.Point(dd, hh)
Me.rev3T.Name = "rev3T"
Me.rev3T.Size = New System.Drawing.Size(61, 20)
Me.rev3T.TabIndex = 3
Me.rev3T.Text = "0"
Me.rev3T.TextAlign = System.Drawing.ContentAlignment.TopLeft ' right !
'
'Row 10 Planet 4
'
hh = hh + dhh
Me.pl4T.Location = New System.Drawing.Point(13, hh)
Me.pl4T.Name = "pl4T"
Me.pl4T.Size = New System.Drawing.Size(21, 20)
Me.pl4T.TabIndex = 3
Me.pl4T.Text = "4"
Me.pl4T.TextAlign = System.Drawing.ContentAlignment.TopLeft ' right !
dd = 60
Me.x4T.Location = New System.Drawing.Point(dd, hh)
Me.x4T.Name = "x4T"
Me.x4T.Size = New System.Drawing.Size(61, 20)
Me.x4T.TabIndex = 3
Me.x4T.Text = "0"
Me.x4T.TextAlign = System.Drawing.ContentAlignment.TopLeft
dd = dd + ddd
Me.y4T.Location = New System.Drawing.Point(dd, hh)
Me.y4T.Name = "y4T"
Me.y4T.Size = New System.Drawing.Size(61, 20)
Me.y4T.TabIndex = 3
Me.y4T.Text = "0"
Me.y4T.TextAlign = System.Drawing.ContentAlignment.TopLeft
dd = dd + ddd
Me.r4T.Location = New System.Drawing.Point(dd, hh)
Me.r4T.Name = "r4T"
Me.r4T.Size = New System.Drawing.Size(61, 20)
Me.r4T.TabIndex = 3
Me.r4T.Text = "0"
dd = dd + ddd
Me.rev4T.Location = New System.Drawing.Point(dd, hh)
Me.rev4T.Name = "rev4T"
Me.rev4T.Size = New System.Drawing.Size(61, 20)
Me.rev4T.TabIndex = 3
Me.rev4T.Text = "0"
Me.rev4T.TextAlign = System.Drawing.ContentAlignment.TopLeft ' right !
'
'backgroundWorkerpp1
'
Me.backgroundWorkerpp1.WorkerReportsProgress = True
Me.backgroundWorkerpp1.WorkerSupportsCancellation = True
Me.backgroundWorkerpp2.WorkerReportsProgress = True
Me.backgroundWorkerpp2.WorkerSupportsCancellation = True
Me.backgroundWorkerpp3.WorkerReportsProgress = True
Me.backgroundWorkerpp3.WorkerSupportsCancellation = True
Me.backgroundWorkerpp4.WorkerReportsProgress = True
Me.backgroundWorkerpp4.WorkerSupportsCancellation = True
Me.backgroundWorkerpp5.WorkerReportsProgress = True
Me.backgroundWorkerpp5.WorkerSupportsCancellation = True
'
'PlanetForm
'
Me.ClientSize = New System.Drawing.Size(dd + ddd - 25, hh + dhh + 10)
Me.Controls.Add(Me.cancelAsyncButton)
Me.Controls.Add(Me.startAsyncButton)
Me.Controls.Add(Me.endAsyncButton)
Me.Controls.Add(Me.MonitorButton)
Me.Controls.Add(Me.StateL)
Me.Controls.Add(Me.StateTpp1)
Me.Controls.Add(Me.StateTpp2)
Me.Controls.Add(Me.StateTpp3)
Me.Controls.Add(Me.StateTpp4)
Me.Controls.Add(Me.StateTpp5)
Me.Controls.Add(Me.ProcL)
Me.Controls.Add(Me.ProcTpp1)
Me.Controls.Add(Me.ProcTpp2)
Me.Controls.Add(Me.ProcTpp3)
Me.Controls.Add(Me.ProcTpp4)
Me.Controls.Add(Me.ProcTpp5)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.ResultLabelpp1)
Me.Controls.Add(Me.ResultLabelpp2)
Me.Controls.Add(Me.ResultLabelpp3)
Me.Controls.Add(Me.ResultLabelpp4)
Me.Controls.Add(Me.ResultLabelpp5)
Me.Controls.Add(Me.nProcL)
Me.Controls.Add(Me.nProcT)
Me.Controls.Add(Me.tdeltaL)
Me.Controls.Add(Me.tdeltaT)
Me.Controls.Add(Me.seccntL)
Me.Controls.Add(Me.seccntT)
Me.Controls.Add(Me.nplL)
Me.Controls.Add(Me.nplT)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.Label3(2))
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.Label5)
Me.Controls.Add(Me.Label6)
Me.Controls.Add(Me.pl1T)
Me.Controls.Add(Me.x1T)
Me.Controls.Add(Me.y1T)
Me.Controls.Add(Me.r1T)
Me.Controls.Add(Me.rev1T)
Me.Controls.Add(Me.pl2T)
Me.Controls.Add(Me.x2T)
Me.Controls.Add(Me.y2T)
Me.Controls.Add(Me.r2T)
Me.Controls.Add(Me.rev2T)
Me.Controls.Add(Me.pl3T)
Me.Controls.Add(Me.x3T)
Me.Controls.Add(Me.y3T)
Me.Controls.Add(Me.r3T)
Me.Controls.Add(Me.rev3T)
Me.Controls.Add(Me.pl4T)
Me.Controls.Add(Me.x4T)
Me.Controls.Add(Me.y4T)
Me.Controls.Add(Me.r4T)
Me.Controls.Add(Me.rev4T)
Me.Name = "PlanetForm"
Me.Text = "Planet1 Simulation"
Me.ResumeLayout(False)
End Sub 'InitializeComponent
_
Shared Sub Main()
Application.Run(New Planet1Form)
End Sub 'Main
End Class 'PlanetForm