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
+2
View File
@@ -60,7 +60,9 @@ Module ConstCompo
Public Const K_ON As String = "ON"
Public Const K_OFF As String = "OFF"
Public Const K_NEWDOOR As String = "New Door"
Public Const K_NEWTEMPLATE As String = "New Template"
Public Const K_DDFEXTENSION As String = ".ddf"
Public Const K_NGEEXTENSION As String = ".nge"
Public Const K_LUAEXTENSION As String = ".lua"
Public Const K_DDTEXTENSION As String = ".ddt"
End Module
+1
View File
@@ -128,6 +128,7 @@ Module ConstIni
Public Const K_TABLESDIR As String = "TablesDir"
Public Const K_COMPODIR As String = "CompoDirectory"
Public Const K_MYPROJECTDIR As String = "ProjectDirectory"
Public Const K_TEMPLATEDIR As String = "TemplateDirectory"
Public Const S_OPTIONS As String = "Options"
+47 -7
View File
@@ -198,6 +198,20 @@ Public Class DoorManagerViewModel
''' </summary>
Public Sub AddDoor()
Dim NameExist As Boolean = True
Dim ImportTemplate As String = String.Empty
'Prima di tutto chiedo se vuole aprire un template
If MessageBox.Show("Do you want to open a template?", "Question", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes) = MessageBoxResult.Yes Then
' Apro la finestra di dailogo aperta direttamente sulla cartella cercata
Dim OpenFileDialog As New System.Windows.Forms.OpenFileDialog
OpenFileDialog.InitialDirectory = IniFile.m_TemplateDir
If OpenFileDialog.ShowDialog <> Forms.DialogResult.OK Then
' se la risposta è diversa da OK esce
Return
End If
' carico l'indirizzo del template che voglio aprire
ImportTemplate = OpenFileDialog.FileName
End If
' lancio la finestra per la creazione di una nuova porta
Dim SaveFileDialog As New EgtWPFLib5.EgtSaveFileDialog
SaveFileDialog.Title = K_NEWDOOR
@@ -217,6 +231,38 @@ Public Class DoorManagerViewModel
Else
SaveFileDialog.FileName &= K_DDFEXTENSION
End If
' aggiungo il nome del file alla lista delle porte
CurrProject.DoorList.Add(SaveFileDialog.FileName)
' aggiorno la lista
CurrProject.NotifyPropertyChanged("DoorList")
NewDoor = True
If String.IsNullOrEmpty(ImportTemplate) Then
NewDoor = True
Else
NewDoor = False
' creo il file ddf associato al template
Dim TemplateDoor As New Door
Door.ReadDDF(ImportTemplate, TemplateDoor)
WriteDDF(TemplateDoor, SaveFileDialog.FileName, True)
' Else
' '' ' prima di procedere nella creazione della porta controllo che non sia aperta una porta in fase di modifica
' '' If Not DdfFile.SetModify(m_rfMainWindowViewModel) Then
' '' ' altrimenti chiedo di salvare il file di disegno
' '' If MessageBox.Show(String.Format(EgtMsg(50109), Path.GetFileNameWithoutExtension(m_SelectedDoor)), EgtMsg(50110), MessageBoxButton.YesNo, MessageBoxImage.Warning) = MessageBoxResult.Yes Then
' '' DdfFile.WriteDDF(DirectCast(m_rfMainWindowViewModel.DoorParameters.DataContext, DoorParametersViewModel).CurrDoor, m_SelectedDoor, True)
' '' DirectCast(m_rfMainWindowViewModel.DoorParameters.DataContext, DoorParametersViewModel).bSetChange = False
' '' End If
' '' End If
' '' ' creo il file ddf associato al template
' '' Dim TemplateDoor As New Door
' '' Door.ReadDDF(ImportTemplate, TemplateDoor)
' '' WriteDDF(TemplateDoor, SaveFileDialog.FileName, True)
' '' TemplateDoor.m_IsModifyDoor = True
' '' CurrProject.NotifyPropertyChanged("DoorList")
End If
SelectedDoor = SaveFileDialog.FileName
DeleteNewDoor = 0
'' '' controllo che il nome del file già non esiste nella lista!
' ''If CurrProject.DoorList.Count > 0 Then
@@ -239,13 +285,7 @@ Public Class DoorManagerViewModel
' ''If NameExist Then Exit Sub
' altrimenti se non esco
' aggiungo il nome del file alla lista delle porte
CurrProject.DoorList.Add(SaveFileDialog.FileName)
' aggiorno la lista
CurrProject.NotifyPropertyChanged("DoorList")
NewDoor = True
SelectedDoor = SaveFileDialog.FileName
DeleteNewDoor = 0
'm_rfMainWindowViewModel.ProjectNameMsg = "*"
End Sub
-1
View File
@@ -9,7 +9,6 @@ Public Class Door
Friend m_IsModifyDoor As Boolean = False
'Private m_rfCompo As Compo
Friend Shared m_rfModifyTitle As Action(Of Boolean)
' restituisce vero/falso valutando se le componenti o le generals della porta sono state modificate
+2
View File
@@ -31,6 +31,8 @@ Friend Module IniFile
Friend m_DefaultIniFile As String = String.Empty
' Path MyProject directory
Friend m_MyProjectDir As String = String.Empty
' Path Template directory
Friend m_TemplateDir As String = String.Empty
' Path Compo directory
Friend m_CompoDir As String = String.Empty
+2 -2
View File
@@ -72,5 +72,5 @@ Imports System.Windows
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.8.5.2")>
<Assembly: AssemblyFileVersion("1.8.5.2")>
<Assembly: AssemblyVersion("1.8.5.3")>
<Assembly: AssemblyFileVersion("1.8.5.3")>
+5
View File
@@ -98,6 +98,11 @@ Friend Module OptionModule
IniFile.m_MyProjectDir = sMyProjectDir
End If
Dim sTemplateDir As String = String.Empty
If GetPrivateProfileString(S_DOORS, K_TEMPLATEDIR, "", sTemplateDir) <> 0 Then
IniFile.m_TemplateDir = sTemplateDir
End If
' leggo il tipo di Bevel selezionato
Dim BevelUp As Visibility
DefaultGetPrivateProfilesBevel(S_EDGE, K_BEVELU_INI, BevelUp)
+5 -1
View File
@@ -27,7 +27,11 @@
<Button Command="{Binding OptionsCommand}" ToolTip="{Binding OptionsToolTip}" Focusable="False">
<Image Source="/Resources/TopCommandBar/Options.png" Height="22" />
</Button>
<!--creazione del bottone per la creazione di un template-->
<Button Command="{Binding CreateTemplateCommand}" Focusable="False">
<ContentControl>template</ContentControl>
</Button>
</StackPanel>
</UserControl>
+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