EgtDOORCreator 2.1i1 :
-> aggiunta di un bottone nella TextBoxNge per eliminare la geometria; -> sostituito il comando duplica con il comando Save As; -> gestione della multilettura di un file ddf.
This commit is contained in:
@@ -218,6 +218,7 @@ Public Class ProjectManagerVM
|
||||
End Property
|
||||
|
||||
Public Sub NewCmd()
|
||||
Utility.OutLog(" +++ NewProject +++")
|
||||
Utility.UnLockDir()
|
||||
' Gestisco porta corrente modificata
|
||||
If Not Map.refAssemblyManagerVM.ManageModified() Then Return
|
||||
@@ -228,23 +229,52 @@ Public Class ProjectManagerVM
|
||||
SaveFileDialog.Title = EgtMsg(50304)
|
||||
SaveFileDialog.Directory = IniFile.m_MyProjectDir
|
||||
SaveFileDialog.Extension = "\"
|
||||
' se annullo la creazione di un nuovo direttorio, rimango in quello attuale
|
||||
If Not SaveFileDialogWnd.ShowDialog Then
|
||||
Map.refAssemblyManagerVM.Open(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName)
|
||||
Utility.LockDir(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name)
|
||||
Utility.OutLog("Annullata la creazione di un nuovo progetto")
|
||||
If Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) Then
|
||||
Utility.OutLog("Apertura progetto : " & Map.refAssemblyManagerVM.CurrProject.Name)
|
||||
Utility.LockDir(Map.refAssemblyManagerVM.CurrProject.Name)
|
||||
'Map.refAssemblyManagerVM.Open(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName)
|
||||
End If
|
||||
Return
|
||||
End If
|
||||
' controllo che il direttorio non esista
|
||||
Dim MsgResult As MessageBoxResult = MessageBoxResult.Yes
|
||||
If Directory.Exists(SaveFileDialog.FileName) Then
|
||||
MsgResult = MessageBox.Show("Directory " & SaveFileDialog.FileName & " already exists! Do you want to overwrite it?", "Caution", MessageBoxButton.YesNo, MessageBoxImage.Asterisk)
|
||||
If Utility.VerifyFileLocked(SaveFileDialog.FileName) Then
|
||||
If Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) Then
|
||||
Utility.OutLog("Apertura progetto : " & Map.refAssemblyManagerVM.CurrProject.Name)
|
||||
Utility.LockDir(Map.refAssemblyManagerVM.CurrProject.Name)
|
||||
End If
|
||||
Return
|
||||
End If
|
||||
' 50526 = Directory " & SaveFileDialog.FileName & " already exists! Do you want to overwrite it?
|
||||
' 50144 = Warning
|
||||
String.Format(EgtMsg(50526), SaveFileDialog.FileName)
|
||||
MsgResult = MessageBox.Show(String.Format(EgtMsg(50526), SaveFileDialog.FileName), EgtMsg(50144), MessageBoxButton.YesNo, MessageBoxImage.Asterisk)
|
||||
' cancello il direttorio
|
||||
Directory.Delete(SaveFileDialog.FileName, True)
|
||||
Try
|
||||
Directory.Delete(SaveFileDialog.FileName, True)
|
||||
Utility.OutLog("Sovrascrittura delprogetto esistente : " & SaveFileDialog.FileName)
|
||||
Catch ex As Exception
|
||||
' 50527 = Impossible to overwrite {0}
|
||||
MessageBox.Show(String.Format(EgtMsg(50527), SaveFileDialog.FileName), EgtMsg(501001), MessageBoxButton.OK, MessageBoxImage.Error)
|
||||
Return
|
||||
End Try
|
||||
End If
|
||||
' se decido di non sovrascrivere allora rimango in quello attuale
|
||||
If MsgResult = MessageBoxResult.No Then
|
||||
Map.refAssemblyManagerVM.Open(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName)
|
||||
Utility.LockDir(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name)
|
||||
Utility.OutLog("Annullata sovrascrittura delprogetto esistente : " & SaveFileDialog.FileName)
|
||||
If Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) Then
|
||||
Utility.OutLog("Apertura progetto : " & Map.refAssemblyManagerVM.CurrProject.Name)
|
||||
Utility.LockDir(Map.refAssemblyManagerVM.CurrProject.Name)
|
||||
'Map.refAssemblyManagerVM.Open(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName)
|
||||
End If
|
||||
Return
|
||||
End If
|
||||
|
||||
Utility.OutLog("Creazione nuovo progetto : " & SaveFileDialog.FileName)
|
||||
' Creo nuovo progetto
|
||||
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nNothingSelected
|
||||
Directory.CreateDirectory(SaveFileDialog.FileName)
|
||||
@@ -286,7 +316,13 @@ Public Class ProjectManagerVM
|
||||
End If
|
||||
' apro la finestra di dialogo
|
||||
If saveFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
|
||||
' ripulisco il nome da eventuali spazi
|
||||
If Utility.VerifyFileLocked(Path.GetDirectoryName(saveFileDialog1.FileName), Path.GetFileNameWithoutExtension(saveFileDialog1.FileName)) Then
|
||||
Utility.OutLog("Apertura progetto : " & Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name)
|
||||
Utility.LockDir(Map.refAssemblyManagerVM.CurrProject.Name, Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.GraphicName)
|
||||
Return
|
||||
End If
|
||||
Utility.OutLog("Creazione nuovo progetto : " & saveFileDialog1.FileName)
|
||||
Utility.LockDir(Path.GetDirectoryName(saveFileDialog1.FileName), Path.GetFileNameWithoutExtension(saveFileDialog1.FileName))
|
||||
Dim FilePath As String = Path.GetFileNameWithoutExtension(saveFileDialog1.FileName)
|
||||
saveFileDialog1.FileName = saveFileDialog1.FileName.Replace(FilePath, Trim(FilePath))
|
||||
Dim FilePathComplete As String = saveFileDialog1.FileName
|
||||
@@ -307,10 +343,7 @@ Public Class ProjectManagerVM
|
||||
' Seleziono AssembyName creato
|
||||
m_CurrProject.SelAssemblyName = Local_AssemblyName
|
||||
' Creo nuovo assembly
|
||||
If Map.refAssemblyManagerVM.ImportTemplate(sImportTemplate) Then
|
||||
Utility.LockDir(Path.GetDirectoryName(FilePathComplete))
|
||||
Return
|
||||
End If
|
||||
Map.refAssemblyManagerVM.ImportTemplate(sImportTemplate)
|
||||
Map.refAssemblyManagerVM.NewCmd(Local_AssemblyName)
|
||||
' carico il nome come Assemblato selezionato
|
||||
If Not OptionModule.m_DisableWindowOrder Then
|
||||
@@ -320,7 +353,6 @@ Public Class ProjectManagerVM
|
||||
' tolgo la visualizzazione della lista dei nomi
|
||||
Map.refAssemblyManagerVM.VisibilityDoorList = Visibility.Collapsed
|
||||
CurrProject.NotifyPropertyChanged("Name")
|
||||
Utility.LockDir(Path.GetDirectoryName(FilePathComplete))
|
||||
End If
|
||||
|
||||
End Sub
|
||||
@@ -339,6 +371,8 @@ Public Class ProjectManagerVM
|
||||
End Property
|
||||
|
||||
Public Sub DeleteCmd()
|
||||
Utility.OutLog(" +++ Delete +++")
|
||||
Utility.UnLockDir()
|
||||
Map.refAssemblyManagerVM.RemoveAssembly()
|
||||
End Sub
|
||||
|
||||
@@ -360,6 +394,7 @@ Public Class ProjectManagerVM
|
||||
End Sub
|
||||
|
||||
Public Sub OpenProject(sFilePath As String)
|
||||
Utility.OutLog(" +++ OpenProject +++")
|
||||
Utility.UnLockDir()
|
||||
' se true carica una singola porta del progetto
|
||||
Dim bIsSingleDoor As Boolean = OptionModule.m_SingleDoor
|
||||
@@ -379,6 +414,16 @@ Public Class ProjectManagerVM
|
||||
End If
|
||||
|
||||
If Directory.Exists(sFilePath) AndAlso Not bIsSingleDoor Then
|
||||
' se esiste un file in lettura con questo nome allora blocco tutto
|
||||
If Utility.VerifyFileLocked(sFilePath, Path.GetFileNameWithoutExtension(sFilePathComplete)) Then
|
||||
Utility.OutLog("Annullo l'apertura di : " & sFilePathComplete)
|
||||
If Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) Then
|
||||
Utility.OutLog("Apertura progetto : " & Map.refAssemblyManagerVM.CurrProject.Name)
|
||||
Utility.LockDir(Map.refAssemblyManagerVM.CurrProject.Name)
|
||||
'Map.refAssemblyManagerVM.Open(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName)
|
||||
End If
|
||||
Return
|
||||
End If
|
||||
bValidPath = True
|
||||
ElseIf Directory.Exists(sFilePath) AndAlso bIsSingleDoor Then
|
||||
m_MruFiles.Remove(sFilePath)
|
||||
@@ -386,6 +431,16 @@ Public Class ProjectManagerVM
|
||||
ElseIf File.Exists(sFilePath) Then
|
||||
sFilePathComplete = sFilePath
|
||||
sFilePath = Path.GetDirectoryName(sFilePath)
|
||||
' se esiste un file in lettura con questo nome allora blocco tutto
|
||||
If Utility.VerifyFileLocked(sFilePath, Path.GetFileNameWithoutExtension(sFilePathComplete)) Then
|
||||
Utility.OutLog("Annullo l'apertura di : " & sFilePathComplete)
|
||||
If Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) Then
|
||||
Utility.OutLog("Apertura progetto : " & Map.refAssemblyManagerVM.CurrProject.Name)
|
||||
Utility.LockDir(Map.refAssemblyManagerVM.CurrProject.Name)
|
||||
'Map.refAssemblyManagerVM.Open(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName)
|
||||
End If
|
||||
Return
|
||||
End If
|
||||
bValidPath = True
|
||||
Else
|
||||
' elimino eventual FilePath inesistente dalla lista dei recenti
|
||||
@@ -395,7 +450,6 @@ Public Class ProjectManagerVM
|
||||
|
||||
' Se FilePath non valida
|
||||
If Not bValidPath Then
|
||||
|
||||
'If OptionModule.m_SingleDoor OrElse Keyboard.Modifiers.HasFlag(ModifierKeys.Shift) Then
|
||||
If OptionModule.m_SingleDoor Then
|
||||
bIsSingleDoor = True
|
||||
@@ -423,6 +477,15 @@ Public Class ProjectManagerVM
|
||||
sFilePath = Path.GetDirectoryName(fd.FileName)
|
||||
' salvo il nome completo del file
|
||||
sFilePathComplete = fd.FileName
|
||||
' se esiste un file in lettura con questo nome allora blocco tutto
|
||||
If Utility.VerifyFileLocked(sFilePath, Path.GetFileNameWithoutExtension(sFilePathComplete)) Then
|
||||
If Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) Then
|
||||
Utility.OutLog("Apertura progetto : " & Map.refAssemblyManagerVM.CurrProject.Name)
|
||||
Utility.LockDir(Map.refAssemblyManagerVM.CurrProject.Name, Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.GraphicName)
|
||||
'Map.refAssemblyManagerVM.Open(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName)
|
||||
End If
|
||||
Return
|
||||
End If
|
||||
Else
|
||||
' dichiaro la finestra di scelta cartella di progetto
|
||||
Dim FolderBrowserDialog As New System.Windows.Forms.FolderBrowserDialog
|
||||
@@ -440,6 +503,10 @@ Public Class ProjectManagerVM
|
||||
End If
|
||||
' salvo il nome del direttorio
|
||||
sFilePath = FolderBrowserDialog.SelectedPath
|
||||
' se esiste un file in lettura con questo nome allora blocco tutto
|
||||
If Utility.VerifyFileLocked(sFilePath) Then
|
||||
Return
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -497,6 +564,7 @@ Public Class ProjectManagerVM
|
||||
EgtNewFile()
|
||||
EgtZoom(ZM.ALL)
|
||||
End If
|
||||
Utility.OutLog("Apertura file : " & CurrProject.SelAssemblyName.Name)
|
||||
' carico il nome del direttorio e la visbilità della lista delle porte
|
||||
If bIsSingleDoor Then
|
||||
Map.refMainWindowVM.ProjectNameMsg = CurrProject.SelAssemblyName.Name
|
||||
@@ -518,7 +586,7 @@ Public Class ProjectManagerVM
|
||||
' Map.refOptionsVM.MyProjectDir = sFilePath
|
||||
If bIsSingleDoor Then
|
||||
m_MruFiles.Add(CurrProject.SelAssemblyName.Name)
|
||||
Utility.LockDir(Path.GetDirectoryName(CurrProject.SelAssemblyName.Name))
|
||||
Utility.LockDir(Path.GetDirectoryName(CurrProject.SelAssemblyName.Name), CurrProject.SelAssemblyName.GraphicName)
|
||||
Else
|
||||
m_MruFiles.Add(sFilePath)
|
||||
Utility.LockDir(sFilePath)
|
||||
@@ -633,15 +701,7 @@ Public Class ProjectManagerVM
|
||||
End Property
|
||||
|
||||
Public Sub OpenLastProject()
|
||||
'' Apro l'ultimo progetto
|
||||
'Dim CurrName As String = String.Empty
|
||||
'' verifico se esiste una precedente selezione
|
||||
'If Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) Then
|
||||
' If Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name) Then
|
||||
' CurrName = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name
|
||||
' End If
|
||||
'End If
|
||||
|
||||
Utility.OutLog(" +++ OpenLastProject +++")
|
||||
Dim CurrProject As Project = Map.refAssemblyManagerVM.CurrProject
|
||||
' carico il percorso dell'ultimo progetto salvato (sul file Config.ini)
|
||||
If IsNothing(CurrProject.Name) Then
|
||||
@@ -661,15 +721,20 @@ Public Class ProjectManagerVM
|
||||
' carico la singola porta dell'ultimo progetto come unica porta
|
||||
If OptionModule.m_SingleDoor Then
|
||||
Dim Local_Assembly As New AssemblyName
|
||||
If File.Exists(OptionModule.m_sLastProject) Then
|
||||
' verifico che il file selezionato esista e non sia in lettura
|
||||
If File.Exists(OptionModule.m_sLastProject) And
|
||||
Not Utility.VerifyFileLocked(Path.GetDirectoryName(OptionModule.m_sLastProject), Path.GetFileNameWithoutExtension(OptionModule.m_sLastProject)) Then
|
||||
Local_Assembly.Name = OptionModule.m_sLastProject
|
||||
Local_Assembly.IsModified = False
|
||||
CurrProject.AssemblyList.Add(Local_Assembly)
|
||||
Else
|
||||
' Aggiungo il primo nome all'elenco
|
||||
Dim DDFFileArray() As String = Directory.GetFiles(CurrProject.Name)
|
||||
Utility.OutLog("Cerco il primo file disponibile nel progetto : " & CurrProject.Name)
|
||||
For DDFIndex = 0 To DDFFileArray.Count - 1
|
||||
If Path.GetExtension(DDFFileArray(DDFIndex)).ToLower = ".ddf" Then
|
||||
' verifico che il file sia un ddf e non sia in lettura - se il file che trovo è in lettura restituisce un messaggio !! da togliere !!
|
||||
If Path.GetExtension(DDFFileArray(DDFIndex)).ToLower = ".ddf" And
|
||||
Not Utility.VerifyFileLocked(Path.GetDirectoryName(DDFFileArray(DDFIndex)), DDFFileArray(DDFIndex), False) Then
|
||||
OptionModule.m_sLastProject = DDFFileArray(DDFIndex)
|
||||
Local_Assembly.Name = OptionModule.m_sLastProject
|
||||
Local_Assembly.IsModified = False
|
||||
@@ -679,7 +744,16 @@ Public Class ProjectManagerVM
|
||||
Next
|
||||
End If
|
||||
Map.refAssemblyManagerVM.VisibilityDoorList = Visibility.Collapsed
|
||||
|
||||
Else
|
||||
'-------------------------------------------------------------------------------------------------
|
||||
' se esiste un file in lettura con questo nome allora blocco tutto
|
||||
If Utility.VerifyFileLocked(CurrProject.Name) Then
|
||||
Utility.OutLog("Annullata apertura ultimo progetto : " & CurrProject.Name)
|
||||
Map.refMainWindowVM.AssemblyManagerControl.Visibility = Visibility.Collapsed
|
||||
Return
|
||||
End If
|
||||
'-------------------------------------------------------------------------------------------------
|
||||
' carico un vettore con i file della cartella
|
||||
Dim DDFFileArray() As String = Directory.GetFiles(CurrProject.Name)
|
||||
' ripulisco il nome della porta (cancello tutto il percorso del file lasciando solo il nome del file)
|
||||
@@ -699,29 +773,22 @@ Public Class ProjectManagerVM
|
||||
CurrProject.NotifyPropertyChanged("Name")
|
||||
CurrProject.NotifyPropertyChanged("AssemblyList")
|
||||
Map.refMainWindowVM.ProjectNameMsg = CurrProject.Name
|
||||
Utility.LockDir(CurrProject.Name)
|
||||
'Map.refOptionsVM.MyProjectDir = CurrProject.Name
|
||||
'Map.refMainWindowVM.ModifyTitle(False)
|
||||
If Not OptionModule.m_SingleDoor Then
|
||||
Utility.LockDir(CurrProject.Name)
|
||||
End If
|
||||
|
||||
' Se c'è almeno una porta la visualizzo
|
||||
If CurrProject.AssemblyList.Count > 0 Then
|
||||
'If Not String.IsNullOrEmpty(CurrName) Then
|
||||
' ' ricerco nell'elenco la porta salvata
|
||||
' For IndexListAss As Integer = 0 To CurrProject.AssemblyList.Count - 1
|
||||
' If CurrName = CurrProject.AssemblyList(IndexListAss).Name Then
|
||||
' CurrProject.SelAssemblyName = CurrProject.AssemblyList(IndexListAss)
|
||||
' Return
|
||||
' End If
|
||||
' Next
|
||||
'End If
|
||||
|
||||
' provo a caricare l'ultimo file aperto
|
||||
' provo a caricare l'ultimo file aperto cercando nell'elenco dei file del progetto
|
||||
If File.Exists(OptionModule.m_sLastProject) Then
|
||||
For Each ItemFile In CurrProject.AssemblyList
|
||||
Dim Index As Integer = 1
|
||||
If ItemFile.Name = OptionModule.m_sLastProject Then
|
||||
CurrProject.SelAssemblyName = ItemFile
|
||||
If OptionModule.m_SingleDoor Then Map.refMainWindowVM.ProjectNameMsg = OptionModule.m_sLastProject
|
||||
If OptionModule.m_SingleDoor Then
|
||||
Map.refMainWindowVM.ProjectNameMsg = OptionModule.m_sLastProject
|
||||
Utility.LockDir(CurrProject.Name, CurrProject.SelAssemblyName.GraphicName)
|
||||
End If
|
||||
Return
|
||||
End If
|
||||
Index = Index + 1
|
||||
@@ -730,7 +797,10 @@ Public Class ProjectManagerVM
|
||||
' se non esiste il file allora provo a caricare il primo della lista
|
||||
If File.Exists(CurrProject.AssemblyList(0).Name) Then
|
||||
CurrProject.SelAssemblyName = CurrProject.AssemblyList(0)
|
||||
If OptionModule.m_SingleDoor Then Map.refMainWindowVM.ProjectNameMsg = CurrProject.AssemblyList(0).Name
|
||||
If OptionModule.m_SingleDoor Then
|
||||
Utility.LockDir(CurrProject.Name, CurrProject.SelAssemblyName.GraphicName)
|
||||
Map.refMainWindowVM.ProjectNameMsg = CurrProject.AssemblyList(0).Name
|
||||
End If
|
||||
Else
|
||||
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nNothingSelected
|
||||
End If
|
||||
@@ -992,6 +1062,7 @@ Public Class ProjectManagerVM
|
||||
End Property
|
||||
|
||||
Public Sub Duplica()
|
||||
Utility.OutLog(" +++ SaveAs +++")
|
||||
' questo test potrebbe essere sostituito con il controllo : If IsNothing(Map.refPartPageVM.CurrPart) Then Return
|
||||
If IsNothing(Map.refAssemblyManagerVM.CurrProject) OrElse
|
||||
IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) Then
|
||||
@@ -1007,21 +1078,42 @@ Public Class ProjectManagerVM
|
||||
Dim LocalCurrProject As New Project
|
||||
LocalCurrProject = Map.refAssemblyManagerVM.CurrProject
|
||||
' Creo nuovo assembly
|
||||
Dim SaveFileDialog As New System.Windows.Forms.SaveFileDialog()
|
||||
SaveFileDialog.Filter = "(*.ddf) |*.ddf"
|
||||
SaveFileDialog.FilterIndex = 2
|
||||
' avvio la ricerca nell'ultimo direttorio aperto
|
||||
SaveFileDialog.InitialDirectory = LocalCurrProject.Name
|
||||
' apro la finestra di dialogo
|
||||
If SaveFileDialog.ShowDialog() <> System.Windows.Forms.DialogResult.OK Then
|
||||
Utility.OutLog("Annullata creazione di una copia di : " & Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name)
|
||||
Return
|
||||
ElseIf SaveFileDialog.InitialDirectory <> Path.GetDirectoryName(SaveFileDialog.FileName) And Not OptionModule.m_SingleDoor Then
|
||||
' 50528 = Impossibile salvare file fuori dal progetto! Errore
|
||||
MessageBox.Show(EgtMsg(50528), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Exclamation)
|
||||
Utility.OutLog("Annullata creazione di una copia di : " & Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name)
|
||||
Return
|
||||
End If
|
||||
|
||||
' controllo che il direttorio non esista
|
||||
'---------------------------------------------------------------------------------------------------------------------------------------
|
||||
' in questa versione viene visualizzata solo la casella per inserire il nome del file
|
||||
|
||||
' 'Lancio la finestra per chiedere il nome dell'assemblato
|
||||
' Dim SaveFileDialog As New EgtWPFLib5.SaveFileDialogVM
|
||||
' Dim SaveFileDialogWnd As New EgtWPFLib5.SaveFileDialogV(Application.Current.MainWindow, SaveFileDialog)
|
||||
' ' New Door
|
||||
' SaveFileDialog.Title = EgtMsg(50113)
|
||||
' SaveFileDialog.Directory = LocalCurrProject.Name
|
||||
' SaveFileDialog.Extension = DDF_EXTENSION
|
||||
' ' Se annullo esco
|
||||
' If Not SaveFileDialogWnd.ShowDialog Then Return
|
||||
|
||||
'---------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
' Lancio la finestra per chiedere il nome dell'assemblato
|
||||
'Dim SaveFileDialog As New MySaveFileDialogVM
|
||||
Dim SaveFileDialog As New EgtWPFLib5.SaveFileDialogVM
|
||||
Dim SaveFileDialogWnd As New EgtWPFLib5.SaveFileDialogV(Application.Current.MainWindow, SaveFileDialog)
|
||||
' New Door
|
||||
SaveFileDialog.Title = EgtMsg(50113)
|
||||
SaveFileDialog.Directory = LocalCurrProject.Name
|
||||
SaveFileDialog.Extension = DDF_EXTENSION
|
||||
' Se annullo esco
|
||||
If Not SaveFileDialogWnd.ShowDialog Then Return
|
||||
Dim FilePath As String = Path.GetFileNameWithoutExtension(SaveFileDialog.FileName)
|
||||
SaveFileDialog.FileName = SaveFileDialog.FileName.Replace(FilePath, Trim(FilePath))
|
||||
' Controllo se il nome della porta ha estensione
|
||||
If Path.HasExtension(SaveFileDialog.FileName) Then
|
||||
If Path.HasExtension(SaveFileDialog.FileName) Then
|
||||
Dim sExtension As String = Path.GetExtension(SaveFileDialog.FileName)
|
||||
If Not sExtension.ToLower = DDF_EXTENSION Then
|
||||
SaveFileDialog.FileName = SaveFileDialog.FileName.Replace(sExtension, DDF_EXTENSION)
|
||||
@@ -1029,12 +1121,19 @@ Public Class ProjectManagerVM
|
||||
Else
|
||||
SaveFileDialog.FileName &= DDF_EXTENSION
|
||||
End If
|
||||
|
||||
If OptionModule.m_SingleDoor Then
|
||||
If Utility.VerifyFileLocked(Path.GetDirectoryName(SaveFileDialog.FileName), Path.GetFileNameWithoutExtension(SaveFileDialog.FileName)) Then
|
||||
Utility.OutLog("Annullata creazione di una copia di : " & Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name & " -> " & SaveFileDialog.FileName)
|
||||
Return
|
||||
End If
|
||||
End If
|
||||
|
||||
' controllo che il nome non sia presente nella lista degli assemblati
|
||||
Dim bNameExist As Boolean = False
|
||||
Dim IndexDoorList As Integer
|
||||
For IndexDoorList = 0 To LocalCurrProject.AssemblyList.Count - 1
|
||||
If LocalCurrProject.AssemblyList(IndexDoorList).Name = SaveFileDialog.FileName Then
|
||||
' se il nome è nella lista allora esco dal ciclo e rendo falsa la variabile bNameExist
|
||||
bNameExist = True
|
||||
Exit For
|
||||
End If
|
||||
@@ -1045,6 +1144,7 @@ Public Class ProjectManagerVM
|
||||
' elimino la porta esistente
|
||||
If File.Exists(SaveFileDialog.FileName) Then
|
||||
Try
|
||||
Utility.OutLog("Sovrascrivo file : " & SaveFileDialog.FileName)
|
||||
File.Delete(SaveFileDialog.FileName)
|
||||
Catch ex As FileNotFoundException
|
||||
' non è un problema
|
||||
@@ -1052,16 +1152,20 @@ Public Class ProjectManagerVM
|
||||
' non è un problema
|
||||
End Try
|
||||
End If
|
||||
|
||||
' elimino dalla lista
|
||||
LocalCurrProject.AssemblyList.RemoveAt(IndexDoorList)
|
||||
' ''CurrProject.NotifyPropertyChanged("AssemblyList")
|
||||
End If
|
||||
|
||||
' 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)
|
||||
|
||||
' Seleziono AssembyName creato
|
||||
Try
|
||||
Utility.OutLog("Creazione copia : " & Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name & " -> " & Local_AssemblyName.Name)
|
||||
File.Copy(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name, Local_AssemblyName.Name, True)
|
||||
Catch ex As System.IO.IOException
|
||||
' Error in copying: {0}
|
||||
@@ -1072,12 +1176,13 @@ Public Class ProjectManagerVM
|
||||
End Try
|
||||
LocalCurrProject.SelAssemblyName = Local_AssemblyName
|
||||
Map.refAssemblyManagerVM.Save(LocalCurrProject.SelAssemblyName)
|
||||
Map.refAssemblyManagerVM.Open(LocalCurrProject.AssemblyList(LocalCurrProject.AssemblyList.Count - 1))
|
||||
'Map.refAssemblyManagerVM.Open(LocalCurrProject.AssemblyList(LocalCurrProject.AssemblyList.Count - 1))
|
||||
If OptionModule.m_SingleDoor Then
|
||||
m_MruFiles.Add(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name)
|
||||
Utility.LockDir(Path.GetDirectoryName(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name))
|
||||
Utility.LockDir(Path.GetDirectoryName(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name), Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.GraphicName)
|
||||
Else
|
||||
m_MruFiles.Add(Map.refAssemblyManagerVM.CurrProject.Name)
|
||||
Utility.LockDir(Path.GetDirectoryName(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name))
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -1098,6 +1203,7 @@ Public Class ProjectManagerVM
|
||||
Public Sub GoToHardwarePage()
|
||||
' se decido di annullare l'operazione di salvataggio
|
||||
If Not Map.refAssemblyManagerVM.ManageModified() Then Return
|
||||
Utility.OutLog(" +++ HardwarePage +++")
|
||||
' prima di continuare salvo il riferimento all'ultima cartella aperta
|
||||
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nHardwarePage
|
||||
' nascondo la visibilità del bottone goback dalla lista dei bottoni
|
||||
@@ -1186,7 +1292,7 @@ Public Class ProjectManagerVM
|
||||
End Property
|
||||
|
||||
Public Sub CreateAssembly()
|
||||
Map.refAssemblyPageVM.CurrAssembly.CreateAssembly()
|
||||
Map.refAssemblyPageVM.CurrAssembly.CreateAssembly()
|
||||
End Sub
|
||||
|
||||
#End Region ' CreateAssemblyCommand
|
||||
|
||||
Reference in New Issue
Block a user