157 lines
3.7 KiB
VB.net
157 lines
3.7 KiB
VB.net
Public Class ChangeTableVM
|
|
Inherits VMBase
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
Private m_refChanTableV As ChangeTableV
|
|
|
|
Public Enum EnumDialogResult
|
|
OK
|
|
CANCEL
|
|
End Enum
|
|
|
|
Private m_MyDialogResult As EnumDialogResult
|
|
Public ReadOnly Property MyDialogResult As EnumDialogResult
|
|
Get
|
|
Return m_MyDialogResult
|
|
End Get
|
|
End Property
|
|
|
|
Private m_sTitle As String = "Seleziona tavola di lavoro"
|
|
Public ReadOnly Property sTitle As String
|
|
Get
|
|
Return m_sTitle
|
|
End Get
|
|
End Property
|
|
|
|
Private m_nSelectedTable As Integer = 0
|
|
Public ReadOnly Property nSelectedTable As Integer
|
|
Get
|
|
Return m_nSelectedTable
|
|
End Get
|
|
End Property
|
|
|
|
Private m_CurrTableList As New List(Of TableToChange)
|
|
Public ReadOnly Property CurrTableList As List(Of TableToChange)
|
|
Get
|
|
Return m_CurrTableList
|
|
End Get
|
|
End Property
|
|
|
|
' Definizione Comandi
|
|
Private m_cmdOk As ICommand
|
|
|
|
#End Region ' Fields & Properties
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New(refV As ChangeTableV)
|
|
m_refChanTableV = refV
|
|
' Procedo alla creazione della lista delle tavole disponibili
|
|
Initialized()
|
|
End Sub
|
|
|
|
#End Region ' Constructor
|
|
|
|
#Region "METHODS"
|
|
|
|
Private Sub Initialized()
|
|
' 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
|
|
m_CurrTableList.Add(New TableToChange("Tab", (nInd + 1), ((nInd + 1) = nIndeXCurrTab)))
|
|
Next
|
|
End Sub
|
|
|
|
#End Region ' Methods
|
|
|
|
#Region "COMMANDS"
|
|
|
|
#Region "OkCommand"
|
|
|
|
Public ReadOnly Property OkCommand() As ICommand
|
|
Get
|
|
If m_cmdOk Is Nothing Then
|
|
m_cmdOk = New Command(AddressOf Ok)
|
|
End If
|
|
Return m_cmdOk
|
|
End Get
|
|
End Property
|
|
|
|
Private Sub Ok()
|
|
' 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
|
|
m_MyDialogResult = EnumDialogResult.OK
|
|
' procedo alla chiusura della finetra
|
|
m_refChanTableV.Close()
|
|
End Sub
|
|
|
|
#End Region ' OkCommand
|
|
|
|
#End Region ' Commands
|
|
|
|
End Class
|
|
|
|
Public Class TableToChange
|
|
Inherits VMBase
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
Private Property m_sName As String = "Tab"
|
|
Public ReadOnly Property sName As String
|
|
Get
|
|
Return m_sName
|
|
End Get
|
|
End Property
|
|
|
|
Private m_sImgTab As String = "\Resources\NewIcons\table.png"
|
|
Public ReadOnly Property ImgTab As String
|
|
Get
|
|
Return If(m_bIsActive, "\Resources\NewIcons\table.png", "\Resources\NewIcons\tableS.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
|
|
If m_bIsActive Then
|
|
m_sImgTab = "\Resources\NewIcons\table.png"
|
|
Else
|
|
m_sImgTab = "\Resources\NewIcons\tableS.png"
|
|
End If
|
|
NotifyPropertyChanged(NameOf(IsActive))
|
|
NotifyPropertyChanged(NameOf(ImgTab))
|
|
End Set
|
|
End Property
|
|
|
|
#End Region ' Fields & Properties
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Public Sub New(Name As String, Ind As Integer, IsCurrent As Boolean)
|
|
m_sName = Name & " " & Ind.ToString
|
|
m_nIndex = Ind
|
|
m_bIsActive = IsCurrent
|
|
NotifyPropertyChanged(NameOf(IsActive))
|
|
End Sub
|
|
|
|
#End Region ' Constructor
|
|
|
|
End Class |