Login Register



[Reply]
Forum Index > AIM/ICQ Discussion
ThreadingSolution
Posted on: 02-26 4:09 pm
X3N0



https://www.mediafire.com/file/p9go790c4uz2ddn/b99formloop1.zip/file
[b]Nice So far[/b]
Runs the main event the form doesnt pop up lol but looks good.
may not be start up object.

Those who follow the river, can fall in.
Posted on: 02-27 12:05 am
X3N0

[code]
Private Sub bbw99cmsClient_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Entry01.Main()

For Each c As Windows.Forms.Control In Entry01.MAINTHREAD.MyControls
Me.Controls.Add(c)
Next

End Sub
Public Class Entry01

Private Shared MainRoutineDone As Boolean
Private Shared MainRoutine As EventHandler

Shared WaitOne


Public Shared Sub Main()
InitializeProcess()

If IsNothing(MAINTHREAD.waitThisMany) Then
WaitOne = False
MyOp.APP_STATE_IDLE = CInt(0)
MyOp.APP_STATE_IDLE = MyOp.APPSTATE + MyOp.APPSTATE
End If

Console.WriteLine("Running Event Main")
Try

WaitOne = CheckIdleSwitch(MyOp.APP_STATE_IDLE)




MainRoutine.Invoke(New Object, New EventArgs)

MainRoutineDone = CBool(1)
Catch ex As Exception
Console.WriteLine(ex.Message)
Finally
Try
If MainRoutineDone = CBool(1) Then
MainRoutineDone = False
End If
Catch ex As Exception
Console.WriteLine(ex.Message)


Finally
MainRoutineDone = CBool(0)
Console.WriteLine("Main Routine complete.")
End Try
End Try
Console.WriteLine("End Event Main")
If MainRoutineDone = CBool(0) Then
MainRoutine.Invoke(New Object, New EventArgs)
End If
If Entry01.WaitOne Then
MyOp.APP_STATE_IDLE = MyOp.APPSTATE + MyOp.APPSTATE
End If
End Sub

Private Shared Function CheckIdleSwitch(ByVal MyNum As Integer) As Boolean
Select Case MyNum
Case MyOp.APP_STATE_IDLE = MyOp.APPSTATE + MyOp.APPSTATE
Return True
Case Else
Debug.Print("Something else?...Not idleing.")
Call Entry01.Main()
End Select

Return CBool(0)
End Function


Private Shared Sub MainOne()
MAINTHREADREF1.Threading1.Start()
End Sub

Private Shared Sub InitializeProcess()
MakeLoopProcess()
MainRoutine = New EventHandler(AddressOf MainOne)


Console.Title = "bb99cmsClient"

End Sub

Private Shared MAINTHREADREF1 As New MAINTHREAD


Private Shared Sub MakeLoopProcess()

Dim RefMainMy() As Object = {New Object(1) {}, New Object(1) {}, New Object(6) {}}

RefMainMy(1) = Entry01.MAINTHREADREF1.Threading1
RefMainMy(2) = Entry01.MAINTHREADREF1.Threading2


End Sub
Public Class MAINTHREAD
Public Names() As String

Private t1, t2 As Threading.Thread

Property Threading1 As Threading.Thread
Property Threading2 As Threading.Thread


Sub New()
t1 = New Threading.Thread(AddressOf Thread1)
t2 = New Threading.Thread(AddressOf Thread2)

Threading1 = t1
Threading2 = t2

End Sub
Public Shared waitThisMany

Property ServerEcho As Components.ConnectShell
Property Time As Components.bbwTimer

Dim TimeEHandle

Private Sub MakeMain()
Dim bbwTime As New Components.bbwTimer()
Time = bbwTime


Dim ServerTalk As Components.ConnectShell = New Components.ConnectShell

ServerEcho = ServerTalk




TimeEHandle = New EventHandler(AddressOf bbwTime.TickTimes)


End Sub

Private Sub Thread1()

Dim f As New bbw99cmsClient

MakeMain()



f.Show()

While f.Created

ServerEcho.StartListenting()

TimeEHandle.Invoke()


Select Case MyOp.APPSTATE

Case 1
Windows.Forms.Application.DoEvents()
Case MyOp.APP_STATE_IDLE = MyOp.APPSTATE + MyOp.APPSTATE

Dim ImWaiting As Integer = Time.NumTicks

waitThisMany = ImWaiting

Do Until 0
Threading.Thread.Yield()


Threading.Thread.SpinWait(ImWaiting)

If ImWaiting >= 1 Then
MainRoutineDone = True
End If

Exit Do

Loop
Case Else

Dim OkClicked As Integer = CInt(Nothing)

OkClicked = MsgBox("APP STATE VIOLATION", MsgBoxStyle.Critical, "APPSTATE")


If (OkClicked) Then
Debug.Print("OK!")
Else
Debug.Print("Echo to bravo!")
End If


Throw New AccessViolationException("App altered.!")





End Select




End While




End Sub
Public Shared MyControls As List(Of Windows.Forms.Control)


Private Sub Thread2()
Dim textbox1 As New Windows.Forms.TextBox
textbox1.Multiline = True
textbox1.Location = New Drawing.Point(0, 640)
textbox1.ReadOnly = True
MyControls.Add(textbox1)

Dim MyMenu As New Windows.Forms.MenuStrip

MyMenu.Location = New Drawing.Point(0, 0)

MyMenu.Items.Add("&File")

MyControls.Add(MyMenu)

End Sub




End Class

End Class

[/code]

Those who follow the river, can fall in.
Posted on: 02-28 8:04 pm
X3N0

[bump]

Those who follow the river, can fall in.
< - 1 - >

[Reply]