Imports EgtUILib Imports EgtWPFLib5 Public Class MultiSelectionVM Inherits VMBase Private m_sRefGuidOfPart As String = String.Empty Public ReadOnly Property TitleMsg As String Get Return "Multiple selection" End Get End Property Public ReadOnly Property SelectionMsg As String Get Return "Number of Parts" End Get End Property Public ReadOnly Property OkMsg As String Get Return "Ok" End Get End Property Public ReadOnly Property CancelMsg As String Get Return "Cancel" End Get End Property Private m_MultiSelectionV As MultiSelectionV Public Sub SetMultiSelectionV(MultiSel As MultiSelectionV) m_MultiSelectionV = MultiSel End Sub Private m_nNbrOfParts As Integer Public Property nNbrOfParts As String Get Return m_nNbrOfParts.ToString End Get Set(value As String) Dim nVal As Integer = 0 StringToInt(value, nVal) m_nNbrOfParts = nVal NotifyPropertyChanged("nNbrOfParts") End Set End Property Private m_cmdOk As ICommand Private m_cmdCancel As ICommand Public ReadOnly Property OkCommand As ICommand Get If m_cmdOk Is Nothing Then m_cmdOk = New Command(AddressOf OkCmd) End If Return m_cmdOk End Get End Property Public Sub OkCmd(ByVal param As Object) ' il numero di elementi indicato è corretto ' deseleziono il pezzo corrente DeselectPartInFaimily(m_sRefGuidOfPart) Select Case m_nNbrOfParts Case 0 ' Annulla ' continuo senza eseguire niente Case Else ' seleziono il numero di pezzi indicati SelectPartInFaimily(m_sRefGuidOfPart, m_nNbrOfParts) End Select ' chiudo la finestra m_MultiSelectionV.Close() EgtDraw() End Sub Public ReadOnly Property CancelCommand As ICommand Get If m_cmdCancel Is Nothing Then m_cmdCancel = New Command(AddressOf CancelCmd) End If Return m_cmdCancel End Get End Property Public Sub CancelCmd(ByVal param As Object) ' chiudo la fiestra senza eseguire niente m_MultiSelectionV.Close() EgtDraw() End Sub Sub New(CurrNumberOfParts As Integer, sRefGuid As String) m_nNbrOfParts = CurrNumberOfParts m_sRefGuidOfPart = sRefGuid End Sub End Class