Files
effector.plugin.fivelakes/Supervisor.Plugin.FiveLakes/Utility/IdNameStruct.vb
T
Emmanuele Sassi 18c858a426 - letta modalita' simulazione macchina anche in plugin
- disabilitato sort su colonne lista porte
- corretta riattivazione bottoni dopo calcolo
- corretta acquisizione risultato da calcolo porta
- corrette funzioni lua con parametro inutile
- cambiato valori di avanzamento variabili porta in WP per scarico uguale a 2
- cambiata sorgente indice porta su disegnino
- aggiunta lista porte a finestra di restart
- aggiunta a finestra di restart lettura json del lua
- aggiunta classe IdNameStruct
2024-09-11 10:05:31 +02:00

98 lines
3.0 KiB
VB.net

Imports System.Collections.ObjectModel
Public Structure IdNameStruct
Private m_Id As Integer
Public Property Id As Integer
Get
Return m_Id
End Get
Set(value As Integer)
m_Id = value
End Set
End Property
Private m_Name As String
Public Property Name As String
Get
Return m_Name
End Get
Set(value As String)
m_Name = value
End Set
End Property
Sub New(Id As Integer, Name As String)
m_Id = Id
m_Name = Name
End Sub
Public Overrides Function ToString() As String
Return Name
End Function
Public Shared Function IndFromId(Id As Integer, List As ObservableCollection(Of IdNameStruct)) As Integer
For i = 0 To List.Count - 1
If List(i).Id = Id Then Return i
Next
Return 0
End Function
Public Shared Function IndFromId(Id As Integer, List As List(Of IdNameStruct)) As Integer
For i = 0 To List.Count - 1
If List(i).Id = Id Then Return i
Next
Return 0
End Function
Public Shared Function IdFromInd(Ind As Integer, List As ObservableCollection(Of IdNameStruct)) As Integer
Return List(Ind).Id
End Function
Public Shared Function IdFromInd(Ind As Integer, List As List(Of IdNameStruct)) As Integer
Return List(Ind).Id
End Function
Public Shared Function IndFromId(Id As Integer, List As ObservableCollection(Of Object)) As Integer
For i = 0 To List.Count - 1
If TypeOf (List(i)) Is IdNameStruct AndAlso DirectCast(List(i), IdNameStruct).Id = Id Then
Return i
End If
Next
Return 0
End Function
Public Shared Function IndFromId(Id As Integer, List As List(Of Object)) As Integer
For i = 0 To List.Count - 1
If TypeOf (List(i)) Is IdNameStruct AndAlso DirectCast(List(i), IdNameStruct).Id = Id Then
Return i
End If
Next
Return 0
End Function
Public Shared Function IdFromInd(Ind As Integer, List As ObservableCollection(Of Object)) As Integer
If TypeOf (List(Ind)) Is IdNameStruct Then
Return DirectCast(List(Ind), IdNameStruct).Id
End If
Return 0
End Function
Public Shared Function IdFromInd(Ind As Integer, List As List(Of Object)) As Integer
If TypeOf (List(Ind)) Is IdNameStruct Then
Return DirectCast(List(Ind), IdNameStruct).Id
End If
Return 0
End Function
Public Shared Function IdFromName(Name As String, List As ObservableCollection(Of Object)) As Integer
For i = 0 To List.Count - 1
If DirectCast(List(i), IdNameStruct).Name = Name Then Return DirectCast(List(i), IdNameStruct).Id
Next
Return 0
End Function
Public Shared Function IdFromName(Name As String, List As List(Of Object)) As Integer
For i = 0 To List.Count - 1
If DirectCast(List(i), IdNameStruct).Name = Name Then Return DirectCast(List(i), IdNameStruct).Id
Next
Return 0
End Function
End Structure