Files
Nicola Pievani 65dee8bf4c OmagVIEWPlus 2.3a1:
-> aggiornamento automatico della lista "PartList";
-> verifica funzionamento ultima versione.
2021-01-07 14:08:14 +00:00

112 lines
3.6 KiB
VB.net

Imports EgtUILib
Imports EgtWPFLib5
Imports System.Collections.ObjectModel
Public Class TablePartWindowVM
Inherits VMBase
Friend refTablePartWindowV As TablePartWindowV
Private m_ProjetcList As New ObservableCollection(Of ProjectListParts)
Public Property ProjetcList As ObservableCollection(Of ProjectListParts)
Get
Return m_ProjetcList
End Get
Set(value As ObservableCollection(Of ProjectListParts))
m_ProjetcList = value
End Set
End Property
Private m_ProjSelected As ProjectListParts
Public Property ProjSelected As ProjectListParts
Get
Return m_ProjSelected
End Get
Set(value As ProjectListParts)
m_ProjSelected = value
NotifyPropertyChanged("CurrListPart")
End Set
End Property
Public Sub RefreshProject()
Dim m_CurrentPartList As New ObservableCollection(Of Part)
Dim bAddNewList As Boolean = True
' salvo le liste in funzione del numero di progetto
If Not IsNothing(Map.refUnloadingAreaVM) Then
For Each ItemPart In Map.refUnloadingAreaVM.ListPart
For Each Item In m_ProjetcList
If Item.IdProject = ItemPart.IdProject.ToString Then
bAddNewList = False
Exit For
End If
bAddNewList = True
Next
If bAddNewList Then
m_CurrentPartList.Add(ItemPart)
End If
Next
End If
If m_CurrentPartList.Count > 0 Then
m_ProjetcList.Add(New ProjectListParts(m_CurrentPartList))
NotifyPropertyChanged("CurrentPartList")
' seleziono come progetto quello in fase di scarico
m_ProjSelected = m_ProjetcList.Last
NotifyPropertyChanged("ProjetcList")
NotifyPropertyChanged("ProjSelected")
End If
End Sub
Sub New(IdProj As Integer)
refTablePartWindowV = New TablePartWindowV(Application.Current.MainWindow, Me)
For Each Itemproj In Map.refMainWindowVM.MainWindowM.ProjIndList
Dim m_CurrentPartList As New ObservableCollection(Of Part)
' salvo le liste in funzione del numero del numero di progetto
If Not IsNothing(Map.refUnloadingAreaVM) Then
For Each ItemPart In Map.refUnloadingAreaVM.ListPart
If ItemPart.IdProject = Itemproj.nProjInd Then
m_CurrentPartList.Add(ItemPart)
End If
Next
End If
If m_CurrentPartList.Count > 0 Then
m_ProjetcList.Add(New ProjectListParts(m_CurrentPartList))
NotifyPropertyChanged("CurrentPartList")
m_ProjSelected = m_ProjetcList.Last
End If
Next
NotifyPropertyChanged("ProjetcList")
End Sub
End Class
Public Class ProjectListParts
Inherits VMBase
Private m_CurrListPart As New ObservableCollection(Of Part)
Public Property CurrListPart As ObservableCollection(Of Part)
Get
Return m_CurrListPart
End Get
Set(value As ObservableCollection(Of Part))
m_CurrListPart = value
End Set
End Property
Private m_IdProject As String
Public Property IdProject As String
Get
Return m_IdProject
End Get
Set(value As String)
m_IdProject = value
End Set
End Property
Sub New(obCurrListParts As ObservableCollection(Of Part))
m_CurrListPart = obCurrListParts
If m_CurrListPart.Count > 0 Then
m_IdProject = m_CurrListPart(0).IdProject.ToString
End If
End Sub
End Class