Files
Emmanuele Sassi d3e9474417 - migliorie grafiche stile crm
- correzzioni varie
2025-03-21 11:22:58 +01:00

93 lines
2.8 KiB
VB.net

Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtWPFLib5
Public Class EstimationListPageVM
Inherits VMBase
Private m_EstimationList As New ObservableCollection(Of EstimationRow)
Public ReadOnly Property EstimationList As ObservableCollection(Of EstimationRow)
Get
Return m_EstimationList
End Get
End Property
Private m_SelEstimation As EstimationRow
Public Property SelEstimation As EstimationRow
Get
Return m_SelEstimation
End Get
Set(value As EstimationRow)
m_SelEstimation = value
End Set
End Property
' Definizione comandi
Private m_cmdOpenEstimation As ICommand
Sub New()
Map.SetRefEstimationListPageVM(Me)
End Sub
Friend Function InitEstimationListPage() As Boolean
'm_EstimationList.Clear()
'Dim FolderList() As String = Directory.GetDirectories(Map.refMainWindowVM.MainWindowM.sEstimationDir)
'For Each EstimationFolder In FolderList
' Dim nId As Integer = 0
' Integer.TryParse(Path.GetFileNameWithoutExtension(EstimationFolder), nId)
' m_EstimationList.Add(New EstimationRow(nId))
'Next
Return True
End Function
Friend Sub NewEstimation()
Dim nId As Integer = 0
If m_EstimationList.Count > 0 Then
nId = m_EstimationList.Max(Of Integer)(Function(x) x.nId)
End If
nId += 1
Dim NewEstimation As New EstimationRow(nId)
m_EstimationList.Add(NewEstimation)
Directory.CreateDirectory(Map.refMainWindowVM.MainWindowM.sEstimationDir & "\" & (nId).ToString())
m_SelEstimation = NewEstimation
Map.refEstimationDetailPageVM.SetCurrEstimation(New Estimation(nId))
End Sub
Friend Sub OpenEstimation()
Dim CurrEstimation As Estimation = Nothing
Estimation.ReadEstimation(m_SelEstimation.nId, CurrEstimation)
Map.refEstimationDetailPageVM.SetCurrEstimation(CurrEstimation)
Map.refCRMPageVM.SetSelPage(CRMPages.ESTIMATIONDETAIL)
End Sub
Friend Function ReadEstimationList() As Boolean
m_EstimationList.Clear()
Dim FolderList() As String = Directory.GetDirectories(Map.refMainWindowVM.MainWindowM.sEstimationDir)
For Each EstimationFolder In FolderList
Dim nId As Integer = 0
Integer.TryParse(Path.GetFileNameWithoutExtension(EstimationFolder), nId)
m_EstimationList.Add(New EstimationRow(nId))
Next
Return True
End Function
#Region "COMMANDS"
'#Region "OpenEstimation"
' Public ReadOnly Property OpenEstimation_Command As ICommand
' Get
' If m_cmdOpenEstimation Is Nothing Then
' m_cmdOpenEstimation = New Command(AddressOf OpenEstimation)
' End If
' Return m_cmdOpenEstimation
' End Get
' End Property
'#End Region ' OpenEstimation
#End Region ' COMMANDS
End Class