- aggiunta modifica nome progetto

- migliorata gestione archiviazione
- migliorata gestione cancellazione
This commit is contained in:
Emmanuele Sassi
2023-08-28 18:36:42 +02:00
parent 3401bb7557
commit 5f321fba3a
16 changed files with 342 additions and 250 deletions
@@ -59,6 +59,13 @@ Public MustInherit Class NewOpenProjectFileDialogVM
End Get
End Property
Private m_colArchived_Name As EgtDataGridColumn
Public ReadOnly Property colArchived_Name As EgtDataGridColumn
Get
Return m_colArchived_Name
End Get
End Property
Protected m_ProjColumns As New ObservableCollection(Of EgtDataGridColumn)
Public Property ProjColumns As ObservableCollection(Of EgtDataGridColumn)
Get
@@ -120,6 +127,15 @@ Public MustInherit Class NewOpenProjectFileDialogVM
End Get
Set(value As ProdItem)
m_SelProject = value
' verifico se abilitare il bottone Delete
If IsNothing(m_SelProject) Then
SetDeleteIsEnabled(False)
ElseIf IsNothing(m_SelProject.ProdFileVM) Then
SetDeleteIsEnabled(True)
Else
SetDeleteIsEnabled(Not SelProject.ProdFileVM.bIsProduced)
End If
NotifyPropertyChanged(NameOf(Archive_Msg))
End Set
End Property
@@ -367,10 +383,24 @@ Public MustInherit Class NewOpenProjectFileDialogVM
Set(value As Boolean)
m_bViewArchived = value
WriteMainPrivateProfileString(S_OPENFILEDIALOG, K_VIEWARCHIVED, If(bViewArchived, 1, 0))
m_colArchived_Name.Visible = value
RefreshProjectList()
End Set
End Property
Private m_bDelete_IsEnabled As Boolean
Public ReadOnly Property bDelete_IsEnabled As Boolean
Get
Return m_bDelete_IsEnabled
End Get
End Property
Public Sub SetDeleteIsEnabled(bValue As Boolean)
m_bDelete_IsEnabled = bValue
NotifyPropertyChanged(NameOf(bDelete_IsEnabled))
End Sub
Protected m_ChangeOpenedProjectOnCancel As Boolean = False
#Region "Messages"
Public ReadOnly Property Title As String
@@ -430,9 +460,20 @@ Public MustInherit Class NewOpenProjectFileDialogVM
Return EgtMsg(30006)
End Get
End Property
Public ReadOnly Property Archived_Msg As String
Get
Return EgtMsg(61983)
End Get
End Property
Public ReadOnly Property Archive_Msg As String
Get
Return EgtMsg(61981)
If Not IsNothing(m_SelProject) AndAlso m_SelProject.bIsArchived Then
Return EgtMsg(61984)
Else
Return EgtMsg(61981)
End If
End Get
End Property
Public ReadOnly Property Delete_Msg As String
@@ -470,7 +511,7 @@ Public MustInherit Class NewOpenProjectFileDialogVM
Private m_cmdProjectDoubleClick As ICommand
Private m_cmdDelete As ICommand
Private m_cmdArchive As ICommand
Private m_cmdModifyName As ICommand
Private m_cmdCancel As ICommand
#End Region ' FIELDS & PROPERTIES
@@ -478,6 +519,7 @@ Public MustInherit Class NewOpenProjectFileDialogVM
' carico colonne
LoadColumns()
m_colProdFile_Name = m_ProdColumns.FirstOrDefault(Function(x) x.Name = COL_NAME)
m_colArchived_Name = m_ProdColumns.FirstOrDefault(Function(x) x.Name = COL_ARCHIVED)
' leggo valori per filtri
m_SelDayType = GetMainPrivateProfileInt(S_OPENFILEDIALOG, K_DAYTYPE, 0)
Select Case m_SelDayType
@@ -530,7 +572,7 @@ Public MustInherit Class NewOpenProjectFileDialogVM
' NotifyPropertyChanged(NameOf(SelFilterType))
'ElseIf ProjectType = ProjectType.PROD Then
' carico le colonne della datagrid
GetPrivateProfileColumns(S_OPENPROJFILEDLG_PROD, ProdColumns)
GetPrivateProfileColumns(S_NEWOPENPROJFILEDLG_PROD, ProdColumns)
' carico campi su cui eseguire il filtro di ricerca
m_BTLDateTypeList = New List(Of String)({CreateDate_Msg})
m_SelBTLDateType = BTLDateTypes.CREATEDATE
@@ -596,6 +638,10 @@ Public MustInherit Class NewOpenProjectFileDialogVM
Return bProjectOk
End Function
Protected Sub CloseWindow(bDialogResult As Boolean)
RaiseEvent m_CloseWindow(bDialogResult)
End Sub
#End Region ' METHODS
#Region "COMMANDS"
@@ -672,37 +718,34 @@ Public MustInherit Class NewOpenProjectFileDialogVM
#End Region ' Delete
#Region "ModifyName"
#Region "Cancel"
''' <summary>
''' Returns a command that do New.
''' </summary>
Public ReadOnly Property ModifyName_Command As ICommand
Public ReadOnly Property Cancel_Command As ICommand
Get
If m_cmdModifyName Is Nothing Then
m_cmdModifyName = New Command(AddressOf ModifyName)
If m_cmdCancel Is Nothing Then
m_cmdCancel = New Command(AddressOf Cancel)
End If
Return m_cmdModifyName
Return m_cmdCancel
End Get
End Property
''' <summary>
''' Execute the New. This method is invoked by the NewCommand.
''' </summary>
Public Sub ModifyName()
Dim NameColumn As EgtDataGridColumn = m_ProdColumns.FirstOrDefault(Function(x) x.Name = COL_NAME)
If Not IsNothing(NameColumn) Then
NameColumn.IsReadOnly = False
End If
Public Overridable Sub Cancel()
End Sub
#End Region ' ModifyName
#End Region ' Cancel
#End Region ' Commands
End Class
Public Class ProdItem
Inherits VMBase
Protected m_ProdFileVM As ProdFileVM
Public ReadOnly Property ProdFileVM As ProdFileVM
@@ -734,6 +777,7 @@ Public Class ProdItem
End If
End Set
End Property
Public ReadOnly Property dtCreateDate As Date
Get
Return If(Not IsNothing(m_ProdFileVM), {m_ProdFileVM.dtCreateDate, m_ProjFileList.Min(Function(x) x.dtCreateDate)}.Min(), m_ProjFileList.Min(Function(x) x.dtCreateDate))
@@ -744,9 +788,33 @@ Public Class ProdItem
Return dtCreateDate.ToString()
End Get
End Property
Public ReadOnly Property sMachine As String
Get
Return If(Not IsNothing(m_ProdFileVM), m_ProdFileVM.sMachine, "")
If Not IsNothing(m_ProdFileVM) Then
Return m_ProdFileVM.sMachine
ElseIf Not IsNothing(m_ProjFileList(0)) Then
Return m_ProjFileList(0).sMachine
Else Return ""
End If
End Get
End Property
Public ReadOnly Property bIsArchived As Boolean
Get
If Not IsNothing(m_ProdFileVM) Then
Return m_ProdFileVM.bIsArchived
ElseIf Not IsNothing(m_ProjFileList(0)) Then
Return m_ProjFileList(0).bIsArchived
Else
Return True
End If
End Get
End Property
Public ReadOnly Property Archived_Visibility As Visibility
Get
Return If(bIsArchived, Visibility.Visible, Visibility.Collapsed)
End Get
End Property
@@ -765,14 +833,3 @@ Public Class ProdItem
End Sub
End Class
'Public Class ProjItem
' Private m_ProjFileVM As ProjectFileVM
' Sub New(ProjFileVM As ProjectFileVM)
' m_ProjFileVM = ProjFileVM
' End Sub
'End Class