From 48eee073a29984c0773e72bc73595a2c7483bb14 Mon Sep 17 00:00:00 2001 From: Nicola Pievani Date: Mon, 28 May 2018 16:34:48 +0000 Subject: [PATCH] EgtDoorCreator 1.9e1: - crea nuovi brand - selezione file nge --- Assembly/Assembly.vb | 6 +- AssemblyManager/AssemblyManagerVM.vb | 22 +- Constants/ConstCompo.vb | 1 + Constants/ConstGen.vb | 2 +- DoorParameters/Compo.vb | 150 +++++++++-- DoorParameters/Part.vb | 44 ++-- EgtDOORCreator.vbproj | 17 +- HardwareGeometry/GeometryListConfigVM.vb | 247 ++++++++++++++++++ HardwareGeometry/GeomtryListConfigV.xaml | 82 ++++++ HardwareGeometry/GeomtryListConfigV.xaml.vb | 12 + HardwareManager/Hardware.vb | 135 +++++++++- .../HardwareHelpSceneHostV.xaml.vb | 6 + HardwareManager/HardwarePageV.xaml | 50 +++- HardwareManager/HardwarePageVM.vb | 51 ++++ IniFile.vb | 13 + My Project/AssemblyInfo.vb | 4 +- NewHardware/NewHardwareVM.vb | 2 +- ProjectManager/ProjectManagerHardwareV.xaml | 3 + ProjectManager/ProjectManagerHardwareVM.vb | 50 ++++ ProjectManager/ProjectManagerVM.vb | 1 + RegexFunction.vb | 2 +- Resources/TopCommandBar/Search.png | Bin 0 -> 319 bytes 22 files changed, 825 insertions(+), 75 deletions(-) create mode 100644 HardwareGeometry/GeometryListConfigVM.vb create mode 100644 HardwareGeometry/GeomtryListConfigV.xaml create mode 100644 HardwareGeometry/GeomtryListConfigV.xaml.vb create mode 100644 Resources/TopCommandBar/Search.png diff --git a/Assembly/Assembly.vb b/Assembly/Assembly.vb index e3fd37e..a741c46 100644 --- a/Assembly/Assembly.vb +++ b/Assembly/Assembly.vb @@ -815,6 +815,7 @@ Public Class Assembly Private Function SkipWhiteSpace(Index As Integer) As Integer Dim ExitLoop As Boolean = False While Not ExitLoop And Index < FileContent.Count - 1 + ' se la riga contiene un commeto allora faccio questo controllo If FileContent(Index).Contains(ConstCompo.DDF_METADATA) Then If Not String.IsNullOrWhiteSpace(Regex.Match(FileContent(Index), "\s*" & DDF_METADATA & "\s*(.*?\b)\s*:\s*$").Groups(1).Value) Then ExitLoop = True @@ -1320,7 +1321,7 @@ Public Class Assembly End If End If '-------------------------------------------------------------------------------------------------------------------------------------------------------------- - ' Elimino tutti le componenti sul Jamb (che ora diventa di Tipo L) eliminando dalla porta due + ' Elimino tutti le componenti sul Jamb (che ora diventa di Tipo L) eliminando dalla porta 2 Map.refPartPageVM.CurrPart = GetArrayPartDoor(1).Door For IndexDeleteCompo As Integer = GetArrayPartDoor(1).Door.CompoList.Count - 1 To 0 Step -1 GetArrayPartDoor(1).Door.CompoList(IndexDeleteCompo).Delete() @@ -1452,6 +1453,8 @@ Public Class Assembly ReplaceHardware() NotifyPropertyChanged("CurrAssembly") End Select + ' in base a quante porte devo mostrare a video creo due cicli + ' Accende le porte For Index As Integer = 0 To CInt(m_DoorNumber) - 1 If Not IsNothing(m_ArrayPartDoor(Index)) Then m_ArrayPartDoor(Index).IsVisible = Visibility.Visible @@ -1460,6 +1463,7 @@ Public Class Assembly m_ArrayPartDoor(Index).NotifyPropertyChanged("TypePart") End If Next + ' Spegne le porte rimanenti For Index As Integer = CInt(m_DoorNumber) To MAX_DOORNUMBER If Not IsNothing(m_ArrayPartDoor(Index)) Then m_ArrayPartDoor(Index).IsVisible = Visibility.Collapsed diff --git a/AssemblyManager/AssemblyManagerVM.vb b/AssemblyManager/AssemblyManagerVM.vb index f085cf9..99db99e 100644 --- a/AssemblyManager/AssemblyManagerVM.vb +++ b/AssemblyManager/AssemblyManagerVM.vb @@ -232,13 +232,15 @@ Public Class AssemblyManagerVM ' riaggiorno la lista dei bevel con quello che è stato settato nel Confi.ini 'Part.RebuiltDispositionList() - ' costruisco e carico le parti + ' costruisco e carico le parti (Jamb) CreatePart(Local_SelAssembly) - ' carico l'assemblato che sto creando in locale (così da poter gestire i Jamb) + ' carico come progetto corrente l'assemblato che sto creando in locale (così da poter gestire i Jamb), l'array delle porte è ancora vuoto! m_CurrProject.SelAssemblyName.SelAssembly = Local_SelAssembly + ' carico il numero massimo di porte ammesse e intanto dimesiono i jamb CreateDoor(Local_SelAssembly) - ' calcolo la dimensione dei Jambs in funzione del numero di porte visibili ed assegno gli swing + ' calcolo la dimensione dei Jambs in funzione del numero di porte realmente visibili ed assegno gli swing Local_SelAssembly.DoorVisibilityNew() + ' eseguo il rabbet sui jamb Local_SelAssembly.TopRabbetJamb() 'Local_SelAssembly.HingeRabbetJamb() Return Local_SelAssembly @@ -281,19 +283,6 @@ Public Class AssemblyManagerVM ' Caricamento del vettore delle porte, se già ne esiste uno esso viene sovrascritto con nuovi oggetti Private Sub CreateDoor(ByRef CurrAssembly As Assembly) - CurrAssembly.LockEdgeType = CurrAssembly.LockEdgeType - CurrAssembly.HingeEdgeType = CurrAssembly.HingeEdgeType - CurrAssembly.TopType = CurrAssembly.TopType - CurrAssembly.BottomType = CurrAssembly.BottomType - CurrAssembly.LockEdgeMachining = CurrAssembly.LockEdgeMachining - CurrAssembly.HingeEdgeMachining = CurrAssembly.HingeEdgeMachining - CurrAssembly.TopMachining = CurrAssembly.TopMachining - CurrAssembly.BottomMachining = CurrAssembly.BottomMachining - CurrAssembly.LockEdgeOverMaterial = CurrAssembly.LockEdgeOverMaterial - CurrAssembly.HingeEdgeOverMaterial = CurrAssembly.HingeEdgeOverMaterial - CurrAssembly.TopOverMaterial = CurrAssembly.TopOverMaterial - CurrAssembly.BottomOverMaterial = CurrAssembly.BottomOverMaterial - ' qui carico il vettore delle porte (se il vettore è vuoto) Dim ref_PartDoor As PartDoor Dim ref_Door As Part For IndexDoor As Integer = 0 To MAX_DOORNUMBER @@ -303,6 +292,7 @@ Public Class AssemblyManagerVM LoadDefaultPartOne(ref_Door) ref_PartDoor.Door = ref_Door ref_PartDoor.IsChecked = True + ' aggiungo la port al vettore che contiene le porte CurrAssembly.ArrayPartDoor.Add(ref_PartDoor) Next End Sub diff --git a/Constants/ConstCompo.vb b/Constants/ConstCompo.vb index 1c125a7..3106028 100644 --- a/Constants/ConstCompo.vb +++ b/Constants/ConstCompo.vb @@ -112,6 +112,7 @@ Module ConstCompo Public Const INI_TEXTBOXDGC As String = "TextBoxDGC" Public Const INI_TEXTBOXTHICKNESS As String = "TextBoxThickness" Public Const INI_TEXTBOX_ONOFF As String = "TextBoxOnOff" + Public Const INI_TEXTBOXNGE As String = "TextBoxNge" Public Const INI_CHECKBOX As String = "CheckBox" Public Const INI_GHOST As String = "Ghost" diff --git a/Constants/ConstGen.vb b/Constants/ConstGen.vb index f45b9c2..5401751 100644 --- a/Constants/ConstGen.vb +++ b/Constants/ConstGen.vb @@ -83,7 +83,7 @@ Module ConstGen Public Const LOCK As String = "L" Public Const HINGE As String = "H" Public Const BOTTOM As String = "B" - Public Const TOP As String = "TOP" + Public Const TOP As String = "T" Public Const RIGHTHAND As String = "RH" Public Const RIGHTHAND_REVERSE As String = "RHR" diff --git a/DoorParameters/Compo.vb b/DoorParameters/Compo.vb index 348ca0b..703218e 100644 --- a/DoorParameters/Compo.vb +++ b/DoorParameters/Compo.vb @@ -745,8 +745,8 @@ Public Class Compo End If ' Ricavo i diversi item Dim sComboItemList() As String = sItems(2).Split(","c) - Dim ComboItemList As New List(Of String) - Dim DDFComboItemList As New List(Of String) + Dim ComboItemList As New ObservableCollection(Of String) + Dim DDFComboItemList As New ObservableCollection(Of String) For ItemIndex = 0 To sComboItemList.Count - 1 Dim ComboItem() As String = sComboItemList(ItemIndex).Split("/"c) ' se esiste il NomeDDFItem @@ -788,8 +788,8 @@ Public Class Compo End If ' Ricavo i diversi item Dim sComboItemList() As String = sItems(2).Split(","c) - Dim ComboItemList As New List(Of String) - Dim DDFComboItemList As New List(Of String) + Dim ComboItemList As New ObservableCollection(Of String) + Dim DDFComboItemList As New ObservableCollection(Of String) For ItemIndex = 0 To sComboItemList.Count - 1 Dim ComboItem() As String = sComboItemList(ItemIndex).Split("/"c) ' se esiste il NomeDDFItem @@ -920,8 +920,8 @@ Public Class Compo End If ' Ricavo i diversi item Dim sComboItemList() As String = sItems(2).Split(","c) - Dim ComboItemList As New List(Of String) - Dim DDFComboItemList As New List(Of String) + Dim ComboItemList As New ObservableCollection(Of String) + Dim DDFComboItemList As New ObservableCollection(Of String) For ItemIndex = 0 To sComboItemList.Count - 1 Dim ComboItem() As String = sComboItemList(ItemIndex).Split("/"c) ' se esiste il NomeDDFItem @@ -941,7 +941,7 @@ Public Class Compo NewCompoParam = New ComboBoxParam(sDDFName, sName, Me, ComboItemList, DDFComboItemList, ComboItemList(0), sHelpParam) Return True Case INI_COMBOBOX_LUA - ' NomeDDF e Nome del combo "ComboBoxLua; LG/geometry name; key1/L" + ' NomeDDF e Nome del combo "ComboBoxLua; LG/geometry name; key1/L; refParam" Dim sComboList() As String = sItems(1).Split("/"c) Dim sLuaName As String = String.Empty Dim sName As String = String.Empty @@ -964,7 +964,7 @@ Public Class Compo End If End If ' prima chiave di ricerca trovata - If sItems.Count = 3 Then + If sItems.Count >= 3 Then Dim sKey1() As String = sItems(2).Split("/"c) Dim sKeyParamLua As String = String.Empty Dim sKey1Param As String = String.Empty @@ -981,7 +981,16 @@ Public Class Compo Return False End If End If - ' Ricavo i diversi item + ' cerco la seconda chiave di ricerca (il nome del parametero associato all'utensile - di solito il diametro) + ' Bisogna modificare i valori della tabella! + Dim sKey2ParamLua As String = String.Empty + If sItems.Count > 3 Then + Dim sKey2() As String = sItems(3).Split("/"c) + Dim sKey2Param As String = String.Empty + If sKey2.Count() >= 1 Then sKey2Param = Trim(sKey2(0)) + End If + + ' Ricavo i diversi item da CompoMatch.ReserchInTable If String.IsNullOrEmpty(sNameGeometry) Then ' Errore nella lettura {0} nel parametro {1} della componente: non esiste. Dim sError As String = String.Format(EgtMsg(50121), sLuaName, m_CompoType.DDFName) @@ -989,14 +998,14 @@ Public Class Compo Return False End If Dim sComboItemList() As String = sNameGeometry.Split(","c) - Dim ComboItemList As New List(Of String) - Dim LuaComboItemList As New List(Of String) + Dim ComboItemList As New ObservableCollection(Of String) + Dim LuaComboItemList As New ObservableCollection(Of String) For ItemIndex = 0 To sComboItemList.Count - 1 ComboItemList.Add(Trim(sComboItemList(ItemIndex))) LuaComboItemList.Add(Trim("'" & sComboItemList(ItemIndex) & "'")) Next ' Creo il parametro - NewCompoParam = New ComboBoxParam(sLuaName, sName, Me, ComboItemList, LuaComboItemList, ComboItemList(0), sHelpParam) + NewCompoParam = New ComboBoxParamLua(sLuaName, sName, Me, ComboItemList, LuaComboItemList, ComboItemList(0), sHelpParam, sKey2ParamLua) Return True Case INI_COMBOBOX_ONOFF @@ -1021,8 +1030,8 @@ Public Class Compo End If ' Ricavo i diversi item Dim sComboItemList() As String = sItems(2).Split(","c) - Dim ComboItemList As New List(Of String) - Dim DDFComboItemList As New List(Of String) + Dim ComboItemList As New ObservableCollection(Of String) + Dim DDFComboItemList As New ObservableCollection(Of String) For ItemIndex = 0 To sComboItemList.Count - 1 Dim ComboItem() As String = sComboItemList(ItemIndex).Split("/"c) ' se esiste il NomeDDFItem @@ -1155,6 +1164,32 @@ Public Class Compo Return True End If + Case INI_TEXTBOXNGE + ' NomeDDF e Nome del Text + Dim sTextList() As String = sItems(1).Split("/"c) + Dim sDDFName As String = String.Empty + Dim sName As String = String.Empty + If sTextList.Count() >= 1 Then sDDFName = Trim(sTextList(0)) + If sTextList.Count() >= 2 Then + sName = Trim(MsgControl(sTextList(0), sTextList(1), sErrorList)) + Else + sName = sDDFName + ' Errore nella lettura del nome {0} in {1}. Attesa una corrispondenza numerica. + sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50120), sTextList(0), m_CompoType.Path)) + End If + ' Se ci sono 2 elementi "TextBox; NomeDDF/Nome" + If sItems.Count < 3 Then + NewCompoParam = New TextBoxNgeParam(sDDFName, sName, Me, "", Nothing, Nothing, sHelpParam) + Return True + End If + If Not IsNothing(sItems(2)) Then + NewCompoParam = New TextBoxNgeParam(sDDFName, sName, Me, sItems(2), Nothing, Nothing, sHelpParam) + Return True + Else + NewCompoParam = New TextBoxNgeParam(sDDFName, sName, Me, "", Nothing, Nothing, sHelpParam) + Return True + End If + Case INI_TEXTBOXDGC ' NomeDDF e Nome del Text Dim sTextList() As String = sItems(1).Split("/"c) @@ -1663,23 +1698,25 @@ Public Class ComboBoxParam End Set End Property - Private m_ItemList As New List(Of String) - Public Property ItemList As List(Of String) + Private m_ItemList As New ObservableCollection(Of String) + Public Property ItemList As ObservableCollection(Of String) Get Return m_ItemList End Get - Set(value As List(Of String)) + Set(value As ObservableCollection(Of String)) m_ItemList = value + NotifyPropertyChanged("ItemList") End Set End Property - Private m_ItemListDDF As New List(Of String) - Public Property ItemListDDF As List(Of String) + Private m_ItemListDDF As New ObservableCollection(Of String) + Public Property ItemListDDF As ObservableCollection(Of String) Get Return m_ItemListDDF End Get - Set(value As List(Of String)) + Set(value As ObservableCollection(Of String)) m_ItemListDDF = value + NotifyPropertyChanged("ItemListDDF") End Set End Property @@ -1707,10 +1744,10 @@ Public Class ComboBoxParam NotifyPropertyChanged("SelItem") End Sub - Sub New(sDDFName As String, sName As String, CurrCompo As Compo, ItemList As List(Of String), ItemListDDF As List(Of String), sSelItem As String, Optional sLayerName As String = "") + Sub New(sDDFName As String, sName As String, CurrCompo As Compo, ref_ItemList As ObservableCollection(Of String), ref_ItemListDDF As ObservableCollection(Of String), sSelItem As String, Optional sLayerName As String = "") MyBase.New(sDDFName, sName, CurrCompo, sLayerName) - m_ItemList = ItemList - m_ItemListDDF = ItemListDDF + ItemList = ref_ItemList + ItemListDDF = ref_ItemListDDF m_SelItem = sSelItem End Sub @@ -1744,6 +1781,30 @@ Public Class TextBoxOnOffParam End Sub End Class +Public Class TextBoxNgeParam + Inherits TextBoxParam + + Private m_IsActive As Boolean = False + Public Property IsActive As Boolean + Get + Return m_IsActive + End Get + Set(value As Boolean) + m_IsActive = value + SetModified() + Map.refSceneManagerVM.RefreshBtn() + End Set + End Property + Public Sub SetIsActive(IsActive As Boolean) + m_IsActive = IsActive + 'NotifyPropertyChanged("IsActive") + End Sub + + Sub New(sDDFName As String, sName As String, CurrCompo As Compo, sValue As String, ComboBox As ComboBoxParam, ComboValuelList As List(Of String), Optional sLayerName As String = "") + MyBase.New(sDDFName, sName, CurrCompo, sValue, ComboBox, ComboValuelList, sLayerName) + End Sub +End Class + Public Class TextBoxDGCParam Inherits TextBoxParam @@ -1890,11 +1951,52 @@ Public Class ComboBoxOnOffParam 'NotifyPropertyChanged("IsActive") End Sub - Sub New(sDDFName As String, sName As String, CurrCompo As Compo, ItemList As List(Of String), ItemListDDF As List(Of String), sSelItem As String, Optional sLayerName As String = "") + Sub New(sDDFName As String, sName As String, CurrCompo As Compo, ItemList As ObservableCollection(Of String), ItemListDDF As ObservableCollection(Of String), sSelItem As String, Optional sLayerName As String = "") MyBase.New(sDDFName, sName, CurrCompo, ItemList, ItemListDDF, sSelItem, sLayerName) End Sub End Class +Public Class ComboBoxParamLua + Inherits ComboBoxParam + ' serve solo per distinguere le liste che sono caricate da file GeometryNameList.ini + + ' riceve il nome del parametro associato alla geometria di lavorazione + Private Property m_refParam As String + Public Property refParam As String + Get + Return m_refParam + End Get + Set(value As String) + m_refParam = value + End Set + End Property + + Private m_NameWorking As String + Public Property NameWorking As String + Get + Return m_NameWorking + End Get + Set(value As String) + m_NameWorking = value + End Set + End Property + + Private m_TypeWorking As String + Public Property TypeWorking As String + Get + Return m_TypeWorking + End Get + Set(value As String) + m_TypeWorking = value + End Set + End Property + + Sub New(sDDFName As String, sName As String, CurrCompo As Compo, ItemList As ObservableCollection(Of String), ItemListDDF As ObservableCollection(Of String), sSelItem As String, Optional sLayerName As String = "", Optional sKey2 As String = "") + MyBase.New(sDDFName, sName, CurrCompo, ItemList, ItemListDDF, sSelItem, sLayerName) + m_refParam = sKey2 + End Sub +End Class + Public Class ItemConstThickness Private m_Name As String diff --git a/DoorParameters/Part.vb b/DoorParameters/Part.vb index 116e0a6..bfe3afb 100644 --- a/DoorParameters/Part.vb +++ b/DoorParameters/Part.vb @@ -243,11 +243,11 @@ Public Class Part NotifyPropertyChanged("ToolTipEvaluatedThickness") NotifyPropertyChanged("ToolTipEvaluatedWidth") NotifyPropertyChanged("ToolTipEvaluatedHeight") - ' ricalcola la dimensione altezza dei Jamb FL e FR - Map.refAssemblyPageVM.CurrAssembly.HeightJamb(m_Height) - Map.refAssemblyPageVM.CurrAssembly.HeightDoor(m_Height) - Map.refAssemblyPageVM.CurrAssembly.UpDateAllCompo() - Map.refAssemblyPageVM.CurrAssembly.SetVarAssembly() + '' ricalcola la dimensione altezza dei Jamb FL e FR + 'Map.refAssemblyPageVM.CurrAssembly.HeightJamb(m_Height) + 'Map.refAssemblyPageVM.CurrAssembly.HeightDoor(m_Height) + 'Map.refAssemblyPageVM.CurrAssembly.UpDateAllCompo() + 'Map.refAssemblyPageVM.CurrAssembly.SetVarAssembly() 'SetVarSize() UpdateToolTip() NotifyPropertyChanged("Height") @@ -281,9 +281,9 @@ Public Class Part NotifyPropertyChanged("ToolTipEvaluatedWidth") NotifyPropertyChanged("ToolTipEvaluatedHeight") ' ricalcola la dimensione larghezza dei Jamb FT e FB - Map.refAssemblyPageVM.CurrAssembly.SetTopWidth() - Map.refAssemblyPageVM.CurrAssembly.UpDateAllCompo() - Map.refAssemblyPageVM.CurrAssembly.SetVarAssembly() + 'Map.refAssemblyPageVM.CurrAssembly.SetTopWidth() + 'Map.refAssemblyPageVM.CurrAssembly.UpDateAllCompo() + 'Map.refAssemblyPageVM.CurrAssembly.SetVarAssembly() 'SetVarSize() UpdateToolTip() Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True @@ -315,7 +315,7 @@ Public Class Part NotifyPropertyChanged("ToolTipEvaluatedThickness") NotifyPropertyChanged("ToolTipEvaluatedWidth") NotifyPropertyChanged("ToolTipEvaluatedHeight") - Map.refAssemblyPageVM.CurrAssembly.SetVarAssembly() + 'Map.refAssemblyPageVM.CurrAssembly.SetVarAssembly() 'SetVarSize() UpdateToolTip() Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True @@ -730,7 +730,7 @@ Public Class Part Return False End Function - 'Gestione ComboBox e TextBox di ogni compo della pulsantiera letta da Compo.ini + 'Gestione ComboBox e TextBox di ogni compo della pulsantiera letta da Compo.ini (Door) Friend Function AddNewCompo(CurrCompoType As CompoType) As Compo ' converto tutti gli sfondi in bianco For Each Compo In Map.refPartPageVM.CurrPart.CompoList @@ -925,7 +925,7 @@ Public Class Part Assembly.BuiltReffCompo = True End Sub - 'Gestione ComboBox e TextBox di ogni compo della pulsantiera letta da Compo.ini + 'Gestione ComboBox e TextBox di ogni compo della pulsantiera letta da Compo.ini (Assembly) Public Function AddRefCompo(CurrCompoType As CompoType, FrameCompoFile As String) As Compo ' creo la stringa che contiene la lista degli errori Dim ErrorList As String = String.Empty @@ -2060,19 +2060,17 @@ Public Class Part If Search3Hyphens(sLine) OrElse Search3Dots(sLine) OrElse Not String.IsNullOrWhiteSpace(GetName(sLine)) OrElse sLine.Trim().StartsWith(DDF_METADATA) Then - ' se TextBox opzionale - If TypeOf CurrCompoParam Is TextBoxOnOffParam Then - DirectCast(CurrCompoParam, TextBoxOnOffParam).SetIsActive(False) - ' se altrimenti ComboBox opzionale - ElseIf TypeOf CurrCompoParam Is ComboBoxOnOffParam Then - DirectCast(CurrCompoParam, ComboBoxOnOffParam).SetIsActive(False) - ' altrimenti manca un parametro - Else + If Not TypeOf CurrCompoParam Is TextBoxOnOffParam AndAlso Not TypeOf CurrCompoParam Is ComboBoxOnOffParam Then + ' restituisco il messaggio che manca un parametro ' Error in reading: line {0}. Expected {1}. sErrorInfo &= String.Format(EgtMsg(50139), IndexLine + 1, Trim(CompoTemplateItem.CompoParamList(IndexParam).DDFName)) ' All missing params will be initialized by default. sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50140)) & vbCrLf CompoTemplateItem.LoadByDefault = True + Else + ' significa che la TextBoxOnOff è stata disattivata + If TypeOf CurrCompoParam Is TextBoxOnOffParam Then DirectCast(CurrCompoParam, TextBoxOnOffParam).SetIsActive(False) + If TypeOf CurrCompoParam Is ComboBoxOnOffParam Then DirectCast(CurrCompoParam, ComboBoxOnOffParam).SetIsActive(False) End If Exit While End If @@ -2085,9 +2083,9 @@ Public Class Part ' leggo il valore DDF dal file Dim sVal As String = GetValueWithoutKey(sLine) ' carico la lista dei valori (messaggi) - Dim List As List(Of String) = DirectCast(CurrCompoParam, ComboBoxParam).ItemList + Dim List As ObservableCollection(Of String) = DirectCast(CurrCompoParam, ComboBoxParam).ItemList ' carico la lista dei valori DDF - Dim ListDDF As List(Of String) = DirectCast(CurrCompoParam, ComboBoxParam).ItemListDDF + Dim ListDDF As ObservableCollection(Of String) = DirectCast(CurrCompoParam, ComboBoxParam).ItemListDDF ' riscrivo i valori della lista DDF senza spazi all'inizio e alla fine e in minuscolo For IndexListDDF As Integer = 0 To ListDDF.Count - 1 ListDDF(IndexListDDF) = Trim(ListDDF(IndexListDDF)).ToLower() @@ -2180,10 +2178,10 @@ Public Class Part Dim sVal As String = GetValueWithKey(sLine, Trim(CurrCompoParam.DDFName)) Dim IndexName As Integer = 0 ' carico la lista dei valori (messaggi) - Dim List As List(Of String) = DirectCast(CurrCompoParam, ComboBoxOnOffParam).ItemList + Dim List As ObservableCollection(Of String) = DirectCast(CurrCompoParam, ComboBoxOnOffParam).ItemList Dim IndexListDDF As Integer = 0 ' carico la lista dei valori DDF - Dim ListDDF As List(Of String) = DirectCast(CurrCompoParam, ComboBoxOnOffParam).ItemListDDF + Dim ListDDF As ObservableCollection(Of String) = DirectCast(CurrCompoParam, ComboBoxOnOffParam).ItemListDDF ' riscrivo i valori della lista DDF senza spaziatura For IndexListDDF = 0 To ListDDF.Count - 1 ListDDF(IndexListDDF) = Trim(ListDDF(IndexListDDF)) diff --git a/EgtDOORCreator.vbproj b/EgtDOORCreator.vbproj index 9a158c5..1b16321 100644 --- a/EgtDOORCreator.vbproj +++ b/EgtDOORCreator.vbproj @@ -149,6 +149,10 @@ AssemblyPageV.xaml + + + GeomtryListConfigV.xaml + @@ -254,6 +258,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -454,9 +462,6 @@ - - - False @@ -536,6 +541,12 @@ + + + + + + IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\EgtDOORCreator\EgtDOORCreatorR32.exe diff --git a/HardwareGeometry/GeometryListConfigVM.vb b/HardwareGeometry/GeometryListConfigVM.vb new file mode 100644 index 0000000..b22f2c6 --- /dev/null +++ b/HardwareGeometry/GeometryListConfigVM.vb @@ -0,0 +1,247 @@ +Imports System.ComponentModel +Imports System.Collections.ObjectModel +Imports System.IO +Imports EgtUILib +Imports EgtWPFLib5 + +Public Class GeometryListConfigVM + Inherits VMBase + + Dim m_HardwareTemp As Hardware + +#Region "MESSAGES" + + Public ReadOnly Property Title As String + Get + Return "New Geometry" + End Get + End Property + Public ReadOnly Property GeometryNameMsg As String + Get + Return "Geometry Name" + End Get + End Property + Public ReadOnly Property TypeHardwareMsg As String + Get + Return "Type Hardware" + End Get + End Property + Public ReadOnly Property ParameterMsg As String + Get + Return "Parameter" + End Get + End Property + Public ReadOnly Property SaveMsg As String + Get + Return "Save" + End Get + End Property + +#End Region ' Messages + +#Region "GEOMETRY NAME" + + Private m_GeometryName As String = "Geometry" + Public Property GeometryName As String + Get + Return m_GeometryName + End Get + Set(value As String) + m_GeometryName = Trim(value) + NotifyPropertyChanged("GeometryName") + End Set + End Property + + Private m_GeometryNameList As New ObservableCollection(Of String) + Public Property GeometryNameList As ObservableCollection(Of String) + Get + Return m_GeometryNameList + End Get + Set(value As ObservableCollection(Of String)) + m_GeometryNameList = value + End Set + End Property + +#End Region ' Geommetry Name + + +#Region "HARDWARE LIST" + + Private m_HardwareList As New ObservableCollection(Of CompoType) + Private m_SelHardware As CompoType + + Private m_GraphicHardwareList As New ObservableCollection(Of String) + Public Property GraphicHardwareList As ObservableCollection(Of String) + Get + Return m_GraphicHardwareList + End Get + Set(value As ObservableCollection(Of String)) + m_GraphicHardwareList = value + NotifyPropertyChanged("GraphicHardwareList") + End Set + End Property + + Private m_SelGraphicHardware As String + Public Property SelGraphicHardware As String + Get + Return m_SelGraphicHardware + End Get + Set(value As String) + m_SelGraphicHardware = value + For Each Item In m_HardwareList + If Item.Name = m_SelGraphicHardware Then + m_SelHArdware = Item + Exit For + End If + Next + LoadParamBySelecetedHardware() + NotifyPropertyChanged("SelGraphicHardware") + End Set + End Property + +#End Region ' Hardware List + +#Region "PARAMETER LIST" + + Private m_Parameter As CompoParam + + Private m_ParameterList As New ObservableCollection(Of String) + Public Property ParameterList As ObservableCollection(Of String) + Get + Return m_ParameterList + End Get + Set(value As ObservableCollection(Of String)) + m_ParameterList = value + NotifyPropertyChanged("ParameterList") + End Set + End Property + + Private m_SelParameter As String + Public Property SelParameter As String + Get + Return m_SelParameter + End Get + Set(value As String) + m_SelParameter = value + LoadCurrParam(m_HardwareTemp, m_SelParameter) + NotifyPropertyChanged("SelParameter") + End Set + End Property + +#End Region ' Parameter List + +#Region "METODI" + + Public Function LoadNameComboBoxLua(LocalHardware As Hardware, ParamName As String) As Boolean + ' prima di ricaricare la lista deve essere svuotata + ParameterList.Clear() + For Each Chapter In LocalHardware.GroupChapters + For Each Parameter In Chapter.CompoParamList + If TypeOf Parameter Is ComboBoxParamLua Then + Dim Text As ComboBoxParamLua = DirectCast(Parameter, ComboBoxParamLua) + ParameterList.Add(Text.Name) + If ParamName = Text.DDFName Then + SelParameter = ParameterList(ParameterList.Count - 1) + m_Parameter = Parameter + End If + End If + Next + Next + If String.IsNullOrEmpty(ParamName) And ParameterList.Count > 0 Then + SelParameter = ParameterList(0) + End If + Return True + End Function + + Public Function LoadCurrParam(LocalHardware As Hardware, SelParam As String) As Boolean + For Each Chapter In LocalHardware.GroupChapters + For Each Parameter In Chapter.CompoParamList + If TypeOf Parameter Is ComboBoxParamLua Then + Dim Text As ComboBoxParamLua = DirectCast(Parameter, ComboBoxParamLua) + If SelParam = Text.Name Then + m_Parameter = Parameter + End If + End If + Next + Next + Return True + End Function + + Public Function LoadParamBySelecetedHardware() As Boolean + ' creo un HardwareTemporaneo per leggere le sue componenti + m_HardwareTemp = New Hardware + m_HardwareTemp.LoadTemplate(m_SelHardware) + LoadNameComboBoxLua(m_HardwareTemp, "") + HardwareTemp = Nothing + Return True + End Function + +#End Region + + Private m_CmdSave As ICommand + +#Region "SAVE" + + Public ReadOnly Property SaveCommand As ICommand + Get + If m_CmdSave Is Nothing Then + m_CmdSave = New Command(AddressOf SaveGeometryName) + End If + Return m_CmdSave + End Get + End Property + + Public Sub SaveGeometryName(param As Object) + Dim sGeometry As String = String.Empty + Dim sName As String = String.Empty + Dim Index As Integer = 1 + Dim bNameExists As Boolean = False + While IniFile.GetGeometryNameList("GeometryNames", CStr(Index), sName) + If m_GeometryName = sName Then + bNameExists = True + Exit While + End If + Index += 1 + End While + If bNameExists Then + MessageBox.Show("Name Exists", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning) + Return + End If + Dim sItems() As String = m_Parameter.DDFName.Split("."c) + If sItems.Count > 1 Then + sGeometry = m_GeometryName & "; " & m_HardwareTemp.HardwareGeneral.DDFName & ", " & sItems(1) + IniFile.SetGeometryNameList("GeometryNames", CStr(Index), sGeometry) + For Each Window In Application.Current.Windows + If TypeOf Window Is GeometryListConfigV Then + Dim GeometryListWindow As GeometryListConfigV = DirectCast(Window, GeometryListConfigV) + GeometryListWindow.Close() + 'aggiorno la tabella in lettura + CompoMatch.ResetHMD() + CompoMatch.LoadTableGeometry() + End If + Next + Else + MessageBox.Show("Param Name is not correct, Impossible to save.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning) + Return + End If + End Sub + +#End Region ' Save + + Sub New(ParamName As String) + ' carico la lista degli Hardware + For Each Element In Map.refCompoPanelVM.CompoTypeList + m_HardwareList.Add(Element) + m_GraphicHardwareList.Add(Element.Name) + m_HardwareTemp = Map.refHardwarePageVM.CurrHardware + If Map.refHardwarePageVM.CurrHardware.HardwareGeneral.Name = Element.Name Then + ' selziono il nome da mostrare in grafica + m_SelGraphicHardware = m_GraphicHardwareList(m_GraphicHardwareList.Count - 1) + m_SelHardware = Element + End If + Next + ' carico la lista dei Parametri + LoadNameComboBoxLua(Map.refHardwarePageVM.CurrHardware, ParamName) + End Sub + +End Class diff --git a/HardwareGeometry/GeomtryListConfigV.xaml b/HardwareGeometry/GeomtryListConfigV.xaml new file mode 100644 index 0000000..9f4802e --- /dev/null +++ b/HardwareGeometry/GeomtryListConfigV.xaml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -39,7 +62,6 @@ - @@ -149,6 +171,32 @@ + + + + + + + + + + + + + + + + diff --git a/HardwareManager/HardwarePageVM.vb b/HardwareManager/HardwarePageVM.vb index 300d6f5..dc5bef6 100644 --- a/HardwareManager/HardwarePageVM.vb +++ b/HardwareManager/HardwarePageVM.vb @@ -85,6 +85,8 @@ Public Class HardwarePageVM ' definizione comando Private m_EnterRefreshCmd As ICommand Private m_F1GuideCmd As ICommand + Private m_GeometryConfig As ICommand + Private m_ImportGeometryCmd As ICommand #Region "COMMANDS" @@ -119,6 +121,55 @@ Public Class HardwarePageVM Map.refProjectManagerVM.Guide() End Sub + ' GeometryConfig + Public ReadOnly Property GeometryConfigCmd As ICommand + Get + If m_GeometryConfig Is Nothing Then + m_GeometryConfig = New Command(AddressOf GeometryConfig) + End If + Return m_GeometryConfig + End Get + End Property + + Public Sub GeometryConfig(param As Object) + Dim NameParameter As String = CStr(param) + Dim ref_GeometryListConfigVM As New GeometryListConfigVM(NameParameter) + Dim GeometryConfigWnd As New GeometryListConfigV(Application.Current.MainWindow, ref_GeometryListConfigVM) + GeometryConfigWnd.ShowDialog() + ref_GeometryListConfigVM = Nothing + End Sub + + ' ImportGeometry + Public ReadOnly Property ImportGeometryCmd As ICommand + Get + If m_ImportGeometryCmd Is Nothing Then + m_ImportGeometryCmd = New Command(AddressOf ImportGeometry) + End If + Return m_ImportGeometryCmd + End Get + End Property + + Public Sub ImportGeometry() + Dim sFilePath As String = String.Empty + Dim FolderBrowserDialog As New Microsoft.Win32.OpenFileDialog + FolderBrowserDialog.Filter = "File (*.nge)|*.nge|All (*.*)|*.*" + If FolderBrowserDialog.ShowDialog() Then + sFilePath = FolderBrowserDialog.FileName + Dim CurrFolder As String = Path.GetDirectoryName(CurrHardware.CurrPath) + Dim DestFile As String = Path.Combine(CurrFolder, Path.GetFileNameWithoutExtension(CurrHardware.CurrPath) & "_" & Path.GetFileName(sFilePath)) + Try + File.Copy(sFilePath, DestFile, True) + Catch ex As System.IO.IOException + ' Error in copying: {0} + MessageBox.Show(String.Format(EgtMsg(50189), ex.Message)) + Return + End Try + CurrHardware.SetGeometryName(Path.GetFileName(DestFile)) + EnterRefresh() + End If + End Sub + + #End Region ' Command Public Function CreateDoor() As Boolean diff --git a/IniFile.vb b/IniFile.vb index 5e2a30b..8689a40 100644 --- a/IniFile.vb +++ b/IniFile.vb @@ -247,4 +247,17 @@ Friend Module IniFile Return True End Function + Public Function GetGeometryNameList(IpAppName As String, IpKeyName As String, ByRef GeometryName As String) As Boolean + Dim sVal As String = String.Empty + EgtUILib.GetPrivateProfileString(IpAppName, IpKeyName, "", sVal, m_sDoorsDirPath & "\MTables\GeometryNameList.ini") + If String.IsNullOrEmpty(sVal) Then Return False + Dim sItems() As String = sVal.Split(";"c) + GeometryName = sItems(0) + Return True + End Function + + Public Function SetGeometryNameList(IpAppName As String, IpKeyName As String, IpString As String) As Boolean + Return EgtUILib.WritePrivateProfileString(IpAppName, IpKeyName, IpString, m_sDoorsDirPath & "\MTables\GeometryNameList.ini") + End Function + End Module diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index f67e618..7fdcc47 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/NewHardware/NewHardwareVM.vb b/NewHardware/NewHardwareVM.vb index 2ef4f79..2c87427 100644 --- a/NewHardware/NewHardwareVM.vb +++ b/NewHardware/NewHardwareVM.vb @@ -129,7 +129,7 @@ Public Class NewHardwareVM Next NotifyPropertyChanged("BrandList") Dim SelItemindex As Integer = 0 - While Path.HasExtension(m_BrandList(SelItemindex)) And SelItemindex < m_BrandList.Count - 1 + While m_BrandList(SelItemindex) <> Map.refHardwarePageVM.CurrHardware.SelBrand.ModelDirGraphic And SelItemindex < m_BrandList.Count - 1 SelItemindex += 1 End While SelBrand = m_BrandList(SelItemindex) diff --git a/ProjectManager/ProjectManagerHardwareV.xaml b/ProjectManager/ProjectManagerHardwareV.xaml index ca1c4b0..c13cd22 100644 --- a/ProjectManager/ProjectManagerHardwareV.xaml +++ b/ProjectManager/ProjectManagerHardwareV.xaml @@ -4,6 +4,9 @@ + diff --git a/ProjectManager/ProjectManagerHardwareVM.vb b/ProjectManager/ProjectManagerHardwareVM.vb index 47c69ca..37032e5 100644 --- a/ProjectManager/ProjectManagerHardwareVM.vb +++ b/ProjectManager/ProjectManagerHardwareVM.vb @@ -37,6 +37,7 @@ Public Class ProjectManagerHardwareVM End Property ' Definizione comandi + Private m_cmdNewDir As ICommand Private m_cmdNew As ICommand Private m_cmdSave As ICommand Private m_cmdDelete As ICommand @@ -97,6 +98,12 @@ Public Class ProjectManagerHardwareVM Return EgtMsg(50308) End Get End Property + Public ReadOnly Property NewDirToolTip As String + Get + ' New Directory + Return EgtMsg(50419) + End Get + End Property #End Region ' ToolTip @@ -112,6 +119,47 @@ Public Class ProjectManagerHardwareVM #Region "COMMANDS" +#Region "NewDirCommand" + + Public ReadOnly Property NewDirCommand As ICommand + Get + If m_cmdNewDir Is Nothing Then + m_cmdNewDir = New Command(AddressOf NewDirCmd) + End If + Return m_cmdNewDir + End Get + End Property + + Public Sub NewDirCmd() + If Not IsNothing(Map.refHardwarePageVM) And Not IsNothing(Map.refHardwarePageVM.CurrHardware) Then + If Map.refHardwarePageVM.CurrHardware.SaveControl() = Hardware.SaveResult.nCancel Then + Return + ElseIf Map.refHardwarePageVM.CurrHardware.SaveControl() = Hardware.SaveResult.nYes Then + Map.refHardwarePageVM.CurrHardware.Save() + End If + ' Richiedo il nome del progetto (cioè la directory da creare) + Dim SaveFileDialog As New EgtWPFLib5.EgtSaveFileDialog + ' New Directory + SaveFileDialog.Title = EgtMsg(50419) + SaveFileDialog.Directory = Map.refHardwarePageVM.CurrHardware.HardwareGeneral.Path & "\" + SaveFileDialog.Extension = "\" + If Not SaveFileDialog.EgtShowDialog Then + Return + End If + If Directory.Exists(SaveFileDialog.FileName) Then + MessageBox.Show("Directory already exists", EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning) + Return + End If + Directory.CreateDirectory(SaveFileDialog.FileName) + Map.refHardwarePageVM.CurrHardware.BrandList.Add(New CompoBrandDir(SaveFileDialog.FileName, Path.GetFileName(Map.refHardwarePageVM.CurrHardware.HardwareGeneral.Path))) + Map.refHardwarePageVM.CurrHardware.SelBrand = Map.refHardwarePageVM.CurrHardware.BrandList(Map.refHardwarePageVM.CurrHardware.BrandList.Count - 1) + Map.refHardwarePageVM.CurrHardware.VisibilityType = Visibility.Collapsed + Map.refHardwarePageVM.CurrHardware.RefreshTemplateListEgtDOORCreator() + End If + End Sub + +#End Region ' NewDirCommand + #Region "NewCommand" Public ReadOnly Property NewCommand As ICommand @@ -345,12 +393,14 @@ Public Class ProjectManagerHardwareVM End If If Not IsNothing(Map.refHardwarePageVM.CurrHardware) Then Dim refNewHardwareV As New NewHardwareV + Dim OldHardwareName As String = Map.refHardwarePageVM.CurrHardware.SelTemplate Dim refNewhardwareVM As New NewHardwareVM(Map.refHardwarePageVM.CurrHardware.HardwareGeneral, NewHardwareVM.CommandList.nDuplicate) refNewHardwareV.DataContext = refNewhardwareVM refNewhardwareVM.TypeVisibility = Visibility.Collapsed refNewHardwareV.Owner = Application.Current.MainWindow refNewHardwareV.ShowDialog() refNewHardwareV.Close() + Map.refHardwarePageVM.CurrHardware.DuplicateGeometryName(OldHardwareName) End If End Sub diff --git a/ProjectManager/ProjectManagerVM.vb b/ProjectManager/ProjectManagerVM.vb index 4da9f26..038a578 100644 --- a/ProjectManager/ProjectManagerVM.vb +++ b/ProjectManager/ProjectManagerVM.vb @@ -780,6 +780,7 @@ Public Class ProjectManagerVM Map.refSceneManagerVM.RefreshBtn() ' carico la lista dei nomi delle geometrie CompoMatch.LoadTableGeometry() + Map.refHardwareHelpSceneHostV.CleanHelpProject() End Sub diff --git a/RegexFunction.vb b/RegexFunction.vb index 8b38221..0edc9ce 100644 --- a/RegexFunction.vb +++ b/RegexFunction.vb @@ -48,7 +48,7 @@ Module RegexFunction ' dato il direttorio restituisce il nome del file Friend Function SubStractDirFromPath(sLine As String, sLastDir As String) As String - Dim Model As String = Regex.Match(sLine, "\s* (" & sLastDir & ")\s*\/\s*(.*?\b)\s*$").Groups(2).Value + Dim Model As String = Regex.Match(sLine, "\s*(" & sLastDir & ")\s*\/\s*(.*?\b)\s*$").Groups(2).Value If Not String.IsNullOrEmpty(Model) Then Return Model Else diff --git a/Resources/TopCommandBar/Search.png b/Resources/TopCommandBar/Search.png new file mode 100644 index 0000000000000000000000000000000000000000..c625dd4f4d0759d5826a0654dc527f57e7623367 GIT binary patch literal 319 zcmeAS@N?(olHy`uVBq!ia0vp^svyk41|*NpQ(y*CjKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85o30K$!7fntTON@QSC4V@QPi+Zm30EebrYiH|m>Jm0%xhV>3{ z=dC_&u7A4qV*X4Q(5RWMZ*uH`x8}Rtnl1IBCaq4v8W@DpANTL~{)??X_xeNA*1Svq znp8Rrv$h=9R5d^US#jo8zZbKzIH#pvoH zGAqq5ag$YV-uk~o?qK4&v(c}X+5!RoeuOLgQu&X%Q~loCIFU8ePaLs literal 0 HcmV?d00001