Imports EgtUILib Public Class SelectTableWindowVM Inherits VMBase #Region "FIELDS & PROPERTIES" Friend Event m_CloseWindow(DialogResult As Integer) 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 #Region "Messages" Public ReadOnly Property Title As String Get Return EgtMsg(91123) 'Tavola End Get End Property Public ReadOnly Property WndMsg As String Get Return EgtMsg(91111) 'Tavola da usare ? End Get End Property #End Region ' Definizione comandi Private m_cmdOk As ICommand #End Region ' FIELDS & PROPERTIES #Region "CONSTRUCTOR" Sub New() ' 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 ' CONSTRUCTOR #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(ByVal param As Object) ' 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 ' procedo alla chiusura della finetra RaiseEvent m_CloseWindow(CInt(param)) End Sub #End Region ' OkCommand #End Region ' COMMANDS End Class