Public Class ViewerOptimizerCommThread

   ' variabile che ferma il ciclo
   Private Shared m_Stop As Boolean = False

   Private Shared m_bViewerOptimizerBlocked As Boolean = False
   Public Shared ReadOnly Property bViewerOptimizerBlocked As Boolean
      Get
         Return m_bViewerOptimizerBlocked
      End Get
   End Property
   Friend Shared Sub SetViewerOptimizerBlocked(value As Boolean)
      m_bViewerOptimizerBlocked = value
   End Sub

   Friend Shared Sub StopThread()
      m_Stop = True
   End Sub

   Public Shared Sub ViewerOptimizerCommThreadFunction()

      ' creo classe di comunicazione
      Dim m_ViewerOptimizerComm As ViewerOptimizerComm = New ViewerOptimizerComm()

      While Not m_Stop
         ' eseguo ciclo principale che tiene vivo il thread
         m_ViewerOptimizerComm.Timer_Tick()
         Threading.Thread.Sleep(TimeSpan.FromMilliseconds(1000))
      End While

   End Sub

End Class
