This commit is contained in:
Nicola Pievani
2020-03-09 16:59:26 +00:00
parent 529ca4fcd9
commit ea802aba52
+125 -112
View File
@@ -1,4 +1,7 @@
Imports System.Collections.ObjectModel
Imports combit.ListLabel25
Imports combit.ListLabel25.DataProviders
Imports System.Collections.ObjectModel
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.IO
Imports EgtUILib
@@ -47,13 +50,13 @@ Public Class ProjectManagerVM
Public ReadOnly Property DeleteProjectVisibility As Visibility
Get
If OptionModule.m_SingleDoor then
If OptionModule.m_SingleDoor Then
Return Visibility.Visible
End If
If OptionModule.m_DeleteProject then
If OptionModule.m_DeleteProject Then
Return Visibility.Visible
Else
Return Visibility.Collapsed
Return Visibility.Collapsed
End If
End Get
End Property
@@ -119,7 +122,7 @@ Public Class ProjectManagerVM
End Property
Public ReadOnly Property ReloadToolTip As String
Get
' 50421 = Reload Directories
' 50421 = Reload Directories
Return EgtMsg(50421)
End Get
End Property
@@ -196,7 +199,7 @@ Public Class ProjectManagerVM
Return EgtMsg(50413).ToUpper
End Get
End Property
Public ReadOnly Property DoorToolTip As String
Public ReadOnly Property DoorToolTip As String
Get
' Door
Return EgtMsg(50308).ToUpper
@@ -238,7 +241,7 @@ Public Class ProjectManagerVM
End Property
Public Sub NewCmd()
Utility.OutLog(" +++ NewProject +++")
Utility.OutLog(" +++ NewProject +++")
' Gestisco porta corrente modificata
If Not Map.refAssemblyManagerVM.ManageModified() Then Return
' Modalità Progetto
@@ -253,13 +256,13 @@ Public Class ProjectManagerVM
' se annullo la creazione di un nuovo direttorio, rimango in quello attuale (verifico che l'ultimo file non sia già in lettura)
If Not SaveFileDialogWnd.ShowDialog Then
Utility.OutLog("Annullata la creazione di un nuovo progetto")
If Not IsNothing(Map.refAssemblyManagerVM.CurrProject) AndAlso Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) Then
If Not String.IsNullOrEmpty(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.GraphicName) then
If Not Utility.IsFileLocked(Map.refAssemblyManagerVM.CurrProject.Name, Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.GraphicName) then
If Not IsNothing(Map.refAssemblyManagerVM.CurrProject) AndAlso Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) Then
If Not String.IsNullOrEmpty(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.GraphicName) Then
If Not Utility.IsFileLocked(Map.refAssemblyManagerVM.CurrProject.Name, Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.GraphicName) Then
Utility.OutLog("Apertura progetto : " & Map.refAssemblyManagerVM.CurrProject.Name)
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName
End If
End if
End If
End If
End If
Return
End If
@@ -268,14 +271,14 @@ Public Class ProjectManagerVM
If Directory.Exists(SaveFileDialog.FileName) Then
' se il direttorio contiene almento un file di .lock esco
If Utility.IsFileLocked(SaveFileDialog.FileName) Then
If Not IsNothing(Map.refAssemblyManagerVM.CurrProject) AndAlso Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) Then
If Not String.IsNullOrEmpty(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.GraphicName) then
If Not Utility.IsFileLocked(Map.refAssemblyManagerVM.CurrProject.Name, Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.GraphicName) then
If Not IsNothing(Map.refAssemblyManagerVM.CurrProject) AndAlso Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) Then
If Not String.IsNullOrEmpty(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.GraphicName) Then
If Not Utility.IsFileLocked(Map.refAssemblyManagerVM.CurrProject.Name, Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.GraphicName) Then
Utility.OutLog("Apertura progetto : " & Map.refAssemblyManagerVM.CurrProject.Name)
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName
End If
End if
End If
End If
End If
End If
Return
End If
@@ -286,16 +289,16 @@ Public Class ProjectManagerVM
If MsgResult = MessageBoxResult.No Then
Utility.OutLog("Annullata sovrascrittura delprogetto esistente : " & SaveFileDialog.FileName)
If Not IsNothing(Map.refAssemblyManagerVM.CurrProject) AndAlso Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) Then
If Not String.IsNullOrEmpty(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.GraphicName) then
If Not Utility.IsFileLocked(Map.refAssemblyManagerVM.CurrProject.Name, Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.GraphicName) then
If Not String.IsNullOrEmpty(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.GraphicName) Then
If Not Utility.IsFileLocked(Map.refAssemblyManagerVM.CurrProject.Name, Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.GraphicName) Then
Utility.OutLog("Apertura progetto : " & Map.refAssemblyManagerVM.CurrProject.Name)
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName
End If
End if
End If
Return
End If
End If
End If
End If
Return
End If
' cancello il direttorio
Try
Directory.Delete(SaveFileDialog.FileName, True)
@@ -329,14 +332,14 @@ Public Class ProjectManagerVM
' Creo nuova porta
Map.refAssemblyManagerVM.AddAssembly()
' Map.refOptionsVM.MyProjectDir = CurrProject.Name
If Not IsNothing(CurrProject.SelAssemblyName) AndAlso Not String.IsNullOrEmpty(CurrProject.SelAssemblyName.GraphicName) then
If Not IsNothing(CurrProject.SelAssemblyName) AndAlso Not String.IsNullOrEmpty(CurrProject.SelAssemblyName.GraphicName) Then
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName = CurrProject.SelAssemblyName
End If
Map.refAssemblyManagerVM.VisibilityDoorList = Visibility.Visible
Return
Return
End If
'-------------------------------------------------------------------------------------------------------------------------
'Prima di tutto chiedo se vuole aprire un template
Dim sImportTemplate As String = Map.refAssemblyManagerVM.ShowDialogImportTemplate
@@ -359,20 +362,20 @@ Public Class ProjectManagerVM
If Utility.IsFileLocked(Path.GetDirectoryName(saveFileDialog1.FileName), Path.GetFileNameWithoutExtension(saveFileDialog1.FileName)) Then
' apro l'ultimo progetto valido
If Not IsNothing(Map.refAssemblyManagerVM.CurrProject) AndAlso Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) Then
If Not String.IsNullOrEmpty(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.GraphicName) then
If Not String.IsNullOrEmpty(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.GraphicName) Then
Dim bShowMessage As Boolean = False
If Not Utility.IsFileLocked(Map.refAssemblyManagerVM.CurrProject.Name, Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.GraphicName, bShowMessage) then
If Not Utility.IsFileLocked(Map.refAssemblyManagerVM.CurrProject.Name, Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.GraphicName, bShowMessage) Then
Utility.OutLog("Apertura progetto : " & Map.refAssemblyManagerVM.CurrProject.Name)
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName
End If
End if
End If
End If
End If
End If
Return
End If
Utility.UnLockDir()
' elimino eventuali file con lo stesso nome
If File.Exists(saveFileDialog1.FileName) then
Try
If File.Exists(saveFileDialog1.FileName) Then
Try
File.Delete(saveFileDialog1.FileName)
Catch ex As Exception
Utility.OutLog("Impossibilie sovrascrivere il file: " & saveFileDialog1.FileName)
@@ -387,7 +390,7 @@ Public Class ProjectManagerVM
If Not IsNothing(Map.refAssemblyManagerVM.CurrProject) AndAlso Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) Then
CurrProject = Map.refAssemblyManagerVM.CurrProject
End If
' salvo il riferimento al progetto corrente
m_CurrProject = CurrProject
' salvo path progetto
@@ -403,9 +406,6 @@ Public Class ProjectManagerVM
m_CurrProject.AssemblyList.Add(Local_AssemblyName)
' Seleziono AssembyName creato
m_CurrProject.SelAssemblyName = Local_AssemblyName
' Creo nuovo assembly
Utility.OutLog("Creazione nuovo progetto : " & saveFileDialog1.FileName)
Utility.LockDir(Path.GetDirectoryName(saveFileDialog1.FileName), Path.GetFileNameWithoutExtension(saveFileDialog1.FileName))
' carico il nome come Assemblato selezionato
If Not OptionModule.m_DisableWindowOrder Then
Dim OrderWindow As New OrderV(Application.Current.MainWindow, New OrderVM())
@@ -414,7 +414,10 @@ Public Class ProjectManagerVM
' tolgo la visualizzazione della lista dei nomi
Map.refAssemblyManagerVM.CurrProject = CurrProject
Map.refAssemblyManagerVM.ImportTemplate(sImportTemplate)
' Creo nuovo assembly
Map.refAssemblyManagerVM.NewCmd(Local_AssemblyName)
Utility.OutLog("Creazione nuovo progetto : " & saveFileDialog1.FileName)
Utility.LockDir(Path.GetDirectoryName(saveFileDialog1.FileName), Path.GetFileNameWithoutExtension(saveFileDialog1.FileName))
Map.refAssemblyManagerVM.VisibilityDoorList = Visibility.Collapsed
CurrProject.NotifyPropertyChanged("Name")
End If
@@ -437,80 +440,80 @@ Public Class ProjectManagerVM
Public Sub DeleteCmd()
Utility.OutLog(" +++ Delete +++")
Utility.UnLockDir()
If OptionModule.m_SingleDoor then
If OptionModule.m_SingleDoor Then
Map.refAssemblyManagerVM.RemoveAssembly()
Else
DeleteProject()
End If
End Sub
Public Sub DeleteProject()
If Not OptionModule.m_DeleteProject then Return
If IsNothing(Map.refAssemblyManagerVM.CurrProject) OrElse String.IsNullOrEmpty( Map.refAssemblyManagerVM.CurrProject.Name) Then
If Not OptionModule.m_DeleteProject Then Return
If IsNothing(Map.refAssemblyManagerVM.CurrProject) OrElse String.IsNullOrEmpty(Map.refAssemblyManagerVM.CurrProject.Name) Then
' 50535 = Impossible to delete a project if there is not a project!
MessageBox.Show(EgtMsg(50535), EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning)
Return
End If
' 50536 = Do you want to delete entire project?
If MessageBox.Show(EgtMsg(50536), EgtMsg(50144), MessageBoxButton.YesNo, MessageBoxImage.Asterisk) <> MessageBoxResult.Yes then
If MessageBox.Show(EgtMsg(50536), EgtMsg(50144), MessageBoxButton.YesNo, MessageBoxImage.Asterisk) <> MessageBoxResult.Yes Then
Return
End If
' svuoto il direttorio corrente dei file
If Not DeleteDDFFile( Map.refAssemblyManagerVM.CurrProject.Name) then
If Not DeleteDDFFile(Map.refAssemblyManagerVM.CurrProject.Name) Then
Return
End If
' elimina il direttorio solo se è vuoto
Try
If Directory.GetFiles(Map.refAssemblyManagerVM.CurrProject.Name).Count = 0 then
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nNothingSelected
If Directory.GetFiles(Map.refAssemblyManagerVM.CurrProject.Name).Count = 0 Then
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nNothingSelected
EgtNewFile()
EgtZoom(ZM.ALL)
Directory.Delete(Map.refAssemblyManagerVM.CurrProject.Name)
Map.refAssemblyManagerVM.CurrProject = Nothing
Map.refAssemblyManagerVM.VisibilityDoorList = Visibility.Hidden
Map.refAssemblyManagerVM.VisibilityDoorList = Visibility.Hidden
Map.refMainWindowVM.ProjectNameMsg = ""
Return
End If
Catch ex As Exception
End Try
If Not IsNothing(Map.refAssemblyManagerVM.CurrProject) then
Map.refAssemblyManagerVM.RefreshAssembly()
If Not IsNothing(Map.refAssemblyManagerVM.CurrProject) Then
Map.refAssemblyManagerVM.RefreshAssembly()
End If
End Sub
Private Function DeleteDDFFile( sDirPath as String) As Boolean
Private Function DeleteDDFFile(sDirPath As String) As Boolean
' recupero l'elenco dei file presenti nel direttorio
Dim FileArray() As String = Directory.GetFiles(sDirPath)
' verificio che non ci siano file bloccati nel direttorio indicato
For Each sFile In FileArray
If Utility.IsFileLocked(Path.GetDirectoryName(sFile),Path.GetFileNameWithoutExtension(sFile)) then
For Each sFile In FileArray
If Utility.IsFileLocked(Path.GetDirectoryName(sFile), Path.GetFileNameWithoutExtension(sFile)) Then
Return False
End If
Next
' procedo all'eliminazione dei file nel direttorio corrente
For Each sFile In FileArray
For Each sFile In FileArray
Try
File.Delete(sFile)
Catch ex As Exception
End Try
End Try
Next
' recupero l'elenco dei sottodirettori presenti nel direttorio corrente
Dim SubDirArray() As String = Directory.GetDirectories(sDirPath)
If SubDirArray.Count > 0 then
For Each sSubDir In SubDirArray
If SubDirArray.Count > 0 Then
For Each sSubDir In SubDirArray
' 50537 = Do you want to delete subdirectory {0} ?
If MessageBox.Show(String.Format( EgtMsg(50537), sSubDir), EgtMsg(50144), MessageBoxButton.YesNo, MessageBoxImage.Question) <> MessageBoxResult.Yes then
If MessageBox.Show(String.Format(EgtMsg(50537), sSubDir), EgtMsg(50144), MessageBoxButton.YesNo, MessageBoxImage.Question) <> MessageBoxResult.Yes Then
Continue For
End If
' se decido di eliminare il sottodirettorio devo svuotarlo da tutti i file
If Not DeleteDDFFile( sSubDir) then
If Not DeleteDDFFile(sSubDir) Then
Continue For
End If
Try
' se il direttorio è vuoto allora posso eliminarlo
If Directory.GetFiles(sSubDir).Count = 0 then
Directory.Delete( sSubDir)
If Directory.GetFiles(sSubDir).Count = 0 Then
Directory.Delete(sSubDir)
End If
Catch ex As Exception
End Try
@@ -557,13 +560,13 @@ Public Class ProjectManagerVM
End Select
End If
' VERIFICO IL NOME PROGETTO ( DIERTTORIO/ FILE)
' VERIFICO IL NOME PROGETTO ( DIERTTORIO/ FILE)
If Directory.Exists(sFilePath) AndAlso bIsSingleDoor Then
m_MruFiles.Remove(sFilePath)
bValidPath = False
ElseIf Directory.Exists(sFilePath) AndAlso Not bIsSingleDoor Then
sFilePathComplete = sFilePath
bValidPath = true
bValidPath = True
ElseIf File.Exists(sFilePath) Then
sFilePathComplete = sFilePath
sFilePath = Path.GetDirectoryName(sFilePath)
@@ -584,7 +587,7 @@ Public Class ProjectManagerVM
bValidPath = False
End If
' CARCIO IL NOME DIRETTORIO
' CARCIO IL NOME DIRETTORIO
' Se FilePath non valida
If Not bValidPath Then
'If OptionModule.m_SingleDoor OrElse Keyboard.Modifiers.HasFlag(ModifierKeys.Shift) Then
@@ -631,7 +634,7 @@ Public Class ProjectManagerVM
Else
' dichiaro la finestra di scelta cartella di progetto
Dim FolderBrowserDialog As New System.Windows.Forms.FolderBrowserDialog
If Not IsNothing(Map.refAssemblyManagerVM.CurrProject) andalso Not String.IsNullOrWhiteSpace(Map.refAssemblyManagerVM.CurrProject.Name) Then
If Not IsNothing(Map.refAssemblyManagerVM.CurrProject) AndAlso Not String.IsNullOrWhiteSpace(Map.refAssemblyManagerVM.CurrProject.Name) Then
FolderBrowserDialog.SelectedPath = Map.refAssemblyManagerVM.CurrProject.Name
ElseIf Not String.IsNullOrEmpty(OptionModule.m_sLastProject) Then
FolderBrowserDialog.SelectedPath = Path.GetDirectoryName(OptionModule.m_sLastProject)
@@ -650,8 +653,8 @@ Public Class ProjectManagerVM
' salvo il nome del direttorio
sFilePath = FolderBrowserDialog.SelectedPath
' se sto eseguendo la selezione dello stesso direttorio allora interrompo
If Not IsNothing (Map.refAssemblyManagerVM.CurrProject) then
If Map.refAssemblyManagerVM.CurrProject.Name = sFilePath then
If Not IsNothing(Map.refAssemblyManagerVM.CurrProject) Then
If Map.refAssemblyManagerVM.CurrProject.Name = sFilePath Then
Return
End If
End If
@@ -662,12 +665,12 @@ Public Class ProjectManagerVM
End If
End If
' CARICO ELENCO FILE
' CARICO ELENCO FILE
Dim CurrProject As Project = New Project
If Not IsNothing(Map.refAssemblyManagerVM.CurrProject) then
If Not IsNothing(Map.refAssemblyManagerVM.CurrProject) Then
CurrProject = Map.refAssemblyManagerVM.CurrProject
Else
Map.refAssemblyManagerVM.CurrProject = CurrProject
Map.refAssemblyManagerVM.CurrProject = CurrProject
End If
' salvo il riferimento al progetto corrente
m_CurrProject = CurrProject
@@ -698,7 +701,7 @@ Public Class ProjectManagerVM
CurrProject.AssemblyList.Add(Local_Assembly)
End If
' SELEZIONE FILE DA ELENCO
' SELEZIONE FILE DA ELENCO
' Notifico aggiornamento DoorList per aggiornare la grafica
CurrProject.NotifyPropertyChanged("AssemblyList")
Utility.UnLockDir()
@@ -708,7 +711,7 @@ Public Class ProjectManagerVM
If Not String.IsNullOrWhiteSpace(sFilePathComplete) Then
For Each ItemFile In CurrProject.AssemblyList
If sFilePathComplete = ItemFile.Name Then
If Not Utility.IsFileLocked(Path.GetDirectoryName(ItemFile.Name), ItemFile.GraphicName, False) then
If Not Utility.IsFileLocked(Path.GetDirectoryName(ItemFile.Name), ItemFile.GraphicName, False) Then
CurrProject.SelAssemblyName = ItemFile
Utility.OutLog("Apertura progetto : " & Map.refAssemblyManagerVM.CurrProject.Name)
Utility.LockDir(Map.refAssemblyManagerVM.CurrProject.Name, Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.GraphicName)
@@ -719,14 +722,14 @@ Public Class ProjectManagerVM
Next
End If
If Not bAssemblyIsSelected Then
For IndexFile As Integer = 0 to CurrProject.AssemblyList.Count -1
If Not Utility.IsFileLocked(Path.GetDirectoryName(CurrProject.AssemblyList(IndexFile).Name), CurrProject.AssemblyList(IndexFile).GraphicName, False) then
For IndexFile As Integer = 0 To CurrProject.AssemblyList.Count - 1
If Not Utility.IsFileLocked(Path.GetDirectoryName(CurrProject.AssemblyList(IndexFile).Name), CurrProject.AssemblyList(IndexFile).GraphicName, False) Then
CurrProject.SelAssemblyName = CurrProject.AssemblyList(IndexFile)
Utility.OutLog("Apertura progetto : " & Map.refAssemblyManagerVM.CurrProject.Name)
Utility.LockDir(Map.refAssemblyManagerVM.CurrProject.Name, Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.GraphicName)
Exit For
End If
Next
Next
End If
Else
Map.refPartPageVM.CurrPart = Nothing
@@ -737,7 +740,7 @@ Public Class ProjectManagerVM
' carico il nome del direttorio e la visbilità della lista delle porte
If bIsSingleDoor Then
If Not IsNothing(CurrProject.SelAssemblyName.Name) then
If Not IsNothing(CurrProject.SelAssemblyName.Name) Then
Map.refMainWindowVM.ProjectNameMsg = CurrProject.SelAssemblyName.Name
End If
Map.refAssemblyManagerVM.VisibilityDoorList = Visibility.Collapsed
@@ -797,7 +800,7 @@ Public Class ProjectManagerVM
Public Sub ReloadCmd()
If OptionModule.m_ConfigurationSoftware = ConfigType.Assembly Then Map.SetRefCompoPanelVM(New CompoPanelVM("PartPage"))
If IsNothing(Map.refAssemblyManagerVM.CurrProject) OrElse IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) Then
If IsNothing(Map.refAssemblyManagerVM.CurrProject) OrElse IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) Then
Return
End If
' Map.refAssemblyManagerVM.LoadTempFile()
@@ -821,7 +824,7 @@ Public Class ProjectManagerVM
Public Sub Save()
' Verifico esista elemento selezionato
If IsNothing(Map.refAssemblyManagerVM.CurrProject) orelse IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) orelse IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name) Then
If IsNothing(Map.refAssemblyManagerVM.CurrProject) OrElse IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) OrElse IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name) Then
' Impossibile savare un file se non esiste una porta! Errore
MessageBox.Show(EgtMsg(50128), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Exclamation)
Return
@@ -885,9 +888,9 @@ Public Class ProjectManagerVM
ElseIf Not Path.HasExtension(OptionModule.m_sLastProject) AndAlso Directory.Exists(OptionModule.m_sLastProject) Then
CurrProject.Name = OptionModule.m_sLastProject
End If
End If
' CARICAMENTO LISTA
End If
' CARICAMENTO LISTA
' ripulisco la lista di porte
CurrProject.AssemblyList.Clear()
' verifico che esista la cartella
@@ -906,7 +909,7 @@ Public Class ProjectManagerVM
Else
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nNothingSelected
Return
End If
End If
Else
' carico un vettore con i file della cartella
Dim DDFFileArray() As String = Directory.GetFiles(CurrProject.Name)
@@ -927,7 +930,7 @@ Public Class ProjectManagerVM
CurrProject.NotifyPropertyChanged("AssemblyList")
Map.refMainWindowVM.ProjectNameMsg = CurrProject.Name
' CARICAMENTO ELEMENTO LISTA
' CARICAMENTO ELEMENTO LISTA
' Se c'è almeno una porta la visualizzo
If CurrProject.AssemblyList.Count > 0 Then
' provo a caricare l'ultimo file aperto cercando nell'elenco dei file del progetto
@@ -937,13 +940,13 @@ Public Class ProjectManagerVM
If ItemFile.Name = OptionModule.m_sLastProject Then
If Utility.IsFileLocked(Path.GetDirectoryName(OptionModule.m_sLastProject), Path.GetFileNameWithoutExtension(OptionModule.m_sLastProject)) Then
Utility.OutLog("Annullata apertura ultimo progetto : " & OptionModule.m_sLastProject)
Exit for
Exit For
End If
CurrProject.SelAssemblyName = ItemFile
'If OptionModule.m_SingleDoor Then
Map.refMainWindowVM.ProjectNameMsg = OptionModule.m_sLastProject
Utility.OutLog("Blocco progetto : " & CurrProject.SelAssemblyName.GraphicName)
Utility.LockDir(CurrProject.Name, CurrProject.SelAssemblyName.GraphicName)
Map.refMainWindowVM.ProjectNameMsg = OptionModule.m_sLastProject
Utility.OutLog("Blocco progetto : " & CurrProject.SelAssemblyName.GraphicName)
Utility.LockDir(CurrProject.Name, CurrProject.SelAssemblyName.GraphicName)
'End If
Return
End If
@@ -952,23 +955,23 @@ Public Class ProjectManagerVM
End If
' se non esiste il file allora provo a caricare il primo della lista
Dim bFileExist As Boolean = False
For IndexFile As Integer = 0 To CurrProject.AssemblyList.Count - 1
If File.Exists(CurrProject.AssemblyList(IndexFile).Name) and
For IndexFile As Integer = 0 To CurrProject.AssemblyList.Count - 1
If File.Exists(CurrProject.AssemblyList(IndexFile).Name) And
Not Utility.IsFileLocked(Path.GetDirectoryName(CurrProject.AssemblyList(IndexFile).Name),
Path.GetFileNameWithoutExtension(CurrProject.AssemblyList(IndexFile).Name), False) Then
'CurrProject.VerifySelAssemblyName(CurrProject.AssemblyList(IndexFile))
CurrProject.SelAssemblyName = CurrProject.AssemblyList(IndexFile)
'If OptionModule.m_SingleDoor Then
Utility.LockDir(CurrProject.Name, CurrProject.SelAssemblyName.GraphicName)
Map.refMainWindowVM.ProjectNameMsg = CurrProject.AssemblyList(IndexFile).Name
Utility.LockDir(CurrProject.Name, CurrProject.SelAssemblyName.GraphicName)
Map.refMainWindowVM.ProjectNameMsg = CurrProject.AssemblyList(IndexFile).Name
'End If
bFileExist = true
Exit for
'Else
' Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nNothingSelected
bFileExist = True
Exit For
'Else
' Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nNothingSelected
End If
Next
If Not bFileExist then
If Not bFileExist Then
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nNothingSelected
End If
Else
@@ -1100,7 +1103,7 @@ Public Class ProjectManagerVM
End Property
Public Sub CreateTemplate()
If IsNothing(Map.refAssemblyManagerVM.CurrProject) orelse IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) orelse IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name) Then
If IsNothing(Map.refAssemblyManagerVM.CurrProject) OrElse IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) OrElse IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name) Then
' 50538 = Impossibile savare un file se non esiste una porta! Errore
MessageBox.Show(EgtMsg(50538), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Exclamation)
Return
@@ -1263,9 +1266,9 @@ Public Class ProjectManagerVM
ElseIf Trim(SaveFileDialog.InitialDirectory.ToLower) <> Trim(Path.GetDirectoryName(SaveFileDialog.FileName).ToLower) And Not OptionModule.m_SingleDoor Then
' 50539 = Do you want to change project? Question
Dim ResultMsg As MessageBoxResult = MessageBox.Show(EgtMsg(50539), EgtMsg(50110), MessageBoxButton.YesNoCancel, MessageBoxImage.Warning)
If ResultMsg = MessageBoxResult.Cancel Then
return
ElseIf ResultMsg = MessageBoxResult.No then
If ResultMsg = MessageBoxResult.Cancel Then
Return
ElseIf ResultMsg = MessageBoxResult.No Then
bChangeProject = False
End If
End If
@@ -1274,10 +1277,10 @@ Public Class ProjectManagerVM
LocalCurrProject.Name = Path.GetDirectoryName(SaveFileDialog.FileName)
LocalCurrProject.AssemblyList = New ObservableCollection(Of AssemblyName)
Dim DDFFileArray() As String = Directory.GetFiles(LocalCurrProject.Name)
' ripulisco il nome della porta (cancello tutto il percorso del file lasciando solo il nome del file)
' ripulisco il nome della porta (cancello tutto il percorso del file lasciando solo il nome del file)
For DDFIndex = 0 To DDFFileArray.Count - 1
If Path.GetExtension(DDFFileArray(DDFIndex)).ToLower = ".ddf" Then
If Path.GetExtension(DDFFileArray(DDFIndex)) <> DDF_EXTENSION then
If Path.GetExtension(DDFFileArray(DDFIndex)) <> DDF_EXTENSION Then
Continue For
End If
' lo aggiungo alla lista delle porte
@@ -1336,7 +1339,7 @@ Public Class ProjectManagerVM
' aggiungo il nome del file alla lista degli assemblati
Dim Local_AssemblyName As New AssemblyName
Local_AssemblyName.Name = SaveFileDialog.FileName
LocalCurrProject.AssemblyList.Add(Local_AssemblyName)
LocalCurrProject.AssemblyList.Add(Local_AssemblyName)
' Seleziono AssembyName creato
Try
Utility.OutLog("Creazione copia : " & Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name & " -> " & Local_AssemblyName.Name)
@@ -1348,8 +1351,8 @@ Public Class ProjectManagerVM
File.Delete(Local_AssemblyName.Name)
Return
End Try
If bChangeProject then
If bChangeProject Then
Try
Map.refAssemblyManagerVM.CurrProject = LocalCurrProject
LocalCurrProject.SelAssemblyName = LocalCurrProject.AssemblyList.First(Function(x) x.Name = Local_AssemblyName.Name)
@@ -1360,7 +1363,7 @@ Public Class ProjectManagerVM
End If
Map.refAssemblyManagerVM.Save(LocalCurrProject.SelAssemblyName)
'Map.refAssemblyManagerVM.Open(LocalCurrProject.AssemblyList(LocalCurrProject.AssemblyList.Count - 1))
If OptionModule.m_SingleDoor Then
m_MruFiles.Add(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name)
@@ -1368,7 +1371,7 @@ Public Class ProjectManagerVM
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.GraphicName)
Else
m_MruFiles.Add(Map.refAssemblyManagerVM.CurrProject.Name)
If Not String.IsNullOrEmpty(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.GraphicName) then
If Not String.IsNullOrEmpty(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.GraphicName) Then
Utility.LockDir(Path.GetDirectoryName(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name),
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.GraphicName)
End If
@@ -1414,7 +1417,7 @@ Public Class ProjectManagerVM
Map.refProjectManagerHardwareVM.HardwareIsChecked = True
End Sub
Private m_DoorIsChecked As Boolean =True
Private m_DoorIsChecked As Boolean = True
Public Property DoorIsChecked As Boolean
Get
Return m_DoorIsChecked
@@ -1451,9 +1454,8 @@ Public Class ProjectManagerVM
MessageBox.Show(EgtMsg(50186), EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning)
Return
End If
Dim PrintWindow As New PrintWndV(Application.Current.MainWindow, New PrintWndVM)
PrintWindow.Height = 550
PrintWindow.Width = 650
PrintWindow.ShowDialog()
End Sub
@@ -1494,7 +1496,7 @@ Public Class ProjectManagerVM
End Property
Public Sub CreateAssembly()
Map.refAssemblyPageVM.CurrAssembly.CreateAssembly()
Map.refAssemblyPageVM.CurrAssembly.CreateAssembly()
End Sub
#End Region ' CreateAssemblyCommand
@@ -1503,8 +1505,19 @@ Public Class ProjectManagerVM
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
Public NotInheritable Class ObjectDataProvider
'Implements ICanHandleUsedIdentifiers, IDataProvider, ISupportsLogger
End Class
Public Sub NotifyPropertyChanged(propName As String)
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
End Sub
End Class
Public NotInheritable Class ObjectDataProvider
Private order As ReportOrder
Public Sub New(order As ReportOrder)
Me.order = order
End Sub
End Class