diff --git a/Constants/ConstIni.vb b/Constants/ConstIni.vb index 8a15736..629cf5d 100644 --- a/Constants/ConstIni.vb +++ b/Constants/ConstIni.vb @@ -50,6 +50,8 @@ Module ConstIni Public Const K_HINGEDGE_INI As String = "HingeEdge" Public Const K_TOPEDGE_INI As String = "TopEdge" Public Const K_BOTTOMEDGE_INI As String = "BottomEdge" + Public Const K_BEVELU_INI As String = "BevelUp" + Public Const K_BEVELD_INI As String = "BevelDowm" Public Const S_MACHINING As String = "Machining" Public Const K_LOCKEDGEISCHECKED_INI As String = "LockEdgeIsChecked" diff --git a/DoorParameters/Door.vb b/DoorParameters/Door.vb index 0b27f6f..52884d9 100644 --- a/DoorParameters/Door.vb +++ b/DoorParameters/Door.vb @@ -213,12 +213,15 @@ Public Class Door #Region "TypeEdge" - Private m_EdgeTypeList As List(Of String) = New List(Of String) - Public ReadOnly Property EdgeTypeList As List(Of String) + Friend Shared m_EdgeTypeList As New ObservableCollection(Of String) + Public Shared Property EdgeTypeList As ObservableCollection(Of String) Get ' restituisco il valore della lista che è stato creato all'avvio - Return OptionModule.m_EdgeTypeList + Return m_EdgeTypeList End Get + Set(value As ObservableCollection(Of String)) + m_EdgeTypeList = value + End Set End Property Private m_LockEdgeType As String = Nothing @@ -228,9 +231,6 @@ Public Class Door End Get Set(value As String) m_LockEdgeType = value - 'If SetChange <> 0 Then - ' SetChange += 1 - 'End If m_IsModifyDoor = True SetTitle() End Set @@ -963,7 +963,7 @@ Public Class Door ' carico valori profiles Public Function GetProfiles(Index As Integer) As Integer ' Creo una stringa per scrivere gli errori - Dim ReadingError As String = String.Empty + Dim bError As Boolean = False ' Lock Dim LockEdgeType As String = SearchKeyValue(FileContent(Index), K_LOCKEDGE) ' se il valore restituito è nullo o vuoto @@ -973,9 +973,14 @@ Public Class Door ' altrimenti lascia il valore vuoto Index += 1 Else - ' carico il valore nella porta corrente - m_LockEdgeType = LockEdgeType - ' restituisco la riga successiva all'ultimo valore letto + ' controllo che il valore sia nella lista + If EdgeTypeControl(LockEdgeType) Then + ' carico il valore nella porta corrente + m_LockEdgeType = LockEdgeType + ' restituisco la riga successiva all'ultimo valore letto + Else + bError = True + End If Index += 1 End If Dim LockEdgeMachining As String = SearchKeyValue(FileContent(Index), K_MACHINING) @@ -1001,7 +1006,11 @@ Public Class Door If Not SearchKey(FileContent(Index), K_HINGEEDGE) Then Return -1 Index += 1 Else - m_HingeEdgeType = HingeEdgeType + If EdgeTypeControl(HingeEdgeType) Then + m_HingeEdgeType = HingeEdgeType + Else + bError = True + End If Index += 1 End If Dim HingeEdgeMachining As String = SearchKeyValue(FileContent(Index), K_MACHINING) @@ -1027,7 +1036,11 @@ Public Class Door If Not SearchKey(FileContent(Index), K_TOP) Then Return -1 Index += 1 Else - m_TopType = TopType + If EdgeTypeControl(TopType) Then + m_TopType = TopType + Else + bError = True + End If Index += 1 End If Dim TopMachining As String = SearchKeyValue(FileContent(Index), K_MACHINING) @@ -1053,7 +1066,11 @@ Public Class Door If Not SearchKey(FileContent(Index), K_BOTTOM) Then Return -1 Index += 1 Else - m_BottomType = BottomType + If EdgeTypeControl(BottomType) Then + m_BottomType = BottomType + Else + bError = True + End If Index += 1 End If @@ -1080,6 +1097,16 @@ Public Class Door #End Region ' Carica il General della porta + ' controllo che i valori passati come spigoli siano presenti nella lista corrente + Public Function EdgeTypeControl(Edge As String) As Boolean + If Door.EdgeTypeList.IndexOf(Edge) = -1 Then + MessageBox.Show(Edge & " is not a member of the current list of EdgeType. Check Bevel in option page.", "Caution", MessageBoxButton.OK, MessageBoxImage.Asterisk) + Return False + Else + Return True + End If + End Function + ' ricerco la compo nella lista dei compobtn Public Function GetNewCompo(Index As Integer, CompoNameDDF As String, ByRef InvalidValue As String) As Integer Dim bDDFName As Boolean = False diff --git a/DoorParameters/DoorParametersView.xaml b/DoorParameters/DoorParametersView.xaml index 26f63f6..6f6089c 100644 --- a/DoorParameters/DoorParametersView.xaml +++ b/DoorParameters/DoorParametersView.xaml @@ -85,7 +85,6 @@ ItemsSource="{Binding CurrDoor.EdgeTypeList}" SelectedItem="{Binding CurrDoor.LockEdgeType}" Style="{StaticResource DoorParamsCmBx}" Height="Auto"/> - 0 Then + For Index = 0 To sItems.Count() - 1 + List.Add(Trim(sItems(Index))) + Next + End If + Return True + End Function + Public Function DefaultGetPrivateProfilesMachining(ByVal lpAppName As String, ByVal lpKeyName As String, ByRef IpBoolean As Boolean) As Boolean Dim sVal As String = String.Empty DefaultGetPrivateProfileString(lpAppName, lpKeyName, "", sVal) @@ -116,6 +129,17 @@ Friend Module IniFile Return IpBoolean End Function + Public Function DefaultGetPrivateProfilesBevel(ByVal lpAppName As String, ByVal lpKeyName As String, ByRef IpBoolean As Boolean) As Boolean + Dim sVal As String = String.Empty + DefaultGetPrivateProfileString(lpAppName, lpKeyName, "", sVal) + If String.Equals(Trim(sVal), "1") Then + IpBoolean = True + Else + IpBoolean = False + End If + Return IpBoolean + End Function + Public Function WritePrivateProfileString(IpAppName As String, IpKeyName As String, ByRef IpString As String) As Boolean Return EgtUILib.WritePrivateProfileString(IpAppName, IpKeyName, IpString, m_sIniFile) End Function diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index d0c9055..6365d7e 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -72,5 +72,5 @@ Imports System.Windows ' by using the '*' as shown below: ' - - + + diff --git a/OptionsWindow/OptionModule.vb b/OptionsWindow/OptionModule.vb index 5d7f2a6..c254ae0 100644 --- a/OptionsWindow/OptionModule.vb +++ b/OptionsWindow/OptionModule.vb @@ -16,6 +16,10 @@ Friend Module OptionModule Friend m_SelectedMeasureUnit As String Friend m_bIsMmUnit As Boolean + ' Paramaetri per la scelta del bevel + Friend m_bBevelUp As Boolean + Friend m_bBevelDown As Boolean + Friend Enum LauncherWindow Open_window = 0 Open_last_project = 1 @@ -27,7 +31,7 @@ Friend Module OptionModule Friend m_Thickness As String Friend m_SwingTypeList As New List(Of String) Friend m_Swing As String - Friend m_EdgeTypeList As New List(Of String) + 'Friend m_EdgeTypeList As New ObservableCollection(Of String) Friend m_LockEdgeType As String Friend m_HingeEdgeType As String Friend m_TopType As String @@ -93,6 +97,14 @@ Friend Module OptionModule IniFile.m_MyProjectDir = sMyProjectDir End If + ' leggo il tipo di Bevel selezionato + Dim BevelUp As Boolean + DefaultGetPrivateProfilesBevel(S_EDGE, K_BEVELU_INI, BevelUp) + m_bBevelUp = BevelUp + Dim BevelDown As Boolean + DefaultGetPrivateProfilesBevel(S_EDGE, K_BEVELD_INI, BevelDown) + m_bBevelDown = BevelDown + ' Leggo le dimensioni della porta dal file Default.ini Dim Width As String = String.Empty DefaultGetPrivateProfileString(S_SIZE, K_WIDTH_INI, "", Width) @@ -111,9 +123,10 @@ Friend Module OptionModule DefaultGetPrivateProfileString(S_SIZE, K_SWING_INI, "", Swing) m_Swing = Swing ' carico il valori associati al tipo di spigolo - Dim EdgeTypeList As New List(Of String) - DefaultGetPrivateProfileList(S_EDGE, K_EDGETYPE_LIST_INI, EdgeTypeList) - m_EdgeTypeList = EdgeTypeList + Dim EdgeTypeList As New ObservableCollection(Of String) + DefaultGetPrivateProfileObservableCollection(S_EDGE, K_EDGETYPE_LIST_INI, EdgeTypeList) + Door.EdgeTypeList = EdgeTypeList + SetEdgeTypeList(Door.EdgeTypeList, m_bBevelUp, m_bBevelDown) Dim LockEdgeType As String = String.Empty DefaultGetPrivateProfileString(S_EDGE, K_LOCKEDGE, "", LockEdgeType) m_LockEdgeType = LockEdgeType @@ -165,7 +178,14 @@ Friend Module OptionModule End Sub - + Friend Sub SetEdgeTypeList(EdgeTypeList As ObservableCollection(Of String), bBevelUp As Boolean, bBevelDown As Boolean) + If Not bBevelUp Then + EdgeTypeList.Remove("BU") + End If + If Not bBevelDown Then + EdgeTypeList.Remove("BD") + End If + End Sub End Module diff --git a/OptionsWindow/OptionsView.xaml b/OptionsWindow/OptionsView.xaml index 85e2746..7f4cd80 100644 --- a/OptionsWindow/OptionsView.xaml +++ b/OptionsWindow/OptionsView.xaml @@ -15,6 +15,7 @@ + @@ -35,7 +36,7 @@ - + @@ -167,6 +168,7 @@ + + + + + + + + + + + + + + + + + + + + + - + @@ -195,7 +225,7 @@ -