EgtDOORCreator 1.8e3 :

- è stato aggiunto il comando "template" che permette di salvare la porta corrente come porta template (con estensione .ddt);
- durante la creazione di una nuova porta è possibile caricare un file .ddt come nuova porta;
- la creazione di un file .ddt in qualsiasi momento non influenza la creazione del file .ddf corrente.
This commit is contained in:
Nicola Pievani
2017-05-11 09:58:31 +00:00
parent 9009abf775
commit a02663d88e
9 changed files with 107 additions and 11 deletions
+43
View File
@@ -32,6 +32,7 @@ Public Class ProjectManagerViewModel
Private m_cmdOptions As ICommand
Private m_CmdLastProject As ICommand
Private m_cmdSendFeedback As ICommand
Private m_CmdCreateTemplate As ICommand
#Region "ToolTip"
@@ -501,6 +502,48 @@ Public Class ProjectManagerViewModel
#End Region ' SendFeedbackCommand
#Region "CreateTemplate"
Public ReadOnly Property CreateTemplateCommand As ICommand
Get
If m_CmdCreateTemplate Is Nothing Then
m_CmdCreateTemplate = New Command(AddressOf CreateTemplate)
End If
Return m_CmdCreateTemplate
End Get
End Property
Public Sub CreateTemplate()
' se esite una porta, allora rendo possibile la creazione di un template della porta corrente
If Not IsNothing(DirectCast(m_rfMainWindowViewModel.DoorParameters.DataContext, DoorParametersViewModel).CurrDoor) Then
Dim rfCurrDoor As Door = DirectCast(m_rfMainWindowViewModel.DoorParameters.DataContext, DoorParametersViewModel).CurrDoor
' Stampo il file correte nella cartella Template
Dim SaveFileDialog As New EgtWPFLib5.EgtSaveFileDialog
SaveFileDialog.Title = K_NEWTEMPLATE
SaveFileDialog.Directory = IniFile.m_TemplateDir & "\"
SaveFileDialog.Extension = K_DDTEXTENSION
'SaveFileDialog.FileName = m_CurrProject.Name & "\"
' se decido di chiuedere la finestra
If Not SaveFileDialog.EgtShowDialog Then
Return
End If
' Controllo se ha estensione il nome della porta
If Path.HasExtension(SaveFileDialog.FileName) Then
Dim sExtension As String = Path.GetExtension(SaveFileDialog.FileName)
If Not sExtension.ToLower = K_DDTEXTENSION Then
SaveFileDialog.FileName = SaveFileDialog.FileName.Replace(sExtension, K_DDTEXTENSION)
End If
Else
SaveFileDialog.FileName &= K_DDTEXTENSION
End If
DdfFile.WriteDDF(rfCurrDoor, SaveFileDialog.FileName, False)
Else
MessageBox.Show("Impossible to create a template if there is not a door!", "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation)
End If
End Sub
#End Region ' CreateTemplate
#End Region ' Commands
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged