diff --git a/DdfFile.vb b/DdfFile.vb index 84a6309..0f59ad6 100644 --- a/DdfFile.vb +++ b/DdfFile.vb @@ -74,28 +74,28 @@ Friend Module DdfFile ' aggiungo una riga vuota per separare la lista successiva DdfFileContent.Add("") DdfFileContent.Add("" & ConstCompo.K_PROFILES & ":") - DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_LOCKEDGE & ": " & Door.LockEdgeType) + DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_LOCKEDGE & ": " & Door.LockEdgeType.Name) DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Door.LockEdgeMachining)) If Not StringToDouble(Door.LockEdgeOverMaterial, dVal) Then MessageBox.Show(EgtMsg(50106) & K_LOCKEDGEOVERMATERIAL_INI, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) Return End If DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_OVERMATERAL & ": " & DoubleToString(dVal, 5)) - DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_HINGEEDGE & ": " & Door.HingeEdgeType) + DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_HINGEEDGE & ": " & Door.HingeEdgeType.Name) DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Door.HingeEdgeMachining)) If Not StringToDouble(Door.HingeEdgeOverMaterial, dVal) Then MessageBox.Show(EgtMsg(50106) & K_HINGEDGEOVERMATERIAL_INI, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) Return End If DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_OVERMATERAL & ": " & DoubleToString(dVal, 5)) - DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_TOP & ": " & Door.TopType) + DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_TOP & ": " & Door.TopType.Name) DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Door.TopMachining)) If Not StringToDouble(Door.TopOverMaterial, dVal) Then MessageBox.Show(EgtMsg(50106) & K_TOPOVERMATERIAL_INI, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) Return End If DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_OVERMATERAL & ": " & DoubleToString(dVal, 5)) - DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_BOTTOM & ": " & Door.BottomType) + DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_BOTTOM & ": " & Door.BottomType.Name) DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Door.BottomMachining)) If Not StringToDouble(Door.BottomOverMaterial, dVal) Then MessageBox.Show(EgtMsg(50106) & K_BOTTOMOVERMATERIAL_INI, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) diff --git a/DoorManager/DoorManagerViewModel.vb b/DoorManager/DoorManagerViewModel.vb index 2a148d3..785e429 100644 --- a/DoorManager/DoorManagerViewModel.vb +++ b/DoorManager/DoorManagerViewModel.vb @@ -77,10 +77,12 @@ Public Class DoorManagerViewModel SelDoor.Height = OptionModule.m_Height SelDoor.Thickness = OptionModule.m_Thickness SelDoor.Swing = OptionModule.m_Swing + SelDoor.LockEdgeType = OptionModule.m_LockEdgeType SelDoor.HingeEdgeType = OptionModule.m_HingeEdgeType SelDoor.TopType = OptionModule.m_TopType SelDoor.BottomType = OptionModule.m_BottomType + SelDoor.LockEdgeMachining = OptionModule.m_LockEdgeMachining SelDoor.HingeEdgeMachining = OptionModule.m_HingeEdgeMachining SelDoor.TopMachining = OptionModule.m_TopMachining @@ -271,7 +273,7 @@ Public Class DoorManagerViewModel ' salvo il nome del file che sta per essere eliminato Dim RemoveDoorName As String = Path.GetFileNameWithoutExtension(m_SelectedDoor) ' chiedo se devo eliminere il file: se si - If MessageBox.Show(String.Format(EgtMsg(50116), Path.GetFileNameWithoutExtension(m_SelectedDoor)), EgtMsg(50110), MessageBoxButton.YesNo, MessageBoxImage.Warning) = MessageBoxResult.Yes Then + If MessageBox.Show(String.Format(EgtMsg(50116), Path.GetFileNameWithoutExtension(m_SelectedDoor)), EgtMsg(50110), MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No) = MessageBoxResult.Yes Then ' ricerco l'indice del file all'interno della lista delle porte Dim SelIndex As Integer = m_CurrProject.DoorList.IndexOf(m_SelectedDoor) ' elimino dall'elenco dei file diff --git a/DoorParameters/Door.vb b/DoorParameters/Door.vb index c7c395c..1ca5035 100644 --- a/DoorParameters/Door.vb +++ b/DoorParameters/Door.vb @@ -213,73 +213,73 @@ Public Class Door #Region "TypeEdge" - Friend Shared m_EdgeTypeList As New ObservableCollection(Of String) - Public Property EdgeTypeList As ObservableCollection(Of String) + Friend Shared m_EdgeTypeList As New ObservableCollection(Of EdgeType) + Public Property EdgeTypeList As ObservableCollection(Of EdgeType) Get ' restituisco il valore della lista che è stato creato all'avvio Return m_EdgeTypeList End Get - Set(value As ObservableCollection(Of String)) + Set(value As ObservableCollection(Of EdgeType)) m_EdgeTypeList = value End Set End Property - Private m_LockEdgeType As String = Nothing - Public Property LockEdgeType As String + Private m_LockEdgeType As EdgeType + Public Property LockEdgeType As EdgeType Get + If m_LockEdgeType.IsActive = Visibility.Collapsed Then + m_LockEdgeType = EdgeTypeList(0) + End If Return m_LockEdgeType End Get - Set(value As String) - If value = String.Empty Then - value = m_EdgeTypeList(0) - End If + Set(value As EdgeType) m_LockEdgeType = value m_IsModifyDoor = True SetTitle() End Set End Property - Private m_HingeEdgeType As String = Nothing - Public Property HingeEdgeType As String + Private m_HingeEdgeType As EdgeType + Public Property HingeEdgeType As EdgeType Get + If m_HingeEdgeType.IsActive = Visibility.Collapsed Then + m_HingeEdgeType = EdgeTypeList(0) + End If Return m_HingeEdgeType End Get - Set(value As String) - If value = Nothing Then - value = m_EdgeTypeList(0) - End If + Set(value As EdgeType) m_HingeEdgeType = value m_IsModifyDoor = True SetTitle() End Set End Property - Private m_TopType As String = Nothing - Public Property TopType As String + Private m_TopType As EdgeType + Public Property TopType As EdgeType Get + If m_TopType.IsActive = Visibility.Collapsed Then + m_TopType = EdgeTypeList(0) + End If Return m_TopType End Get - Set(value As String) + Set(value As EdgeType) m_TopType = value - 'If SetChange <> 0 Then - ' SetChange += 1 - 'End If m_IsModifyDoor = True SetTitle() End Set End Property - Private m_BottomType As String = Nothing - Public Property BottomType As String + Private m_BottomType As EdgeType + Public Property BottomType As EdgeType Get + If m_BottomType.IsActive = Visibility.Collapsed Then + m_BottomType = EdgeTypeList(0) + End If Return m_BottomType End Get - Set(value As String) + Set(value As EdgeType) m_BottomType = value - 'If SetChange <> 0 Then - ' SetChange += 1 - 'End If m_IsModifyDoor = True SetTitle() End Set @@ -996,13 +996,15 @@ Public Class Door ' controllo che il valore sia nella lista If EdgeTypeControl(LockEdgeType) Then ' carico il valore nella porta corrente - m_LockEdgeType = LockEdgeType + m_LockEdgeType = EdgeTypeList.First(Function(x) x.Name = LockEdgeType) ' restituisco la riga successiva all'ultimo valore letto Else + m_LockEdgeType = EdgeTypeList(0) bError = True End If Index += 1 End If + Dim LockEdgeMachining As String = SearchKeyValue(FileContent(Index), K_MACHINING) If String.IsNullOrWhiteSpace(LockEdgeMachining) Then If Not SearchKey(FileContent(Index), K_MACHINING) Then Return -1 @@ -1028,12 +1030,12 @@ Public Class Door Else m_HingeEdgeType = m_EdgeTypeList(0) End If - Index += 1 Else If EdgeTypeControl(HingeEdgeType) Then - m_HingeEdgeType = HingeEdgeType + m_HingeEdgeType = EdgeTypeList.First(Function(x) x.Name = HingeEdgeType) Else + m_HingeEdgeType = m_EdgeTypeList(0) bError = True End If Index += 1 @@ -1062,8 +1064,9 @@ Public Class Door Index += 1 Else If EdgeTypeControl(TopType) Then - m_TopType = TopType + m_TopType = EdgeTypeList.First(Function(x) x.Name = TopType) Else + m_TopType = m_EdgeTypeList(0) bError = True End If Index += 1 @@ -1092,8 +1095,9 @@ Public Class Door Index += 1 Else If EdgeTypeControl(BottomType) Then - m_BottomType = BottomType + m_BottomType = EdgeTypeList.First(Function(x) x.Name = BottomType) Else + m_BottomType = m_EdgeTypeList(0) bError = True End If Index += 1 @@ -1124,7 +1128,13 @@ Public Class Door ' controllo che i valori passati come spigoli siano presenti nella lista corrente (lettura DDF) Public Function EdgeTypeControl(Edge As String) As Boolean - If Door.m_EdgeTypeList.IndexOf(Edge) = -1 Then + Dim bFound As Boolean = False + For Index = 0 To EdgeTypeList.Count - 1 + If Door.m_EdgeTypeList(Index).Name = Edge And Door.m_EdgeTypeList(Index).IsActive = Visibility.Collapsed Then + bFound = True + End If + Next + If bFound 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 diff --git a/DoorParameters/DoorParametersView.xaml b/DoorParameters/DoorParametersView.xaml index 6f6089c..992d7d5 100644 --- a/DoorParameters/DoorParametersView.xaml +++ b/DoorParameters/DoorParametersView.xaml @@ -81,34 +81,71 @@ - + Style="{StaticResource DoorEdgeParamsCmBx}" + Margin="0.4,2,70,4"/> + + + - + Style="{StaticResource DoorParamsCmBx}" + Margin="0.4,2,70,4"> + + + + + + + + + + + - + Style="{StaticResource DoorEdgeParamsCmBx}" + Margin="0.4,2,70,4"/> + + + - + Style="{StaticResource DoorEdgeParamsCmBx}" + Margin="0.4,2,70,4"/> + + + + + + + + + + + + + + diff --git a/IniFile.vb b/IniFile.vb index c958ad0..9d33676 100644 --- a/IniFile.vb +++ b/IniFile.vb @@ -129,13 +129,13 @@ Friend Module IniFile Return IpBoolean End Function - Public Function DefaultGetPrivateProfilesBevel(ByVal lpAppName As String, ByVal lpKeyName As String, ByRef IpBoolean As Boolean) As Boolean + Public Function DefaultGetPrivateProfilesBevel(ByVal lpAppName As String, ByVal lpKeyName As String, ByRef IpBoolean As Visibility) As Visibility Dim sVal As String = String.Empty DefaultGetPrivateProfileString(lpAppName, lpKeyName, "", sVal) If String.Equals(Trim(sVal), "1") Then - IpBoolean = True + IpBoolean = Visibility.Visible Else - IpBoolean = False + IpBoolean = Visibility.Collapsed End If Return IpBoolean End Function diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 34cf0f2..c5650fd 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 fb44e08..1fd0e44 100644 --- a/OptionsWindow/OptionModule.vb +++ b/OptionsWindow/OptionModule.vb @@ -17,8 +17,8 @@ Friend Module OptionModule Friend m_bIsMmUnit As Boolean ' Paramaetri per la scelta del bevel - Friend m_bBevelUp As Boolean - Friend m_bBevelDown As Boolean + Friend m_bBevelUp As Visibility + Friend m_bBevelDown As Visibility Friend Enum LauncherWindow Open_window = 0 @@ -31,11 +31,11 @@ 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 ObservableCollection(Of String) - Friend m_LockEdgeType As String - Friend m_HingeEdgeType As String - Friend m_TopType As String - Friend m_BottomType As String + Friend m_StaticEdgeTypeList As New ObservableCollection(Of String) + Friend m_LockEdgeType As New EdgeType("", Visibility.Visible) + Friend m_HingeEdgeType As New EdgeType("", Visibility.Visible) + Friend m_TopType As New EdgeType("", Visibility.Visible) + Friend m_BottomType As New EdgeType("", Visibility.Visible) Friend m_LockEdgeMachining As Boolean Friend m_HingeEdgeMachining As Boolean Friend m_TopMachining As Boolean @@ -98,10 +98,10 @@ Friend Module OptionModule End If ' leggo il tipo di Bevel selezionato - Dim BevelUp As Boolean + Dim BevelUp As Visibility DefaultGetPrivateProfilesBevel(S_EDGE, K_BEVELU_INI, BevelUp) m_bBevelUp = BevelUp - Dim BevelDown As Boolean + Dim BevelDown As Visibility DefaultGetPrivateProfilesBevel(S_EDGE, K_BEVELD_INI, BevelDown) m_bBevelDown = BevelDown @@ -122,23 +122,45 @@ Friend Module OptionModule Dim Swing As String = String.Empty DefaultGetPrivateProfileString(S_SIZE, K_SWING_INI, "", Swing) m_Swing = Swing + ' carico il valori associati al tipo di spigolo Dim EdgeTypeList As New ObservableCollection(Of String) DefaultGetPrivateProfileObservableCollection(S_EDGE, K_EDGETYPE_LIST_INI, EdgeTypeList) - Door.m_EdgeTypeList = EdgeTypeList - SetEdgeTypeList(Door.m_EdgeTypeList, m_bBevelUp, m_bBevelDown) + 'For Index = 0 To EdgeTypeList.Count - 1 + ' Door.m_EdgeTypeList.Add(New EdgeType(EdgeTypeList(Index), True)) + 'Next + m_StaticEdgeTypeList = EdgeTypeList + OptionsViewModel.CreateEdgeTypeList() + Dim LockEdgeType As String = String.Empty DefaultGetPrivateProfileString(S_EDGE, K_LOCKEDGE, "", LockEdgeType) - m_LockEdgeType = LockEdgeType + For Index = 0 To OptionsViewModel.EdgeTypeList.Count - 1 + If OptionsViewModel.EdgeTypeList(Index).Name = LockEdgeType Then + m_LockEdgeType = OptionsViewModel.EdgeTypeList(Index) + End If + Next Dim HingeEdgeType As String = String.Empty DefaultGetPrivateProfileString(S_EDGE, K_HINGEDGE_INI, "", HingeEdgeType) - m_HingeEdgeType = HingeEdgeType + For Index = 0 To OptionsViewModel.EdgeTypeList.Count - 1 + If OptionsViewModel.EdgeTypeList(Index).Name = HingeEdgeType Then + m_HingeEdgeType = OptionsViewModel.EdgeTypeList(Index) + End If + Next Dim TopType As String = String.Empty DefaultGetPrivateProfileString(S_EDGE, K_TOPEDGE_INI, "", TopType) - m_TopType = TopType + For Index = 0 To OptionsViewModel.EdgeTypeList.Count - 1 + If OptionsViewModel.EdgeTypeList(Index).Name = TopType Then + m_TopType = OptionsViewModel.EdgeTypeList(Index) + End If + Next Dim BottomType As String = String.Empty DefaultGetPrivateProfileString(S_EDGE, K_BOTTOMEDGE_INI, "", BottomType) - m_BottomType = BottomType + For Index = 0 To OptionsViewModel.EdgeTypeList.Count - 1 + If OptionsViewModel.EdgeTypeList(Index).Name = BottomType Then + m_BottomType = OptionsViewModel.EdgeTypeList(Index) + End If + Next + ' Carico i valori booleani associati alla lavorazione Dim LockEdgeMachining As Boolean = False DefaultGetPrivateProfilesMachining(S_MACHINING, K_LOCKEDGEISCHECKED_INI, LockEdgeMachining) diff --git a/OptionsWindow/OptionsView.xaml b/OptionsWindow/OptionsView.xaml index d58bd97..86fff97 100644 --- a/OptionsWindow/OptionsView.xaml +++ b/OptionsWindow/OptionsView.xaml @@ -89,32 +89,30 @@ Style="{StaticResource DoorParamsTxBl}" Margin="20,0,5,0"/> - + SelectedItem="{Binding Path=TopType}" + Style="{StaticResource DoorEdgeParamsCmBx}" + Margin="5,0,40,5"/> -