Imports SifoxPM.MainConnection
Imports System.Threading
Public Class Form1
Inherits System.Windows.Forms.Form
#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 btn_start As System.Windows.Forms.Button
Friend WithEvents btn_stop As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.btn_start = New System.Windows.Forms.Button
Me.btn_stop = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'btn_start
'
Me.btn_start.Location = New System.Drawing.Point(102, 54)
Me.btn_start.Name = "btn_start"
Me.btn_start.Size = New System.Drawing.Size(88, 32)
Me.btn_start.TabIndex = 0
Me.btn_start.Text = "Start"
'
'btn_stop
'
Me.btn_stop.Location = New System.Drawing.Point(102, 110)
Me.btn_stop.Name = "btn_stop"
Me.btn_stop.Size = New System.Drawing.Size(88, 32)
Me.btn_stop.TabIndex = 1
Me.btn_stop.Text = "Stop"
Me.btn_stop.Enabled = False
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 271)
Me.Controls.Add(Me.btn_stop)
Me.Controls.Add(Me.btn_start)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
Dim csection As New CriticalSection(Nothing, Nothing, Nothing)
Private Sub btn_start_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_start.Click
Dim mainThread As New Thread(AddressOf csection.MainWorkingThread)
mainThread.Start()
btn_start.Enabled = False
btn_stop.Enabled = True
End Sub
Private Sub btn_stop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_stop.Click
btn_stop.Enabled = False
csection.EndService()
End Sub
End Class