Files
OmagCUT/CadCuts/SelectTableWD.xaml.vb
T
Demetrio Cassarino 01ced18fad -aggiornato messaggi
2025-06-11 12:47:23 +02:00

96 lines
2.8 KiB
VB.net

Imports System.ComponentModel
Public Class SelectTableWD
Private m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow)
Private m_nSelectedTable As Integer = 0
Public ReadOnly Property nSelectedTable As Integer
Get
Return m_nSelectedTable
End Get
End Property
Sub New(Owner As Window)
Me.Owner = Owner
Me.WindowStartupLocation = WindowStartupLocation.CenterOwner
InitializeComponent()
End Sub
Public CurrTableList As New List(Of TableToChange)
Private Sub ChangeTable_Initialized() Handles Me.Initialized
Title.Text = EgtUILib.EgtMsg(91234) ' Seleziona la tavola da usare
' recuepero l'inidce della tavola corrente
Dim nIndeXCurrTab As Integer = GetCurrentTable()
' creo la lista delle tavole disponibili (attivo il bottone della tavola attualmente in uso)
For nInd As Integer = 0 To GetTableCount() - 1
CurrTableList.Add(New TableToChange("Tab", (nInd + 1).ToString, ((nInd + 1) = nIndeXCurrTab)))
Next
End Sub
Private Sub ChangeTable_Loaded() Handles Me.Loaded
TableList.ItemsSource = CurrTableList
End Sub
Private Sub OkBtn_Click(sender As Object, e As RoutedEventArgs) Handles OkBtn.Click
' recupero l'indice della tavola impostata
For Each ItemTab As TableToChange In CurrTableList
If ItemTab.IsActive Then
m_nSelectedTable = ItemTab.nIndex
Exit For
End If
Next
DialogResult = True
End Sub
End Class
Public Class TableToChange
Implements INotifyPropertyChanged
Private Property m_sName As String = "Tab"
Public ReadOnly Property sName As String
Get
Return m_sName
End Get
End Property
Public ReadOnly Property ImgTab As String
Get
Return DirectCast(Application.Current.MainWindow, MainWindow).GetResourcesDir() & "\MachineButtonsImage\table.png"
End Get
End Property
Private Property m_nIndex As Integer = 3
Public ReadOnly Property nIndex As Integer
Get
Return m_nIndex
End Get
End Property
Private m_bIsActive As Boolean = False
Public Property IsActive As Boolean
Get
Return m_bIsActive
End Get
Set(value As Boolean)
m_bIsActive = value
NotifyPropertyChanged("IsActive")
End Set
End Property
Public Sub New(Name As String, Ind As Integer, IsCurrent As Boolean)
m_sName = Name & " " & Ind.ToString
m_nIndex = Ind
m_bIsActive = IsCurrent
NotifyPropertyChanged("IsActive")
End Sub
Public Event PropertyChanged(sender As Object, e As PropertyChangedEventArgs) Implements INotifyPropertyChanged.PropertyChanged
Public Sub NotifyPropertyChanged(propName As String)
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
End Sub
End Class