84f191782b
- eliminate chiamate di test da gestore macchine a stati - anticipata caricamento comunicazione macchine rispetto alle macchine a stati - allungato counter di esecuzione processi lanciati - aggiunto dictionary - iniziata gestione finestra custom
57 lines
2.0 KiB
VB.net
57 lines
2.0 KiB
VB.net
Imports NGP_COMM_DLL
|
|
|
|
Public Class MachineManager
|
|
'
|
|
'
|
|
' !!!! TO DO : use a list of n machines, not just 2 !!!!
|
|
Private m_MachineList(20) As NC.NC_generic
|
|
Friend ReadOnly Property MachineList As NC.NC_generic()
|
|
Get
|
|
Return m_MachineList
|
|
End Get
|
|
End Property
|
|
|
|
Sub New()
|
|
End Sub
|
|
|
|
Sub Init()
|
|
If GetMainPrivateProfileInt(S_NC, K_NC_SIMULATE, 0) = 1 Then
|
|
Dim nMachineIndex As Integer = 0
|
|
Dim sMachine As String = ""
|
|
While GetMainPrivateProfileString(S_NC, K_MACHINE & (nMachineIndex + 1).ToString(), "", sMachine) > 0
|
|
Dim NewSimulatedMachine As New NC.Simulated
|
|
NewSimulatedMachine.Connect("")
|
|
m_MachineList(nMachineIndex) = NewSimulatedMachine
|
|
nMachineIndex += 1
|
|
End While
|
|
Else
|
|
Dim nMachineIndex As Integer = 1
|
|
Dim sMachine As String = ""
|
|
While GetMainPrivateProfileString(S_NC, K_MACHINE & nMachineIndex.ToString(), "", sMachine) > 0
|
|
Dim sMachineSplit() As String = sMachine.Split(","c)
|
|
Dim nType As Integer = 0
|
|
If sMachineSplit.Count >= 1 AndAlso Not String.IsNullOrWhiteSpace(sMachineSplit(0)) AndAlso Integer.TryParse(sMachineSplit(0), nType) Then
|
|
Select Case nType
|
|
Case 1 ' OsaiOpen
|
|
If sMachineSplit.Count >= 2 AndAlso Not String.IsNullOrWhiteSpace(sMachineSplit(1)) Then
|
|
Dim NewOsaiOpen As New NC.OsaiOpen
|
|
NewOsaiOpen.Connect(sMachineSplit(1))
|
|
m_MachineList(nMachineIndex) = NewOsaiOpen
|
|
End If
|
|
End Select
|
|
End If
|
|
nMachineIndex += 1
|
|
End While
|
|
End If
|
|
End Sub
|
|
|
|
Sub Close()
|
|
For Each Machine In m_MachineList
|
|
If Not IsNothing(Machine) Then
|
|
Machine.Disconnect()
|
|
End If
|
|
Next
|
|
End Sub
|
|
|
|
End Class
|