diff --git a/Assembly/Assembly.vb b/Assembly/Assembly.vb
index 52bf4f5..b141807 100644
--- a/Assembly/Assembly.vb
+++ b/Assembly/Assembly.vb
@@ -1240,7 +1240,7 @@ Public Class Assembly
Dim Local_PartDoor As New PartDoor
Dim Local_Door As New Part(Local_PartDoor)
' carcio la liste delle propiretà
- CreateNewPropertiesList(Local_Door.PropertiesList)
+ CreateNewPropertiesList(Local_Door.PropertiesList, Local_Door.SelectedMaterial)
If Line > 0 Then
' per saltare la riga che è stata appena restituita che contiene "---"
Line += 1
diff --git a/AssemblyManager/AssemblyManagerVM.vb b/AssemblyManager/AssemblyManagerVM.vb
index ef60ba5..8952892 100644
--- a/AssemblyManager/AssemblyManagerVM.vb
+++ b/AssemblyManager/AssemblyManagerVM.vb
@@ -1224,7 +1224,7 @@ Public Class AssemblyManagerVM
' non viene caricato lo swing, che è carciato al termine del ciclo for
LoadDefaultSingleDoor(Local_PartDoor.Door, CStr(nDoorNumber))
Local_PartDoor.IsChecked = True
- CreateNewPropertiesList(Local_PartDoor.Door.PropertiesList)
+ CreateNewPropertiesList(Local_PartDoor.Door.PropertiesList, Local_PartDoor.Door.SelectedMaterial)
CurrAssembly.ListPartDoor.Add(Local_PartDoor)
End If
Next
diff --git a/Constants/ConstCompo.vb b/Constants/ConstCompo.vb
index a63d602..77c7cb7 100644
--- a/Constants/ConstCompo.vb
+++ b/Constants/ConstCompo.vb
@@ -39,6 +39,7 @@ Module ConstCompo
Public Const S_WEIGHT As String = "pressure"
Public Const S_SWING As String = "swing"
Public Const S_SECURE As String = "secure"
+ Public Const S_MATERIAL As String = "material"
Public Const S_PROPERTIES As String = "properties"
Public Const S_PROFILES As String = "profiles"
Public Const K_LOCKEDGE As String = "lockedge"
diff --git a/Constants/ConstGen.vb b/Constants/ConstGen.vb
index 0a056ce..6e0101a 100644
--- a/Constants/ConstGen.vb
+++ b/Constants/ConstGen.vb
@@ -87,6 +87,9 @@ Module ConstGen
Public Const RIGHTHAND As String = "RH"
Public Const RIGHTHAND_REVERSE As String = "RHR"
+ Public Const GENERICMATERIAL As String = "GenericMaterial"
+ Public Const NONE_DDF As String = "none"
+
Public Const TYPE_STD_TEMPLATE As String = "StdTemplate"
Public Const TYPE_STD_TEMPLATE_INI As String = "1"
diff --git a/DdfFile.vb b/DdfFile.vb
index 72082b9..08176b1 100644
--- a/DdfFile.vb
+++ b/DdfFile.vb
@@ -216,17 +216,29 @@ Friend Module DdfFile
DdfFileContent.Add("")
'----------------------------------------------------------------------------------------------------------------------------------------------------
' aggiungo le Properties
- If Part.PropertiesIsVisible = Visibility.Visible Then
+ ' il tipo di materiale, se è selezionato deve sempre essere stampato
+ If Not IsNothing(Part.SelectedMaterial) andalso Part.SelectedMaterial.NameDDF <> GENERICMATERIAL then
+ DdfFileContent.Add("" & ConstCompo.S_MATERIAL & ": " & Part.SelectedMaterial.NameDDF)
+ DdfFileContent.Add("")
+ End If
+ '' scrittura utilizzata per la multi selezione
+ 'Dim sProperties As String = String.Empty
+ 'Dim ItemIndex As Integer
+ 'For ItemIndex = 0 To Part.PropertiesList.Count - 1
+ ' 'If Part.PropertiesList(ItemIndex).IsChecked Then
+ ' ' sProperties &= Part.PropertiesList(ItemIndex).Name & ", "
+ ' 'End If
+ 'Next
+ 'If Not String.IsNullOrEmpty(sProperties) Then
+ ' sProperties = sProperties.Remove(sProperties.LastIndexOf(","c))
+ ' DdfFileContent.Add("" & ConstCompo.S_PROPERTIES & ": " & sProperties)
+ ' DdfFileContent.Add("")
+ 'End If
+ ' scrittura delle proprietà in caso di selezione da ComboBox
+ If Part.PropertiesIsVisible = Visibility.Visible then
Dim sProperties As String = String.Empty
- Dim ItemIndex As Integer
- For ItemIndex = 0 To Part.PropertiesList.Count - 1
- If Part.PropertiesList(ItemIndex).IsChecked Then
- sProperties &= Part.PropertiesList(ItemIndex).Name & ", "
- End If
- Next
- If Not String.IsNullOrEmpty(sProperties) Then
- sProperties = sProperties.Remove(sProperties.LastIndexOf(","c))
- DdfFileContent.Add("" & ConstCompo.S_PROPERTIES & ": " & sProperties)
+ If Not IsNothing(Part.SelectedProperty) andalso Part.SelectedProperty.Name <> "none" Then
+ DdfFileContent.Add("" & ConstCompo.S_PROPERTIES & ": " & Part.SelectedProperty.Name)
DdfFileContent.Add("")
End If
End If
diff --git a/DoorParameters/Part.vb b/DoorParameters/Part.vb
index 61ad7dd..84c6b9f 100644
--- a/DoorParameters/Part.vb
+++ b/DoorParameters/Part.vb
@@ -181,6 +181,54 @@ Public Class Part
#End Region ' Info generali del ddf
#Region "PROPERTIES"
+ ' la lista dei materiali è caricta nell'init dell'OptionPage
+ Public ReadOnly Property MaterialsList As ObservableCollection(of MaterialType)
+ Get
+ Return OptionModule.m_MaterialList
+ End Get
+ End Property
+
+ Private m_SelectedMaterial As MaterialType
+ Public Property SelectedMaterial As MaterialType
+ Get
+ Return m_SelectedMaterial
+ End Get
+ Set(value As MaterialType)
+ m_SelectedMaterial = value
+ If Not IsNothing(value) then
+ ' ogni volta che cambio la selezione del materiale azzero tutte le selezioni delle proprietà
+ If Not IsNothing(m_SelectedMaterial.PropertiesList) then
+ For Each ItemProperty In m_SelectedMaterial.PropertiesList
+ ItemProperty.IsChecked = False
+ Next
+ PropertiesList = m_SelectedMaterial.PropertiesList
+ 'm_SelectedProperty = m_PropertiesList(0)
+ PropertiesIsVisible = Visibility.Visible
+ Else
+ PropertiesIsVisible = Visibility.Collapsed
+ End if
+ NotifyPropertyChanged("SelectedMaterial")
+ Map.refSceneManagerVM.RefreshBtn()
+ Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
+ End if
+ End Set
+ End Property
+
+ Public ReadOnly Property MaterialIsVisible As Visibility
+ Get
+ Return OptionModule.m_MaterialIsVisible
+ End Get
+ End Property
+
+ Public ReadOnly Property ShowPropeperty As Visibility
+ Get
+ If OptionModule.m_MaterialIsVisible <> Visibility.Visible and m_PropertiesIsVisible = Visibility.Visible then
+ Return Visibility.Visible
+ Else
+ Return Visibility.Collapsed
+ End If
+ End Get
+ End Property
Private m_PropertiesList As New ObservableCollection(Of PropertyItem)
Public Property PropertiesList As ObservableCollection(Of PropertyItem)
@@ -189,6 +237,30 @@ Public Class Part
End Get
Set(value As ObservableCollection(Of PropertyItem))
m_PropertiesList = value
+ If Not IsNothing(m_PropertiesList) andalso m_PropertiesList.Count >0 Then
+ Try
+ m_SelectedProperty = m_PropertiesList.First(Function(x) x.Name = NONE_DDF)
+ Catch ex As Exception
+ m_SelectedProperty = m_PropertiesList(0)
+ End Try
+ NotifyPropertyChanged("SelectedProperty")
+ End If
+ NotifyPropertyChanged("PropertiesList")
+ Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
+ Map.refSceneManagerVM.RefreshBtn()
+ End Set
+ End Property
+
+ Private m_SelectedProperty As PropertyItem
+ Public Property SelectedProperty As PropertyItem
+ Get
+ Return m_SelectedProperty
+ End Get
+ Set(value As PropertyItem)
+ m_SelectedProperty = value
+ Map.refSceneManagerVM.RefreshBtn()
+ Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
+ NotifyPropertyChanged("SelectedProperty")
End Set
End Property
@@ -199,6 +271,7 @@ Public Class Part
End Get
Set(value As Visibility)
m_PropertiesIsVisible = value
+ NotifyPropertyChanged("PropertiesIsVisible")
End Set
End Property
@@ -801,6 +874,16 @@ Public Class Part
End Set
End Property
+ Private m_SelCompo As Compo
+ Public Property SelCompo As Compo
+ Get
+ Return m_SelCompo
+ End Get
+ Set(value As Compo)
+ m_SelCompo = value
+ End Set
+ End Property
+
#Region "AddCompo"
' utilizzata nell'Hardware
@@ -941,8 +1024,11 @@ Public Class Part
End If
' evidenzio il nome della componente appena aggiunto
NewCompo.BorderColor = DirectCast(New BrushConverter().ConvertFrom("#DCDCDC"), SolidColorBrush)
- NewCompo.BackGroundColor = DirectCast(New BrushConverter().ConvertFrom("#DCDCDC"), SolidColorBrush)
+ ' #B0D0D2 = Azzurro
+ NewCompo.BackGroundColor = DirectCast(New BrushConverter().ConvertFrom("#B0D0D2"), SolidColorBrush)
NewCompo.BorderThickness = 1
+ m_SelCompo=NewCompo
+ NotifyPropertyChanged("SelCompo")
End If
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
Return NewCompo
@@ -1116,6 +1202,8 @@ Public Class Part
#Region "LETTURA DDF"
Private bModifyProperties As Boolean = False
+ Private sNameDDFMaterial As String = ""
+ Private sNameDDFProperty As String = ""
Private bModifyBevel As Boolean = False
Private bDeleteTopArch As Boolean = False
Private FileContent As String()
@@ -1216,9 +1304,39 @@ Public Class Part
End If
Case S_SECURE ' creo l'oggetto OptionPage nella Mappa
LineIndex = ReadDoor.GetSecure(LineIndex)
+ Case S_MATERIAL
+ LineIndex = ReadDoor.GetMaterial(LineIndex)
+ If LineIndex = -1 then
+ '50532=Missing list of material at file "../Compo/Default.ini".
+ sErrorInfo &= EgtMsg(50532) & vbCrLf
+ ReadDoor = Nothing
+ Exit While
+ ElseIf LineIndex = -2 then
+ '50531=The current material {0} does not exist in list of material. Look at file "../Compo/Default.ini".
+ sErrorInfo &= String.Format(EgtMsg(50531), ReadDoor.sNameDDFMaterial) & vbCrLf
+ ReadDoor = Nothing
+ Exit While
+ End If
Case ConstCompo.S_PROPERTIES
bProperties = True
LineIndex = ReadDoor.GetProperties(LineIndex)
+ If LineIndex = -1 then
+ '50533=Impossible to load more than one property at time.
+ sErrorInfo &= EgtMsg(50533) & vbCrLf
+ ReadDoor = Nothing
+ Exit While
+ ElseIf LineIndex = -2 then
+ If Not IsNothing(ReadDoor.m_SelectedMaterial) then
+ ' 50530=Property {0} does not exist in list of {1}. Look at file "../Compo/Default.ini"
+ sErrorInfo &= String.Format(EgtMsg(50530), ReadDoor.sNameDDFProperty, ReadDoor.m_SelectedMaterial.Name) & vbCrLf
+ Else
+ ' 50534=Property {0} does not exist in the list. Look at file "../Compo/Default.ini".
+ sErrorInfo &= String.Format(EgtMsg(50534), ReadDoor.sNameDDFProperty) & vbCrLf
+ End If
+
+ ReadDoor = Nothing
+ Exit While
+ End If
Case ConstCompo.S_PROFILES
Dim LocalMsg As String = String.Empty
LineIndex = ReadDoor.GetProfiles(ReadDoor.NextIndex(LineIndex), ReadDoor.TypePart, LocalMsg)
@@ -1270,24 +1388,33 @@ Public Class Part
If Not IsNothing(ReadDoor) And ReadDoorCompleted Then
' se la porta esiste allora mostro i suoi parametri
Map.refPartPageVM.CurrPart = ReadDoor
+
' se non passo dalla funzione che raccoglie queste informazioni
If Not bProperties AndAlso ReadDoor.PropertiesIsVisible = Visibility.Visible Then
For Each Item In ReadDoor.PropertiesList
Item.IsChecked = False
Next
End If
+
+ ' se esiste un solo materiale nell'elenco dei materiali, ma non è inserito nella porta allora lo carico di default
+ If IsNothing(ReadDoor.m_SelectedMaterial) and OptionModule.m_MaterialList.Count > 0 then
+ ReadDoor.SelectedMaterial = OptionModule.m_MaterialList(0)
+ End If
+
' Messaggio di errore per le proprietà
If ReadDoor.bModifyProperties And Not FirstReadingEdge Then
' 50194 = Properties has been deleted
MessageBox.Show(EgtMsg(50194), EgtMsg(50118), MessageBoxButton.OK, MessageBoxImage.Information)
FirstReadingEdge = True
End If
+
' Messaggio di errore per il Top Arch
If ReadDoor.bDeleteTopArch Then
' 50197: Impossible to create a Top Arch because of configuration! Curr door will be modify.
MessageBox.Show(EgtMsg(50197), EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Asterisk)
FirstReadingEdge = True
End If
+
' Messaggio di errore per incongruenza bevel
If ReadDoor.bModifyBevel Then
If Not IsNothing(ReadDoor.LockEdgeType) AndAlso
@@ -1300,6 +1427,7 @@ Public Class Part
MessageBox.Show(EgtMsg(50169), EgtMsg(50115), MessageBoxButton.OK, MessageBoxImage.Asterisk, MessageBoxResult.No)
End If
End If
+
' Messaggio di errore per il Weight, quando non passa dalla funzione GetWeight (perchè il ddf non ha il peso)
If Not bPressure Then
If m_IsCheckedWeight = Visibility.Visible Then
@@ -1431,7 +1559,7 @@ Public Class Part
If Not String.IsNullOrWhiteSpace(sType) Then
m_TypePart = sType
If sType.Contains("DO_") Then
- OptionModule.CreateNewPropertiesList(m_PropertiesList)
+ OptionModule.CreateNewPropertiesList(m_PropertiesList, m_SelectedMaterial)
Else
OptionModule.CreateNewPropertiesListJamb(m_PropertiesList)
End If
@@ -1609,22 +1737,83 @@ Public Class Part
Return NextIndex(Index)
End Function
+ ' leggo il materiale
+ Private Function GetMaterial(Index As Integer) As Integer
+ ' se non trovo la lista dei materiali o la lista è vuota allora errore
+ If IsNothing(OptionModule.m_MaterialList) orelse OptionModule.m_MaterialList.Count < 1 then
+ Return -1
+ End If
+ Dim bMaterialExists = false
+ Dim sLine As String = RemoveComment(FileContent(Index))
+ Dim sMaterial As String = GetValueWithKey(sLine, S_MATERIAL)
+ If Not String.IsNullOrWhiteSpace(sMaterial) Then
+ sNameDDFMaterial = sMaterial
+ For Each MaterialItem In OptionModule.m_MaterialList
+ ' se trovo il materiale allora carico la sua lista di proprietà ed esco
+ If Trim(MaterialItem.NameDDF) = Trim(sMaterial) then
+ m_SelectedMaterial = MaterialItem
+ If Not IsNothing (MaterialItem.PropertiesList) then
+ PropertiesList = MaterialItem.PropertiesList
+ SelectedProperty = m_PropertiesList(0)
+ Else
+ PropertiesIsVisible = Visibility.Collapsed
+ End if
+ bMaterialExists = true
+ Return NextIndex(Index)
+ End If
+ Next
+ End If
+ ' se il materiale non è nell'elenco dei materiali
+ If Not bMaterialExists then
+ Return -2
+ End If
+ Return NextIndex(Index)
+ End Function
+
' leggo le proprietà
Private Function GetProperties(Index As Integer) As Integer
+ ' se esiste l'elenco dei materiali (nuova configurazione) ma il ddf è senza: allora passo come materiale di default il primo della lista (wood)
+ If IsNothing(m_SelectedMaterial) andalso OptionModule.m_MaterialList.Count > 0 Then
+ SelectedMaterial = OptionModule.m_MaterialList(0)
+ PropertiesList = OptionModule.m_MaterialList(0).PropertiesList
+ End If
+ ' devo verificare se esite la lista dei materiali
+ Dim bPropertyExists = false
Dim sLine As String = RemoveComment(FileContent(Index))
- If PropertiesIsVisible = Visibility.Collapsed Then bModifyProperties = True
+ ' se esiste la proprietà, ma non è selezionata allora comunico la modifica
+ If PropertiesIsVisible = Visibility.Collapsed Then
+ bModifyProperties = True
+ End If
Dim sProperties As String = GetValueWithKey(sLine, ConstCompo.S_PROPERTIES)
If Not String.IsNullOrWhiteSpace(sProperties) Then
' carico il valore nella porta corrente
Dim sItem() As String = sProperties.Split(","c)
+ ' se la lista contiene più di una proprietà
+ If sItem.Count > 1 then
+ Return -1
+ End If
For Each Item In m_PropertiesList
Item.IsChecked = False
For Each ItemRead In sItem
- If Trim(Item.Name) = ItemRead Then
+ If Trim(Item.Name) = Trim(ItemRead) Then
+ m_SelectedProperty = Item
Item.IsChecked = True
- End If
+ bPropertyExists = True
+ End If
Next
Next
+ ' se la proprietà non appartiene alla lista allora esco e non carico la porta
+ If Not bPropertyExists then
+ sNameDDFProperty = sProperties
+ Return -2
+ End If
+ Else
+ For Each Item In m_PropertiesList
+ If Item.Name = NONE_DDF then
+ SelectedProperty = Item
+ Exit for
+ End If
+ next
End If
Return NextIndex(Index)
End Function
diff --git a/DoorParameters/PartPageV.xaml b/DoorParameters/PartPageV.xaml
index a918c34..6d8b2a0 100644
--- a/DoorParameters/PartPageV.xaml
+++ b/DoorParameters/PartPageV.xaml
@@ -22,15 +22,15 @@
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
+
@@ -93,31 +93,31 @@
-
-
-
-
-
-
@@ -129,56 +129,45 @@
Visibility="{Binding CurrPart.VisibilityWeight}"/>
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
@@ -320,31 +345,63 @@
Style="{StaticResource DoorParamsTxBx}"
Text="{Binding CurrPart.Radius, UpdateSourceTrigger=PropertyChanged}"
ToolTip="{Binding CurrPart.ToolTipEvaluatedRadius}"
- Margin="0.4,2,39.6,3.2"
+ Margin="0.4,2,10.6,3.2"
IsReadOnly="{Binding IsRaedOnly}"/>
+ Margin="2,2,0,2"/>
-
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -361,7 +418,7 @@
-
+
-
-
-
-
+
-
-
-
-
+
+
+
+
@@ -449,28 +506,28 @@
-
-
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
+
-
-
+
+
+
+
+
+
@@ -490,20 +547,20 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
+
@@ -524,40 +581,40 @@
Margin="0,0,0,2"
ToolTip="{Binding ToolTipValue}"
IsEnabled="{Binding IsReadOnly}"/>
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
+
-
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
diff --git a/DoorParameters/PartPageV.xaml.vb b/DoorParameters/PartPageV.xaml.vb
index 40dcfb9..4bf0fa7 100644
--- a/DoorParameters/PartPageV.xaml.vb
+++ b/DoorParameters/PartPageV.xaml.vb
@@ -1,3 +1,29 @@
-Public Class DoorParametersV
+Public Class PartPageV
+
+ Public Sub ItemsControl_SelectionChanged(sender As Object, e As SelectionChangedEventArgs)
+ Dim ListControl As ListBox=DirectCast(sender,listbox)
+ If Not IsNothing( ListControl.SelectedItem) Then
+ Dim SelectedItemIndex As Integer = ListControl.Items.IndexOf(ListControl.SelectedItem)
+ ListControl.Dispatcher.BeginInvoke(DirectCast(Sub()
+ ListControl.UpdateLayout()
+ If ListControl.SelectedItem IsNot Nothing Then
+ ListControl.ScrollIntoView(ListControl.SelectedItem)
+ End If
+ End Sub, Action))
+ If SelectedItemIndex > 0 Then
+ ListControl.Dispatcher.BeginInvoke(DirectCast(Sub()
+ ListControl.UpdateLayout()
+ ListControl.ScrollIntoView(ListControl.Items(SelectedItemIndex - 1))
+ End Sub, Action))
+ End If
+ If SelectedItemIndex < ListControl.Items.Count - 2 Then
+ ListControl.Dispatcher.BeginInvoke(DirectCast(Sub()
+ ListControl.UpdateLayout()
+ ListControl.ScrollIntoView(ListControl.Items(SelectedItemIndex + 1))
+ End Sub, Action))
+ End If
+ End If
+
+ End Sub
End Class
diff --git a/DoorParameters/PartPageVM.vb b/DoorParameters/PartPageVM.vb
index 0eef4b7..e3ecf9e 100644
--- a/DoorParameters/PartPageVM.vb
+++ b/DoorParameters/PartPageVM.vb
@@ -171,11 +171,16 @@ Public Class PartPageVM
Return "Top Arc"
End Get
End Property
- Public ReadOnly Property PropertiesMsg As String
+ Public ReadOnly Property PropertyMsg As String
Get
Return "Properties"
End Get
End Property
+ Public ReadOnly Property MaterialMsg As String
+ Get
+ Return "Material"
+ End Get
+ End Property
Public ReadOnly Property DeleteCompoToolTip As String
Get
diff --git a/DoorParameters/PropertyItem.vb b/DoorParameters/PropertyItem.vb
index 9866688..25a0efc 100644
--- a/DoorParameters/PropertyItem.vb
+++ b/DoorParameters/PropertyItem.vb
@@ -1,7 +1,11 @@
-Imports EgtWPFLib5
+'Imports EgtWPFLib5
+'Imports EgtUILib
+Imports System.Collections.ObjectModel
+Imports System.IO
+Imports System.ComponentModel
Public Class PropertyItem
- Inherits VMBase
+ Implements INotifyPropertyChanged
Private m_GraphicName As String
Public Property GraphicName As String
@@ -41,4 +45,61 @@ Public Class PropertyItem
m_IsChecked = bIsChecked
End Sub
+ Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
+
+ Public Sub NotifyPropertyChanged(propName As String)
+ RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
+ End Sub
+
End Class
+
+
+Public Class MaterialType
+ 'Inherits VMBase
+ Implements INotifyPropertyChanged
+
+ ' nome caricato dalla lista dei messaggi
+ Private m_Name As String
+ Public Property Name As String
+ Get
+ Return m_Name
+ End Get
+ Set(value As String)
+ m_Name = value
+ End Set
+ End Property
+
+ ' nome caricato dalla configurazione
+ Private m_NameDDF As String
+ Public Property NameDDF As String
+ Get
+ Return m_NameDDF
+ End Get
+ Set(value As String)
+ m_NameDDF = value
+ End Set
+ End Property
+
+ ' lista delle proprietà associata al materiale
+ Private m_PropertiesList As ObservableCollection(Of PropertyItem)
+ Public Property PropertiesList As ObservableCollection(Of PropertyItem)
+ Get
+ Return m_PropertiesList
+ End Get
+ Set(value As ObservableCollection(Of PropertyItem))
+ m_PropertiesList = value
+ End Set
+ End Property
+
+ Sub New(sName As String, sGraphicName As String)
+ m_NameDDF = sName
+ m_Name = sGraphicName
+ End Sub
+
+ Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
+
+ Public Sub NotifyPropertyChanged(propName As String)
+ RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
+ End Sub
+
+End Class
\ No newline at end of file
diff --git a/IniFile.vb b/IniFile.vb
index 6d74b05..bb034b6 100644
--- a/IniFile.vb
+++ b/IniFile.vb
@@ -93,6 +93,49 @@ Friend Module IniFile
Return True
End Function
+ ' legge e genera le liste delle proprietà per i materiali
+ Public Function DefaultGetPrivateProfileMaterialProperties( ByVal lpAppName As String, ByVal lpKeyName As String, ByVal MList As ObservableCollection(Of MaterialType)) As Boolean
+ If IsNothing(MList) orelse MList.Count < 1 then Return false
+ ' lpKeyName = nome della variabile del paragrafo (Property_n)
+ Dim sVal As String = String.Empty
+ Dim IndexType As Integer = 1
+ Dim EndOfList As Boolean = False
+ Dim bSideExists As Boolean = False
+ While Not EndOfList
+ Dim CurrlpKeyName = lpKeyName & DoubleToString(IndexType, 0)
+ DefaultGetPrivateProfileString(lpAppName, CurrlpKeyName, "", sVal)
+ If String.IsNullOrEmpty(sVal) Then
+ EndOfList = True
+ Continue While
+ End If
+ ' separo in funzione della virgola ("/" è il separatore NomeDDF/NomeGrafica)
+ Dim Item() As String = sVal.Split(","c)
+ ' verifico di avere almeno due elementi (altrimenti vado all'elemento successivo senza aggiungerlo alla lista)
+ If Item.Count < 2 then
+ IndexType = IndexType + 1
+ Continue While
+ End If
+ ' a partire dal secondo elemento del vettore (insieme dei materiali)
+ For IndexItem = 1 to Item.Count - 1
+ For Each MaterialItem In MList
+ If Trim(MaterialItem.NameDDF) = Trim(Item(IndexItem)) then
+ Dim ItemProp() As String = Item(0).Split("/"c)
+ If IsNothing(MaterialItem.PropertiesList) then
+ MaterialItem.PropertiesList = New ObservableCollection(Of PropertyItem)
+ End If
+ If ItemProp.Count < 2 then
+ MaterialItem.PropertiesList.Add(New PropertyItem( ItemProp(0), ItemProp(0), false))
+ Else
+ MaterialItem.PropertiesList.Add(New PropertyItem( ItemProp(0), ItemProp(1), false))
+ End If
+ End If
+ Next
+ Next
+ IndexType = IndexType + 1
+ End While
+ Return true
+ End Function
+
' Edge, EgdgeType_n, ObservableCollection
Public Function DefaultGetPrivateProfileNewVersion(ByVal lpAppName As String, ByVal lpKeyName As String, ByVal List As ObservableCollection(Of String),
ByVal ListLock As ObservableCollection(Of EdgeType),
diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb
index 46815a2..091ced2 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 a5116e4..ecad7a9 100644
--- a/OptionsWindow/OptionModule.vb
+++ b/OptionsWindow/OptionModule.vb
@@ -27,9 +27,13 @@ Friend Module OptionModule
Friend m_DisableArch As Visibility = Visibility.Collapsed
Friend m_DisableProperties As Visibility
+ Friend m_MaterialIsVisible As Visibility = Visibility.Visible
Friend m_PropertList As New ObservableCollection(Of PropertyItem)
Friend m_PropertListJamb As New ObservableCollection(Of PropertyItem)
+ ' lista dei materiali
+ Friend m_MaterialList As New ObservableCollection(Of MaterialType)
+
Friend Enum LauncherOpt As Integer
Open_window = 0
Open_last_project = 1
@@ -276,13 +280,41 @@ Friend Module OptionModule
m_bBevelDown = Visibility.Visible
End If
- ' carico la lista delle proprietà
+ ' carico i nomi dei materiali (NomeDDF/NomeGrafica) e le liste di materiali associate
+ Dim MaterialList As New ObservableCollection(Of String)
+ DefaultGetPrivateProfileObservableCollection("Material", "MaterialList", MaterialList)
+ LoadMaterialList (MaterialList)
+ ' se eiste un solo materiale allora non mostro a vodeo
+ If MaterialList.Count < 2 then
+ m_MaterialIsVisible = Visibility.Collapsed
+ End If
Dim PropertyList As New ObservableCollection(Of String)
- DefaultGetPrivateProfileObservableCollection(ConstIni.S_PROPERTIES_INI, ConstIni.K_PROPRTIESLIST_INI, PropertyList)
- LoadPropertiesList(PropertyList, m_PropertList)
- PropertyList.Clear()
- DefaultGetPrivateProfileObservableCollection(ConstIni.S_PROPERTIES_INI, ConstIni.K_PROPRTIESLISTJAMB_INI, PropertyList)
- If PropertyList.Count > 0 Then LoadPropertiesList(PropertyList, m_PropertListJamb)
+ ' se non trovo l'elenco dei materiali allora eseguo le vecchie istruzioni
+ If Not DefaultGetPrivateProfileMaterialProperties(ConstIni.S_PROPERTIES_INI, "Property", m_MaterialList) then
+ DefaultGetPrivateProfileObservableCollection(ConstIni.S_PROPERTIES_INI, ConstIni.K_PROPRTIESLIST_INI, PropertyList)
+ m_MaterialIsVisible = Visibility.Collapsed
+ ' carico la vecchia lista di proprietà
+ LoadPropertiesList(PropertyList, m_PropertList)
+ ' genero una lista fittizia di materiali
+ MaterialList.Add(GENERICMATERIAL)
+ LoadMaterialList (MaterialList)
+ m_MaterialList(0).PropertiesList = m_PropertList
+ If PropertyList.Count < 1 then
+ OptionModule.m_DisableProperties = Visibility.Collapsed
+ End If
+ PropertyList.Clear()
+ DefaultGetPrivateProfileObservableCollection(ConstIni.S_PROPERTIES_INI, ConstIni.K_PROPRTIESLISTJAMB_INI, PropertyList)
+ If PropertyList.Count > 0 Then LoadPropertiesList(PropertyList, m_PropertListJamb)
+ End If
+ '-------------------------------------------------------------------------------------------------------------------------------
+ ' carico la lista delle proprietà
+ 'Dim PropertyList As New ObservableCollection(Of String)
+ 'DefaultGetPrivateProfileObservableCollection(ConstIni.S_PROPERTIES_INI, ConstIni.K_PROPRTIESLIST_INI, PropertyList)
+ 'LoadPropertiesList(PropertyList, m_PropertList)
+ 'PropertyList.Clear()
+ 'DefaultGetPrivateProfileObservableCollection(ConstIni.S_PROPERTIES_INI, ConstIni.K_PROPRTIESLISTJAMB_INI, PropertyList)
+ 'If PropertyList.Count > 0 Then LoadPropertiesList(PropertyList, m_PropertListJamb)
+ '-------------------------------------------------------------------------------------------------------------------------------
' Leggo le dimensioni della porta dal file Default.ini
Dim IsMM As Boolean = False
@@ -585,6 +617,18 @@ Friend Module OptionModule
End Sub
+ Friend sub LoadMaterialList (ByVal List As ObservableCollection(Of string))
+ If IsNothing(List) then Return
+ For Each Material In List
+ Dim Item As String() = Material.Split("/"c)
+ If Item.Count < 2 then
+ m_MaterialList.Add(New MaterialType(Item(0),Item(0)))
+ else
+ m_MaterialList.Add(New MaterialType(Item(0),Item(1)))
+ End If
+ Next
+ End Sub
+
Friend Sub LoadPropertiesList(List As ObservableCollection(Of String), ByRef ListToBeLoaded As ObservableCollection(Of PropertyItem))
If List.Count = 0 Then
m_DisableProperties = Visibility.Collapsed
@@ -617,10 +661,26 @@ Friend Module OptionModule
End If
End If
Next
+ Dim bNoneExists As Boolean = false
+ For Each Item in ListToBeLoaded
+ If Item.Name = NONE_DDF then
+ bNoneExists = true
+ Exit for
+ End If
+ Next
+ If Not bNoneExists then
+ ListToBeLoaded.Add(New PropertyItem(NONE_DDF, EgtMsg(50703), False))
+ End If
End Sub
- Friend Sub CreateNewPropertiesList(ByRef List As ObservableCollection(Of PropertyItem))
+ Friend Sub CreateNewPropertiesList(ByRef List As ObservableCollection(Of PropertyItem), ByRef SelectedMaterial As MaterialType)
If OptionModule.m_DisableProperties <> Visibility.Visible Then Return
+ If OptionModule.m_MaterialList.Count > 1 Then
+ SelectedMaterial = OptionModule.m_MaterialList(0)
+ List = OptionModule.m_MaterialList(0).PropertiesList
+ return
+ End if
+ ' configurazione senza materiali
If List.Count > 0 Then List.Clear()
For Each Item In OptionModule.m_PropertList
List.Add(New PropertyItem(Item.Name, Item.GraphicName, Item.IsChecked))