EgtDOORCreator 1.9b6 :

- gestione in lettura (HardwareManager) della versione vecchia e nuova delle Lock.
This commit is contained in:
Nicola Pievani
2018-03-02 09:49:09 +00:00
parent ac0de45894
commit eebb0ce042
4 changed files with 181 additions and 24 deletions
+24 -16
View File
@@ -398,31 +398,39 @@
</Style>
<!-- ______________________________________________________________________________________________________________________________________________ -->
<Style x:Key="HardwareExpander" TargetType="Expander">
<Setter Property="IsExpanded" Value="True"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Expander">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<CheckBox IsChecked="{Binding Path=IsExpanded, RelativeSource={RelativeSource TemplatedParent}}"
Content="{TemplateBinding Header}"/>
<ContentControl x:Name="body"
Grid.Row="1" Content="{TemplateBinding Content}"/>
<GroupBox>
<GroupBox.Header>
<CheckBox IsChecked="{Binding Path=IsExpanded, RelativeSource={RelativeSource AncestorType={x:Type Expander}}}"
Content="{TemplateBinding Header}"/>
</GroupBox.Header>
<ContentControl Content="{TemplateBinding Content}"/>
</GroupBox>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsExpanded" Value="False">
<Setter TargetName="body" Property="Visibility" Value="Collapsed" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsExpanded" Value="False">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Expander">
<Border BorderBrush="#FF707070" BorderThickness="0.5" CornerRadius="2">
<CheckBox IsChecked="{Binding Path=IsExpanded, RelativeSource={RelativeSource AncestorType={x:Type Expander}}}"
Content="{TemplateBinding Header}"
Margin="9,5,5,5"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
<!-- ______________________________________________________________________________________________________________________________________________ -->
+151 -6
View File
@@ -335,6 +335,7 @@ Public Class Hardware
' il parametro cascade serve per riferisrsi al gruppo di parametri con l'indice indicato
' Se il gruppo di parametri con l'indice indicato è attvivo allora a casca rendo attivo anche questo gruppo di parametri
' attualmente non esiste nessuna struttura che garantisca il funzionamento
If StdTemplateGetPrivateProfileChapterCascaded(S_CHAPTER & ChapterIndex, K_CASCADED, IndexParam) Then
Chapter.Cascaded = IndexParam
End If
@@ -381,6 +382,13 @@ Public Class Hardware
Dim FileContent() As String
Dim CurrItemPath As String = CurrPath()
Dim Version As String = "2" ' 2 è la versione nuova, 1 la versione vecchia
Dim IsActiveVersion As Integer = 0
Dim MakeHole As Boolean = False
If StdTemplateGetPrivateProfileChapterVersioning("Versioning", "IsActive", IsActiveVersion) Then
Version = "1"
End If
If Not Path.HasExtension(CurrItemPath) Then CurrItemPath &= LUA_EXTENSION
Dim ErrorMsg As String = String.Empty
' se il file ha estensione o se ha estensione nge: esco
@@ -394,12 +402,67 @@ Public Class Hardware
If FileContent.Count = 0 Then
MessageBox.Show(EgtMsg(50107), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
End If
For IndexLine As Integer = 0 To FileContent.Count - 1
Dim CurrLine As String = Utility.DeleteLuaComment(FileContent(IndexLine))
Dim sLine() As String = CurrLine.Split("="c)
If sLine.Count < 2 OrElse sLine.Count > 2 Then Continue For
FindParamTemplateInConfigList(Trim(sLine(0)), Trim(sLine(1)))
Next
' cerco la versione caricata
If IsActiveVersion = 1 Then
For Each Line In FileContent
Dim CurrLine As String = Utility.DeleteLuaComment(Line)
Dim sLine() As String = CurrLine.Split("="c)
If sLine.Count < 2 OrElse sLine.Count > 2 Then Continue For
If sLine(0).Contains(".VER") Then
If Not IsNothing(sLine(1)) AndAlso IsNumeric(sLine(1).Replace("'", "")) Then
Version = Trim(sLine(1).Replace("'", ""))
End If
Exit For
End If
Next
End If
Select Case Version
Case "2"
For IndexLine As Integer = 0 To FileContent.Count - 1
Dim CurrLine As String = Utility.DeleteLuaComment(FileContent(IndexLine))
Dim sLine() As String = CurrLine.Split("="c)
If sLine.Count < 2 OrElse sLine.Count > 2 Then Continue For
FindParamTemplateInConfigList(Trim(sLine(0)), Trim(sLine(1)))
Next
' nuova versione
Case "1"
' se è una lock
If m_HardwareGeneral.DDFName = "locks" Then
' cerco il Parametro mh per l'attivazione del foro
For Each Line In FileContent
Dim CurrLine As String = Utility.DeleteLuaComment(Line)
Dim sLine() As String = CurrLine.Split("="c)
If sLine.Count < 2 OrElse sLine.Count > 2 Then Continue For
If Trim(sLine(0)) = "tLkmPar.mh" Then
If Not IsNothing(sLine(1)) AndAlso Trim(sLine(1)) = "true" Then
MakeHole = True
End If
Exit For
End If
Next
For IndexLine As Integer = 0 To FileContent.Count - 1
Dim CurrLine As String = Utility.DeleteLuaComment(FileContent(IndexLine))
Dim sLine() As String = CurrLine.Split("="c)
If sLine.Count < 2 OrElse sLine.Count > 2 Then Continue For
FindParamTemplateInConfigListOldVersionLock(Trim(sLine(0)), Trim(sLine(1)), MakeHole)
Next
Return True
End If
For IndexLine As Integer = 0 To FileContent.Count - 1
Dim CurrLine As String = Utility.DeleteLuaComment(FileContent(IndexLine))
Dim sLine() As String = CurrLine.Split("="c)
If sLine.Count < 2 OrElse sLine.Count > 2 Then Continue For
FindParamTemplateInConfigList(Trim(sLine(0)), Trim(sLine(1)))
Next
End Select
'For IndexLine As Integer = 0 To FileContent.Count - 1
' Dim CurrLine As String = Utility.DeleteLuaComment(FileContent(IndexLine))
' Dim sLine() As String = CurrLine.Split("="c)
' If sLine.Count < 2 OrElse sLine.Count > 2 Then Continue For
' FindParamTemplateInConfigList(Trim(sLine(0)), Trim(sLine(1)))
'Next
Return True
End Function
@@ -456,6 +519,88 @@ Public Class Hardware
Return False
End Function
' so già che il file contiene un foro al posto di una mortise
Private Function FindParamTemplateInConfigListOldVersionLock(sParam As String, sValue As String, MakeHole As Boolean) As Boolean
If MakeHole Then
Select Case sParam
Case "tLkmPar.L2"
sParam = ""
Case "tLkmPar.H2"
sParam = "tLkmPar.HB2"
Case "tLkmPar.T2"
sParam = "tLkmPar.TB2"
Case "tLkmPar.D_X"
sParam = "tLkmPar.DH_X"
Case "tLkmPar.LG2"
sParam = ""
Case "tLkmPar.LA"
sParam = ""
Case "tLkmPar.s"
sParam = ""
Case "tLkmPar.p2"
sParam = ""
Case "tLkmPar.d2"
sParam = ""
End Select
Else
Select Case sParam
Case "tLkmPar.LGH"
sParam = ""
End Select
End If
For IndexGroupChapters As Integer = 0 To m_GroupChapters.Count - 1
For IndexChapter As Integer = 0 To m_GroupChapters(IndexGroupChapters).CompoParamList.Count - 1
If m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter).DDFName = sParam Then
' ho trovato una corrispondenza tra il valore de file ini e quello lua in lettura
' allora significa che tutto il capitolo associato deve essere attivo
m_GroupChapters(IndexGroupChapters).SetIsActiveChapter(True)
If TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is TextBoxDGCParam Then
Dim Text As TextBoxDGCParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), TextBoxDGCParam)
Dim sItems() As String = sValue.Split("+"c)
Dim sLen As String = Trim(Utility.GetMeasure(sItems(0)))
Dim dVal As Double = 0.0
Text.SetValue(sLen)
Text.SetConst(Text.ConstList(0))
If sItems.Count >= 2 Then
For IndexConst As Integer = 0 To Text.ConstList.Count - 1
If Text.ConstList(IndexConst) = Trim(sItems(1)) Then Text.SetConst(Text.ConstList(IndexConst)) : Exit For
Next
End If
ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is TextBoxParam Then
Dim Text As TextBoxParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), TextBoxParam)
' controllo il tipo di dato che si aspetta
Select Case Text.TypeVar
Case ConstGen.INCHES
Dim sLen As String = Trim(Utility.GetMeasure(sValue))
Text.SetValue(sLen)
Case ConstGen.MM
Dim sLen As String = Trim(Utility.GetMeasure(sValue))
Text.SetValue(sLen)
Case ConstGen.VAL_DOUBLE
Dim dVal As Double = 0.0
If StringToDouble(sValue, dVal) Then Text.SetValue(sValue) Else Text.SetValue("0.000")
Case ConstGen.VAL_STING
Text.SetValue(Trim(Utility.DeleteSuperScript(sValue)))
End Select
ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is CheckBoxParam Then
Dim Text As CheckBoxParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), CheckBoxParam)
Text.SetIsChecked(Utility.ConvertCheckBox(sValue))
ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is ComboBoxParam Then
Dim Text As ComboBoxParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), ComboBoxParam)
Text.SetSelItem(Text.ItemList(0))
For IndexCombo As Integer = 0 To Text.ItemListDDF.Count - 1
If Trim(Text.ItemListDDF(IndexCombo)) = Trim(Utility.DeleteSuperScript(sValue)) Then Text.SetSelItem(Text.ItemList(IndexCombo))
Next
End If
Return True
End If
Next
Next
Return False
Return True
End Function
#End Region ' Caricamneto
#Region "Salvataggio, Duplica, Nuovo, Aggiorna"
-2
View File
@@ -15,7 +15,6 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ContentControl}">
<Border BorderBrush="#FF707070" BorderThickness="0.5" Padding="2" CornerRadius="2">
<StackPanel >
<!-- Gestione della lista di parametri dell'hardware -->
<ItemsControl ItemsSource="{Binding CompoParamList}">
@@ -165,7 +164,6 @@
<!-- Fine gestione oggetti lsta -->
</ItemsControl>
</StackPanel>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
+6
View File
@@ -175,6 +175,12 @@ Friend Module IniFile
Return True
End Function
Public Function StdTemplateGetPrivateProfileChapterVersioning(ByVal lpAppName As String, ByVal lpKeyName As String, ByRef nValue As Integer) As Boolean
' se non trovo significa che è disattiva la versione
nValue = StdTemplateGetPrivateProfileInt(lpAppName, lpKeyName, 0)
Return True
End Function
Public Function StdTemplateGetPrivateProfileChapterIsOpened(ByVal lpAppName As String, ByVal lpKeyName As String, ByRef bValueLua As Boolean) As Boolean
Dim sVal As String = String.Empty
StdTemplateGetPrivateProfileString(lpAppName, lpKeyName, "", sVal)