160 lines
5.4 KiB
VB.net
160 lines
5.4 KiB
VB.net
Imports System.Collections.ObjectModel
|
|
Imports EgtWPFLib5
|
|
Imports EgtUILib
|
|
|
|
Public Class ProjectSlabVM
|
|
Inherits VMBase
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
' definisco l'evento per gestire la selezione della lastra
|
|
Public Event SlabIsSelected(ByRef sender As Object, ByVal e As EventArgs)
|
|
|
|
' Oggetto di gestione della macchina fotografica
|
|
Friend m_Camera As New Camera
|
|
|
|
Public Enum ProjectModeOpt As Integer
|
|
LIST = 1
|
|
DETAIL = 2
|
|
NEWSLAB = 3
|
|
End Enum
|
|
|
|
Private m_SelProjectMode As ProjectModeOpt = ProjectModeOpt.LIST
|
|
Public Property SelProjectMode As ProjectModeOpt
|
|
Get
|
|
Return m_SelProjectMode
|
|
End Get
|
|
Set(value As ProjectModeOpt)
|
|
' Esco dallo stato corrente
|
|
Select Case m_SelProjectMode
|
|
Case ProjectModeOpt.LIST
|
|
PhotoMap.refSearchPanelVM.Search_IsEnabled = False
|
|
Case ProjectModeOpt.DETAIL, ProjectModeOpt.NEWSLAB
|
|
EgtNewFile()
|
|
End Select
|
|
' Entro nel nuovo stato
|
|
m_SelProjectMode = value
|
|
Select Case m_SelProjectMode
|
|
Case ProjectModeOpt.LIST
|
|
PhotoMap.refSearchPanelVM.Search_IsEnabled = True
|
|
PhotoMap.refListPageVM.InitListPage()
|
|
Case ProjectModeOpt.DETAIL
|
|
PhotoMap.refDetailPageVM.InitDetailPage()
|
|
PhotoMap.refOptionPanelVM.InitOptionPanel()
|
|
Case ProjectModeOpt.NEWSLAB
|
|
' prima di inserire verifico di leggere l'ultimo DB disponibile
|
|
If Not MainData.bEnableTextId Then
|
|
PhotoMap.refListPageVM.InitListPage()
|
|
End If
|
|
PhotoMap.refOptionPanelVM.InitOptionPanel()
|
|
End Select
|
|
' comunico l'evento di modifica della pagina
|
|
RaiseEvent SlabIsSelected(Me, EventArgs.Empty)
|
|
NotifyPropertyChanged("ProjectContent")
|
|
NotifyPropertyChanged("OptionContent")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_DetailPageV As New DetailPageSlabV
|
|
Private m_ListPageV As New ListPageSlabV
|
|
Public ReadOnly Property ProjectContent As FrameworkElement
|
|
Get
|
|
Select Case m_SelProjectMode
|
|
Case ProjectModeOpt.LIST
|
|
Return m_ListPageV
|
|
Case ProjectModeOpt.DETAIL
|
|
Return m_DetailPageV
|
|
Case ProjectModeOpt.NEWSLAB
|
|
Return m_DetailPageV
|
|
Case Else
|
|
Return m_ListPageV
|
|
End Select
|
|
End Get
|
|
End Property
|
|
|
|
Private m_SlabList As New ObservableCollection(Of Slab)
|
|
Public Property SlabList As ObservableCollection(Of Slab)
|
|
Get
|
|
Return m_SlabList
|
|
End Get
|
|
Set(value As ObservableCollection(Of Slab))
|
|
m_SlabList = value
|
|
PhotoMap.refListPageVM.NotifyPropertyChanged("SlabList")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_DateTimeList As New ObservableCollection(Of DataTimeRecord)
|
|
Public Property DateTimeList As ObservableCollection(Of DataTimeRecord)
|
|
Get
|
|
Return m_DateTimeList
|
|
End Get
|
|
Set(value As ObservableCollection(Of DataTimeRecord))
|
|
m_DateTimeList = value
|
|
PhotoMap.refListPageVM.NotifyPropertyChanged("DateTimeList")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_SelSlab As Slab
|
|
Public Property SelSlab As Slab
|
|
Get
|
|
Return m_SelSlab
|
|
End Get
|
|
Set(value As Slab)
|
|
m_SelSlab = value
|
|
NotifyPropertyChanged("SelSlab")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_StateList As New List(Of IdNameStruct)({New IdNameStruct(Slab.StateOpt.AVAILABLE, "AVAILABLE"),
|
|
New IdNameStruct(Slab.StateOpt.ASSIGNED, "ASSIGNED"),
|
|
New IdNameStruct(Slab.StateOpt.TAKEN, "TAKEN")})
|
|
Public ReadOnly Property StateList As List(Of IdNameStruct)
|
|
Get
|
|
Return m_StateList
|
|
End Get
|
|
End Property
|
|
|
|
Private m_MaterialList As New List(Of String)
|
|
Public Property MaterialList As List(Of String)
|
|
Get
|
|
Return m_MaterialList
|
|
End Get
|
|
Set(value As List(Of String))
|
|
m_MaterialList = value
|
|
PhotoMap.refOptionPanelVM.NotifyPropertyChanged("MaterialList")
|
|
End Set
|
|
End Property
|
|
|
|
#End Region ' FIELDS & PROPERTIES
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New()
|
|
'If Not OmagOFFICEMap.refMainWindowVM.MainWindowM.m_SlabDB Then Return
|
|
' Creo riferimento a questa classe in StoneMap
|
|
PhotoMap.SetRefProjectVM(Me)
|
|
' Setto la ricerca come non attiva
|
|
PhotoMap.refSearchPanelVM.SetSearch_IsChecked(False)
|
|
|
|
EgtPHOTOLib.PhotoMap.refSearchPanelVM.Search_IsEnabled = True
|
|
EgtPHOTOLib.PhotoMap.refListPageVM.InitListPage()
|
|
|
|
' Leggo lista materiali da file ini
|
|
Dim Index As Integer = 1
|
|
Dim sMaterial As String = String.Empty
|
|
While GetMainPrivateProfileString(S_MATERIALS, K_MATERIAL & Index, "", sMaterial) > 0
|
|
If Not String.IsNullOrWhiteSpace(sMaterial) Then
|
|
MaterialList.Add(sMaterial)
|
|
End If
|
|
Index += 1
|
|
End While
|
|
' Creo lista stati per SearchPanel
|
|
Dim SearchStateList As New List(Of IdNameStruct)(StateList)
|
|
SearchStateList.Insert(0, New IdNameStruct(0, String.Empty))
|
|
PhotoMap.refSearchPanelVM.SetStateList(SearchStateList)
|
|
End Sub
|
|
|
|
#End Region ' CONSTRUCTOR
|
|
|
|
End Class
|