diff --git a/Assembly/Assembly.vb b/Assembly/Assembly.vb index 8ca22a9..a4c643c 100644 --- a/Assembly/Assembly.vb +++ b/Assembly/Assembly.vb @@ -279,9 +279,10 @@ Public Class Assembly '--------------------------------------------------------------------------------------------------------------------------------------------- #Region "EdgeType" + Friend Shared m_FrameEdgeTypeList As New ObservableCollection(Of EdgeType) Public ReadOnly Property EdgeTypeList As ObservableCollection(Of EdgeType) Get - Return Part.m_EdgeTypeList + Return m_FrameEdgeTypeList End Get End Property @@ -880,7 +881,7 @@ Public Class Assembly End If Next - If IndexEdge = -1 Then + If IndexEdge = -1 And Bevel = "BU" Then Var = EdgeTypeList(0) bError = True MsgBevel(bError, Bevel) @@ -920,7 +921,7 @@ Public Class Assembly Private Sub MsgBevel(bFound As Boolean, Edge As String) If bFound And Not Part.FirstReadingEdge Then - Dim CautionBevel As String = String.Format(EgtMsg(50151), Edge) + Dim CautionBevel As String = String.Format("Bevel {0} can not be acceptable in Jamb", Edge) MessageBox.Show(CautionBevel, EgtMsg(50115), MessageBoxButton.OK, MessageBoxImage.Asterisk) Part.FirstReadingEdge = True End If @@ -1205,12 +1206,15 @@ Public Class Assembly If Not IsNothing(Map.refPartPageVM.CurrPart.Height) And Not IsNothing(Map.refPartPageVM.CurrPart.Width) And Not IsNothing(Map.refPartPageVM.CurrPart.Thickness) Then If StringToDouble(Map.refPartPageVM.CurrPart.Height, dHeight) Then EgtLuaSetGlobNumVar("H", dHeight) + EgtLuaSetGlobNumVar("H1", dHeight) End If If StringToDouble(Map.refPartPageVM.CurrPart.Width, dWidth) Then EgtLuaSetGlobNumVar("W", dWidth) + EgtLuaSetGlobNumVar("W1", dWidth) End If If StringToDouble(Map.refPartPageVM.CurrPart.Thickness, dThickness) Then EgtLuaSetGlobNumVar("T", dThickness) + EgtLuaSetGlobNumVar("T1", dThickness) End If End If ElseIf Map.refPartPageVM.CurrPart.TypePart.Contains("DO_2") Then diff --git a/AssemblyManager/AssemblyManagerVM.vb b/AssemblyManager/AssemblyManagerVM.vb index ea0120b..eab924b 100644 --- a/AssemblyManager/AssemblyManagerVM.vb +++ b/AssemblyManager/AssemblyManagerVM.vb @@ -215,19 +215,7 @@ Public Class AssemblyManagerVM Local_SelAssembly.SetDispositionItem(OptionModule.m_Disposition) ' riaggiorno la lista dei bevel con quello che è stato settato nel Confi.ini - If OptionModule.m_sDisposition.Contains("BU") Then - Part.m_DispositionList(0).IsActive = Visibility.Visible - OptionModule.m_bBevelUp = Visibility.Visible - Part.m_DispositionList(1).IsActive = Visibility.Collapsed - Part.m_DispositionList(2).IsActive = Visibility.Collapsed - OptionModule.m_bBevelDown = Visibility.Collapsed - ElseIf OptionModule.m_sDisposition.Contains("BD") Then - Part.m_DispositionList(0).IsActive = Visibility.Collapsed - OptionModule.m_bBevelUp = Visibility.Collapsed - Part.m_DispositionList(1).IsActive = Visibility.Visible - Part.m_DispositionList(2).IsActive = Visibility.Collapsed - OptionModule.m_bBevelDown = Visibility.Visible - End If + 'Part.RebuiltDispositionList() ' costruisco e carico le parti CreatePart(Local_SelAssembly) @@ -331,22 +319,8 @@ Public Class AssemblyManagerVM ref_Part.TopOverMaterial = OptionModule.m_TopOverMaterial ref_Part.BottomOverMaterial = OptionModule.m_BottomOverMaterial ref_Part.SetDispositionItem(OptionModule.m_Disposition) - ' riaggiorno la lista dei bevel con quello che è stato settato nel Confi.ini - If OptionModule.m_sDisposition.Contains("BU") Then - Part.m_DispositionList(0).IsActive = Visibility.Visible - OptionModule.m_bBevelUp = Visibility.Visible - Part.m_DispositionList(1).IsActive = Visibility.Collapsed - Part.m_DispositionList(2).IsActive = Visibility.Collapsed - OptionModule.m_bBevelDown = Visibility.Collapsed - ElseIf OptionModule.m_sDisposition.Contains("BD") Then - Part.m_DispositionList(0).IsActive = Visibility.Collapsed - OptionModule.m_bBevelUp = Visibility.Collapsed - Part.m_DispositionList(1).IsActive = Visibility.Visible - Part.m_DispositionList(2).IsActive = Visibility.Collapsed - OptionModule.m_bBevelDown = Visibility.Visible - End If - + 'Part.RebuiltDispositionList() End Sub #End Region ' Creazione e caricamento degli oggetti dell'assemblato diff --git a/CompoMatch.vb b/CompoMatch.vb index 9bef5a7..9fc90e6 100644 --- a/CompoMatch.vb +++ b/CompoMatch.vb @@ -83,11 +83,18 @@ Module CompoMatch EgtLuaSetGlobNumVar("STU.DeltaThickness", dDeltaT) Dim dThicknessDoor As Double If Not IsNothing(Map.refPartPageVM.CurrPart) Then + EgtLuaSetGlobStringVar("STU.SelDoor", Map.refPartPageVM.CurrPart.TypePart) StringToDouble(Map.refPartPageVM.CurrPart.Thickness, dThicknessDoor) ElseIf CurrAssembly.ArrayPartDoor.Count > 0 Then StringToDouble(CurrAssembly.GetArrayPartDoor(0).Door.Thickness, dThicknessDoor) End If EgtLuaSetGlobNumVar("STU.ThicknessDoor", dThicknessDoor) + Dim dDoor1Width As Double + StringToDouble(CurrAssembly.GetArrayPartDoor(0).Door.Width, dDoor1Width) + EgtLuaSetGlobNumVar("STU.Door1Width", dDoor1Width) + Dim dDoor2Width As Double + StringToDouble(CurrAssembly.GetArrayPartDoor(1).Door.Width, dDoor2Width) + EgtLuaSetGlobNumVar("STU.Door2Width", dDoor2Width) Return True End Function diff --git a/DdfFile.vb b/DdfFile.vb index 968e59f..6d57a3f 100644 --- a/DdfFile.vb +++ b/DdfFile.vb @@ -164,33 +164,38 @@ Friend Module DdfFile DdfFileContent.Add("") '---------------------------------------------------------------------------------------------------------------------------------------------------- ' aggiungo il secure nullo al DDF - DdfFileContent.Add("" & ConstCompo.S_SECURE & ": " & SetSecure(Part.Swing, Part.DispositionItem.Name)) - ' aggiungo una riga vuota per separare la lista successiva + If Part.TypePart.Contains("DO_") Then + DdfFileContent.Add("" & ConstCompo.S_SECURE & ": " & SetSecure(Part.Swing, Part.DispositionItem.Name, Part.Secure)) + ' aggiungo una riga vuota per separare la lista successiva + Else + DdfFileContent.Add("" & ConstCompo.S_SECURE & ": " & "DN") + End If + DdfFileContent.Add("") '---------------------------------------------------------------------------------------------------------------------------------------------------- DdfFileContent.Add("" & ConstCompo.S_PROFILES & ":") - DdfFileContent.Add(ConstCompo.DDF_SPACE3 & ConstCompo.K_LOCKEDGE & ": " & SetBevel(Part.LockEdgeType.Name, Part.DispositionItem.Name, Part.Swing)) + DdfFileContent.Add(ConstCompo.DDF_SPACE3 & ConstCompo.K_LOCKEDGE & ": " & SetBevel(Part.TypePart, Part.LockEdgeType.Name, Part.DispositionItem.Name, Part.Swing)) DdfFileContent.Add(ConstCompo.DDF_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Part.LockEdgeMachining)) If Not StringToDouble(Part.LockEdgeOverMaterial, dVal) Then MessageBox.Show(EgtMsg(50106) & K_LOCKEDGEOVERMATERIAL_INI, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) Return End If DdfFileContent.Add(ConstCompo.DDF_SPACE5 & ConstCompo.K_OVERMATERIAL & ": " & DoubleToString(dVal, 5)) - DdfFileContent.Add(ConstCompo.DDF_SPACE3 & ConstCompo.K_HINGEEDGE & ": " & SetBevel(Part.HingeEdgeType.Name, Part.DispositionItem.Name, Part.Swing)) + DdfFileContent.Add(ConstCompo.DDF_SPACE3 & ConstCompo.K_HINGEEDGE & ": " & SetBevel(Part.TypePart, Part.HingeEdgeType.Name, Part.DispositionItem.Name, Part.Swing)) DdfFileContent.Add(ConstCompo.DDF_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Part.HingeEdgeMachining)) If Not StringToDouble(Part.HingeEdgeOverMaterial, dVal) Then MessageBox.Show(EgtMsg(50106) & K_HINGEDGEOVERMATERIAL_INI, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) Return End If DdfFileContent.Add(ConstCompo.DDF_SPACE5 & ConstCompo.K_OVERMATERIAL & ": " & DoubleToString(dVal, 5)) - DdfFileContent.Add(ConstCompo.DDF_SPACE3 & ConstCompo.K_TOP & ": " & SetBevel(Part.TopType.Name, Part.DispositionItem.Name, Part.Swing)) + DdfFileContent.Add(ConstCompo.DDF_SPACE3 & ConstCompo.K_TOP & ": " & SetBevel(Part.TypePart, Part.TopType.Name, Part.DispositionItem.Name, Part.Swing)) DdfFileContent.Add(ConstCompo.DDF_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Part.TopMachining)) If Not StringToDouble(Part.TopOverMaterial, dVal) Then MessageBox.Show(EgtMsg(50106) & K_TOPOVERMATERIAL_INI, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) Return End If DdfFileContent.Add(ConstCompo.DDF_SPACE5 & ConstCompo.K_OVERMATERIAL & ": " & DoubleToString(dVal, 5)) - DdfFileContent.Add(ConstCompo.DDF_SPACE3 & ConstCompo.K_BOTTOM & ": " & SetBevel(Part.BottomType.Name, Part.DispositionItem.Name, Part.Swing)) + DdfFileContent.Add(ConstCompo.DDF_SPACE3 & ConstCompo.K_BOTTOM & ": " & SetBevel(Part.TypePart, Part.BottomType.Name, Part.DispositionItem.Name, Part.Swing)) DdfFileContent.Add(ConstCompo.DDF_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Part.BottomMachining)) If Not StringToDouble(Part.BottomOverMaterial, dVal) Then MessageBox.Show(EgtMsg(50106) & K_BOTTOMOVERMATERIAL_INI, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) @@ -507,7 +512,7 @@ Friend Module DdfFile End Function ' calcola il secure da salvare e il tipo di bevel - Public Function SetSecure(sSwing As String, DispositionItem As String) As String + Public Function SetSecure(sSwing As String, DispositionItem As String, DoorSecure As String) As String Dim sSecure As String If DispositionItem = "BU" Then If sSwing.Contains("HR") Then @@ -522,26 +527,38 @@ Friend Module DdfFile sSecure = "UP" End If Else - sSecure = "0" + If DoorSecure <> "0" Then + sSecure = DoorSecure + End If + sSecure = "DN" End If Return sSecure End Function ' calcola il bevel da stamapare nel ddf - Public Function SetBevel(sCurrBevel As String, DispositionItem As String, sSwing As String) As String - If sCurrBevel = "BV" And DispositionItem = "BD" Then - Return "BD" - ElseIf sCurrBevel = "BV" And DispositionItem = "BU" Then - Return "BU" - ElseIf sCurrBevel = "BV" And DispositionItem <> "BU" And DispositionItem <> "BD" Then - If sSwing.Contains("HR") Then + Public Function SetBevel(sTypePart As String, sCurrBevel As String, DispositionItem As String, sSwing As String) As String + If sTypePart.Contains("DO_") Then + If sCurrBevel = "BV" And DispositionItem = "BD" Then Return "BD" - Else + ElseIf sCurrBevel = "BV" And DispositionItem = "BU" Then Return "BU" + ElseIf sCurrBevel = "BV" And DispositionItem <> "BU" And DispositionItem <> "BD" Then + If sSwing.Contains("HR") Then + Return "BD" + Else + Return "BU" + End If + Else + Return sCurrBevel End If Else - Return sCurrBevel + If sCurrBevel = "BD" OrElse sCurrBevel = "BV" OrElse sCurrBevel = "BU" Then + Return "BD" + Else + Return sCurrBevel + End If End If + End Function #End Region ' Scrittura DDF @@ -576,19 +593,19 @@ Friend Module DdfFile FirstPart = True File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8) Case "2" - If Not CurrAssembly.GetArrayPartDoor(0).Door.Swing.Contains("I") Then - WriteDDFPart(CurrAssembly.GetArrayPartDoor(0).Door, sPath, bIsDDF, FirstPart) - FirstPart = True - File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8) - WriteDDFPart(CurrAssembly.GetArrayPartDoor(1).Door, sPath, bIsDDF, FirstPart) - File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8) - Else - WriteDDFPart(CurrAssembly.GetArrayPartDoor(1).Door, sPath, bIsDDF, FirstPart) - FirstPart = True - File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8) - WriteDDFPart(CurrAssembly.GetArrayPartDoor(0).Door, sPath, bIsDDF, FirstPart) - File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8) - End If + 'If Not CurrAssembly.GetArrayPartDoor(0).Door.Swing.Contains("I") Then + WriteDDFPart(CurrAssembly.GetArrayPartDoor(0).Door, sPath, bIsDDF, FirstPart) + FirstPart = True + File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8) + WriteDDFPart(CurrAssembly.GetArrayPartDoor(1).Door, sPath, bIsDDF, FirstPart) + File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8) + 'Else + ' WriteDDFPart(CurrAssembly.GetArrayPartDoor(1).Door, sPath, bIsDDF, FirstPart) + ' FirstPart = True + ' File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8) + ' WriteDDFPart(CurrAssembly.GetArrayPartDoor(0).Door, sPath, bIsDDF, FirstPart) + ' File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8) + 'End If End Select WriteDDFPart(CurrAssembly.LeftJamb, sPath, bIsDDF, FirstPart) File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8) diff --git a/DoorParameters/Compo.vb b/DoorParameters/Compo.vb index 7a69a6f..1fa4fa1 100644 --- a/DoorParameters/Compo.vb +++ b/DoorParameters/Compo.vb @@ -224,23 +224,24 @@ Public Class Compo Dim CurrCompoPath As String = FrameCompoFileConfig ' sostituisco il vecchio CompoType con quello corretto If File.Exists(CurrCompoPath) Then - 'GetPrivateProfileCompoName(ConstCompo.S_COMPO, ConstCompo.K_NAME, FrameCompoNameDDF, FrameCompoName, CurrCompoPath) - 'GetPrivateProfileJambSide(S_POSITIONSIDE, K_SIDE, Side, CurrCompoPath) - 'If String.IsNullOrEmpty(Side) Then - ' ' cerco nell'eleco dei parametri il parametro di nome side - ' For IndexCompoParam As Integer = 0 To Me.CompoParamList.Count - 1 - ' If Me.CompoParamList(IndexCompoParam).DDFName.ToLower = "side" AndAlso TypeOf Me.CompoParamList(IndexCompoParam) Is ComboBoxParam Then - ' Me.CompoType.SetJambSide(DirectCast(Me.CompoParamList(IndexCompoParam), ComboBoxParam).SelItem) - ' Exit For - ' End If - ' Next - 'End If + GetPrivateProfileCompoName(ConstCompo.S_COMPO, ConstCompo.K_NAME, FrameCompoNameDDF, FrameCompoName, CurrCompoPath) + GetPrivateProfileJambSide(S_POSITIONSIDE, K_SIDE, Side, Me.CompoType.Path & "\" & CONFIGINI_FILE_NAME) + If String.IsNullOrEmpty(Side) Then + ' controllo nell'elenco dei parametri se esiste un parametro di tipo Side + For IndexParam As Integer = 0 To Me.CompoParamList.Count - 1 + If Me.CompoParamList(IndexParam).DDFName.ToLower = "side" Then + Side = DirectCast(Me.CompoParamList(IndexParam), ComboBoxParam).SelItem + Exit For + End If + Next + End If '------------------------------------------------------------------------------------------------------------------------------- If IsNothing(Me.refJambCompo) Then Part.CreateRefCompo(Me.CompoType, Me, Map.refAssemblyPageVM.CurrAssembly, FrameCompoFileConfig, FrameCompoFile, Map.refPartPageVM.CurrPart) If CompoMatch.LoadCompoParam(Me, Map.refPartPageVM.CurrPart.TypePart) Then Map.refAssemblyPageVM.CurrAssembly.UpDateCurrCompoJamb(Me) For IndexParam As Integer = 0 To Me.refJambCompo.CompoParamList.Count - 1 If Me.refJambCompo.CompoParamList(IndexParam).DDFName.ToLower = "side" Then + ' assegno alla componente del frame la stessa posizione definita sull'anta DirectCast(Me.refJambCompo.CompoParamList(IndexParam), ComboBoxParam).SetSelItem(Me.CompoType.JambSide) Exit For End If diff --git a/DoorParameters/Part.vb b/DoorParameters/Part.vb index d69683d..827bfd9 100644 --- a/DoorParameters/Part.vb +++ b/DoorParameters/Part.vb @@ -162,6 +162,16 @@ Public Class Part End Set End Property + Private m_Secure As String + Public Property Secure As String + Get + Return m_Secure + End Get + Set(value As String) + m_Secure = value + End Set + End Property + #Region "Size" Private m_Height As String @@ -319,10 +329,15 @@ Public Class Part Friend Shared m_TopEdgeTypeList As New ObservableCollection(Of EdgeType) 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 + If m_TypePart.Contains("DO_") Then + Return m_EdgeTypeList + Else ' se stiamo leggendo un frame carico la lista dei bevel dei frame + Return Assembly.m_FrameEdgeTypeList + End If End Get Set(value As ObservableCollection(Of EdgeType)) m_EdgeTypeList = value @@ -334,17 +349,22 @@ Public Class Part Public ReadOnly Property TopEdgeTypeList As ObservableCollection(Of EdgeType) Get - Return m_TopEdgeTypeList + ' restituisco il valore della lista che è stato creato all'avvio + If m_TypePart.Contains("DO_") Then + Return m_TopEdgeTypeList + Else ' se stiamo leggendo un frame carico la lista dei bevel dei frame + Return Assembly.m_FrameEdgeTypeList + End If End Get End Property Private m_LockEdgeType As New EdgeType("", Visibility.Visible) Public Property LockEdgeType As EdgeType Get - If m_LockEdgeType.IsActive = Visibility.Collapsed Then - m_LockEdgeType = EdgeTypeList(0) - Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True - End If + 'If m_LockEdgeType.IsActive = Visibility.Collapsed Then + ' m_LockEdgeType = EdgeTypeList(0) + ' Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True + 'End If Return m_LockEdgeType End Get Set(value As EdgeType) @@ -361,10 +381,11 @@ Public Class Part Private m_HingeEdgeType As New EdgeType("", Visibility.Visible) Public Property HingeEdgeType As EdgeType Get - If m_HingeEdgeType.IsActive = Visibility.Collapsed Then - m_HingeEdgeType = EdgeTypeList(0) - Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True - End If + 'If m_HingeEdgeType.IsActive = Visibility.Collapsed Then + ' m_HingeEdgeType = EdgeTypeList(0) + ' Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True + 'End If + NotifyPropertyChanged("EdgeTypeList") Return m_HingeEdgeType End Get Set(value As EdgeType) @@ -381,10 +402,10 @@ Public Class Part Private m_TopType As New EdgeType("", Visibility.Visible) Public Property TopType As EdgeType Get - If m_TopType.IsActive = Visibility.Collapsed Then - m_TopType = EdgeTypeList(0) - Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True - End If + 'If m_TopType.IsActive = Visibility.Collapsed Then + ' m_TopType = EdgeTypeList(0) + ' Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True + 'End If Return m_TopType End Get Set(value As EdgeType) @@ -401,10 +422,10 @@ Public Class Part Private m_BottomType As New EdgeType("", Visibility.Visible) Public Property BottomType As EdgeType Get - If m_BottomType.IsActive = Visibility.Collapsed Then - m_BottomType = EdgeTypeList(0) - Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True - End If + 'If m_BottomType.IsActive = Visibility.Collapsed Then + ' m_BottomType = EdgeTypeList(0) + ' Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True + 'End If Return m_BottomType End Get Set(value As EdgeType) @@ -599,7 +620,7 @@ Public Class Part NewCompo.SetTemplateSelItem(NewCompo.TemplateItemList(SelItemindex)) End If End If - ' se non c'è il template + ' se non c'è il template Else ' nascondo il template NewCompo.TemplateVisibility = Visibility.Collapsed @@ -680,7 +701,7 @@ Public Class Part Dim CurrCompoPath As String = FrameCompoFileConfig If File.Exists(CurrCompoPath) Then GetPrivateProfileCompoName(ConstCompo.S_COMPO, ConstCompo.K_NAME, FrameCompoNameDDF, FrameCompoName, CurrCompoPath) - GetPrivateProfileJambSide(S_POSITIONSIDE, K_SIDE, Side, CurrCompoPath) + GetPrivateProfileJambSide(S_POSITIONSIDE, K_SIDE, Side, CurrCompoType.Path & "\" & CONFIGINI_FILE_NAME) If String.IsNullOrEmpty(Side) Then ' controllo nell'elenco dei parametri se esiste un parametro di tipo Side For IndexParam As Integer = 0 To NewCompo.CompoParamList.Count - 1 @@ -891,6 +912,7 @@ Public Class Part End Sub #Region "LETTURA DDF" + Private bModifyBevel As Boolean = False Private FileContent As String() ' Genero una nuova porta da usare nella lettura di un DDF Shared Sub ReadDDFPartDoor(ArrayFile() As String, ByRef LineIndex As Integer, ByRef ReadDoor As Part) @@ -915,93 +937,93 @@ Public Class Part ' Processo la sezione Dim sSection As String = GetName(sLine) Select Case sSection - Case S_PRODUCE - LineIndex = ReadDoor.GetProduce(LineIndex) - Case S_MEASURES - LineIndex = ReadDoor.GetMeasure(LineIndex) - Case S_CODE - LineIndex = ReadDoor.GetCode(LineIndex) - ' Se manca il codice, errore - If LineIndex = -1 Then - ' carico il messaggio di errore - sErrorInfo &= String.Format(EgtMsg(50102), S_CODE) & vbCrLf - ' assegno una porta vuota ed esco dal ciclo - ReadDoor = Nothing - ' interrompo la lettura del file - Exit While - End If - Case S_ORDER - LineIndex = ReadDoor.GetOrder(ReadDoor.NextIndex(LineIndex)) - ' Se mancano i dati dell'ordine, errore - If LineIndex = -1 Then - ' carico il messaggio di errore - sErrorInfo &= String.Format(EgtMsg(50102), S_ORDER) & vbCrLf - ' assegno una porta vuota ed esco dal ciclo - ReadDoor = Nothing - ' interrompo la lettura del file - Exit While - End If - Case S_DATE - LineIndex = ReadDoor.GetDate(LineIndex) - Case S_PIECE - LineIndex = ReadDoor.GetPiece(LineIndex) - Case S_POSITION - LineIndex = ReadDoor.GetPosition(ReadDoor.NextIndex(LineIndex)) - ' Se mancano i dati di posizione, errore - If LineIndex = -1 Then - ' carico il messaggio di errore - sErrorInfo &= String.Format(EgtMsg(50102), S_POSITION) & vbCrLf - ' assegno una porta vuota ed esco dal ciclo - ReadDoor = Nothing - ' interrompo la lettura del file - Exit While - End If - Case S_SIZE - LineIndex = ReadDoor.GetSize(ReadDoor.NextIndex(LineIndex)) - ' Se mancano i dati di size, errore - If LineIndex = -1 Then - ' carico il messaggio di errore - sErrorInfo &= String.Format(EgtMsg(50102), S_SIZE) & vbCrLf - ' assegno una porta vuota ed esco dal ciclo - ReadDoor = Nothing - ' interrompo la lettura del file - Exit While - End If - Case S_WEIGHT - LineIndex = ReadDoor.GetWeight(LineIndex) - Case S_SWING - LineIndex = ReadDoor.GetSwing(LineIndex) - If LineIndex = -1 Then - sErrorInfo &= String.Format(EgtMsg(50102), S_SWING) & vbCrLf - ' assegno una porta vuota ed esco dal ciclo - ReadDoor = Nothing - Exit While - End If - Case S_SECURE - LineIndex = ReadDoor.GetSecure(LineIndex) - Case S_PROFILES - LineIndex = ReadDoor.GetProfiles(ReadDoor.NextIndex(LineIndex), ReadDoor.TypePart) - If LineIndex = -1 Then - sErrorInfo &= String.Format(EgtMsg(50102), S_PROFILES) & vbCrLf - ' assegno una porta vuota ed esco dal ciclo - ReadDoor = Nothing - Exit While - End If - Case Else 'COMPONENTS - ' Se sezione senza nome o altro errore - If String.IsNullOrWhiteSpace(sSection) Then - sErrorInfo &= String.Format(EgtMsg(50130), LineIndex) & vbCrLf - ' assegno una porta vuota ed esco dal ciclo - ReadDoor = Nothing - Exit While - End If - ' Lettura del componente - LineIndex = ReadDoor.GetCompo(ReadDoor.NextIndex(LineIndex), sSection, sErrorInfo) - If LineIndex = -1 Then - ' assegno una porta vuota ed esco dal ciclo - ReadDoor = Nothing - Exit While - End If + Case S_PRODUCE + LineIndex = ReadDoor.GetProduce(LineIndex) + Case S_MEASURES + LineIndex = ReadDoor.GetMeasure(LineIndex) + Case S_CODE + LineIndex = ReadDoor.GetCode(LineIndex) + ' Se manca il codice, errore + If LineIndex = -1 Then + ' carico il messaggio di errore + sErrorInfo &= String.Format(EgtMsg(50102), S_CODE) & vbCrLf + ' assegno una porta vuota ed esco dal ciclo + ReadDoor = Nothing + ' interrompo la lettura del file + Exit While + End If + Case S_ORDER + LineIndex = ReadDoor.GetOrder(ReadDoor.NextIndex(LineIndex)) + ' Se mancano i dati dell'ordine, errore + If LineIndex = -1 Then + ' carico il messaggio di errore + sErrorInfo &= String.Format(EgtMsg(50102), S_ORDER) & vbCrLf + ' assegno una porta vuota ed esco dal ciclo + ReadDoor = Nothing + ' interrompo la lettura del file + Exit While + End If + Case S_DATE + LineIndex = ReadDoor.GetDate(LineIndex) + Case S_PIECE + LineIndex = ReadDoor.GetPiece(LineIndex) + Case S_POSITION + LineIndex = ReadDoor.GetPosition(ReadDoor.NextIndex(LineIndex)) + ' Se mancano i dati di posizione, errore + If LineIndex = -1 Then + ' carico il messaggio di errore + sErrorInfo &= String.Format(EgtMsg(50102), S_POSITION) & vbCrLf + ' assegno una porta vuota ed esco dal ciclo + ReadDoor = Nothing + ' interrompo la lettura del file + Exit While + End If + Case S_SIZE + LineIndex = ReadDoor.GetSize(ReadDoor.NextIndex(LineIndex)) + ' Se mancano i dati di size, errore + If LineIndex = -1 Then + ' carico il messaggio di errore + sErrorInfo &= String.Format(EgtMsg(50102), S_SIZE) & vbCrLf + ' assegno una porta vuota ed esco dal ciclo + ReadDoor = Nothing + ' interrompo la lettura del file + Exit While + End If + Case S_WEIGHT + LineIndex = ReadDoor.GetWeight(LineIndex) + Case S_SWING + LineIndex = ReadDoor.GetSwing(LineIndex) + If LineIndex = -1 Then + sErrorInfo &= String.Format(EgtMsg(50102), S_SWING) & vbCrLf + ' assegno una porta vuota ed esco dal ciclo + ReadDoor = Nothing + Exit While + End If + Case S_SECURE + LineIndex = ReadDoor.GetSecure(LineIndex) + Case S_PROFILES + LineIndex = ReadDoor.GetProfiles(ReadDoor.NextIndex(LineIndex), ReadDoor.TypePart) + If LineIndex = -1 Then + sErrorInfo &= String.Format(EgtMsg(50102), S_PROFILES) & vbCrLf + ' assegno una porta vuota ed esco dal ciclo + ReadDoor = Nothing + Exit While + End If + Case Else 'COMPONENTS + ' Se sezione senza nome o altro errore + If String.IsNullOrWhiteSpace(sSection) Then + sErrorInfo &= String.Format(EgtMsg(50130), LineIndex) & vbCrLf + ' assegno una porta vuota ed esco dal ciclo + ReadDoor = Nothing + Exit While + End If + ' Lettura del componente + LineIndex = ReadDoor.GetCompo(ReadDoor.NextIndex(LineIndex), sSection, sErrorInfo) + If LineIndex = -1 Then + ' assegno una porta vuota ed esco dal ciclo + ReadDoor = Nothing + Exit While + End If End Select End While @@ -1009,8 +1031,11 @@ Public Class Part If Not IsNothing(ReadDoor) Then Map.refPartPageVM.CurrPart = ReadDoor Map.refOptionsVM.RefreshEdgeTypeList() + ' Sarebbe buona norma inserire qui la stringa con i messaggi di errore e avvertimento (dopo aver caricato i bevel corretti) + If ReadDoor.bModifyBevel Then + MessageBox.Show("Door dispositiopn has been modify.", EgtMsg(50115), MessageBoxButton.OK, MessageBoxImage.Asterisk, MessageBoxResult.No) + End If End If - ' se la stringa dei messaggi contiene delle informazioni allora visualizzo If Not String.IsNullOrWhiteSpace(sErrorInfo) Then Dim sTitle As String = EgtMsg(50101) @@ -1210,7 +1235,7 @@ Public Class Part VisibilityWeight = Visibility.Visible End If End If - ' altrimenti la parola chiave esiste ma non è associato nessun valore + ' altrimenti la parola chiave esiste ma non è associato nessun valore Else If m_IsCheckedWeight = Visibility.Collapsed Then If MessageBox.Show(EgtMsg(50150), EgtMsg(50110), MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes) = MessageBoxResult.Yes Then @@ -1228,7 +1253,7 @@ Public Class Part m_Weight = OptionModule.m_Weight End If End If - ' altrimenti è assegnato il valore del peso + ' altrimenti è assegnato il valore del peso Else If m_IsCheckedWeight = Visibility.Collapsed Then If MessageBox.Show(EgtMsg(50150), EgtMsg(50110), MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes) = MessageBoxResult.Yes Then @@ -1267,20 +1292,21 @@ Public Class Part ' Leggo il posizionamento in macchina della porta Private Function GetSecure(Index As Integer) As Integer + Dim MessageBoxBevel As MessageBoxResult = MessageBoxResult.OK ' Riaggiorno la lista dei bevel con quello che è stato settato nel Config.ini - If OptionModule.m_sDisposition.Contains("BU") Then - Part.m_DispositionList(0).IsActive = Visibility.Visible - OptionModule.m_bBevelUp = Visibility.Visible - Part.m_DispositionList(1).IsActive = Visibility.Collapsed - Part.m_DispositionList(2).IsActive = Visibility.Collapsed - OptionModule.m_bBevelDown = Visibility.Collapsed - ElseIf OptionModule.m_sDisposition.Contains("BD") Then - Part.m_DispositionList(0).IsActive = Visibility.Collapsed - OptionModule.m_bBevelUp = Visibility.Collapsed - Part.m_DispositionList(1).IsActive = Visibility.Visible - Part.m_DispositionList(2).IsActive = Visibility.Collapsed - OptionModule.m_bBevelDown = Visibility.Visible - End If + 'If OptionModule.m_sDisposition.Contains("BU") Then + ' Part.m_DispositionList(0).IsActive = Visibility.Visible + ' OptionModule.m_bBevelUp = Visibility.Visible + ' Part.m_DispositionList(1).IsActive = Visibility.Collapsed + ' Part.m_DispositionList(2).IsActive = Visibility.Collapsed + ' OptionModule.m_bBevelDown = Visibility.Collapsed + 'ElseIf OptionModule.m_sDisposition.Contains("BD") Then + ' Part.m_DispositionList(0).IsActive = Visibility.Collapsed + ' OptionModule.m_bBevelUp = Visibility.Collapsed + ' Part.m_DispositionList(1).IsActive = Visibility.Visible + ' Part.m_DispositionList(2).IsActive = Visibility.Collapsed + ' OptionModule.m_bBevelDown = Visibility.Visible + 'End If ' creo l'oggetto OptionsVM per la prima volta se non esiste If IsNothing(Map.refOptionsVM) Then Dim OptionsPage As OptionsVM = Map.refMainWindowVM.OptionPage @@ -1295,120 +1321,259 @@ Public Class Part Else ' carico il valore nella porta corrente m_Secure = sSecure - If sSecure = "UP" And m_Swing.Contains("HR") Then - ' devo controllare che nella optionpage sia selezionato il tipo di spigolo - If m_DispositionList(0).IsActive = Visibility.Visible Then - SetDispositionItem(m_DispositionList(0)) - Else - If MessageBox.Show("Disposition BU is not setted in OptionPage, do you want to set?", EgtMsg(50115), MessageBoxButton.YesNo, MessageBoxImage.Asterisk, MessageBoxResult.No) = MessageBoxResult.Yes Then - ' seleziono l'elemento dall'elenco - SetDispositionItem(m_DispositionList(0)) - ' modifico la visibilità dei bevel - OptionModule.m_bBevelUp = Visibility.Visible - ' in modalita Disposition=BD/BU solo un bevel alla volta può essere acceso, a differenza di quanto accade nell'altra modalità (secure 0) - If OptionModule.m_Disposition.Name = "BD" Then - OptionModule.m_bBevelDown = Visibility.Collapsed - Else - ' salvo nel Default.ini la modifica della visibilità - DefaultWritePrivateProfileString(S_EDGE, K_BEVELU_INI, "1") - End If - Else - Part.FirstReadingEdge = True - SetDispositionItem(OptionModule.m_Disposition) - End If - End If - ElseIf sSecure = "UP" And Not m_Swing.Contains("HR") Then - If m_DispositionList(1).IsActive = Visibility.Visible Then - SetDispositionItem(m_DispositionList(1)) - Else - If MessageBox.Show("Disposition BD is not setted in OptionPage, do you want to set?", EgtMsg(50115), MessageBoxButton.YesNo, MessageBoxImage.Asterisk, MessageBoxResult.No) = MessageBoxResult.Yes Then - SetDispositionItem(m_DispositionList(1)) - OptionModule.m_bBevelDown = Visibility.Visible - If OptionModule.m_Disposition.Name = "BU" Then - OptionModule.m_bBevelUp = Visibility.Collapsed - Else - ' salvo nel Default.ini la modifica della visibilità - DefaultWritePrivateProfileString(S_EDGE, K_BEVELD_INI, "1") - End If - Else - SetDispositionItem(OptionModule.m_Disposition) - Part.FirstReadingEdge = True - End If - End If - ElseIf sSecure = "DN" And m_Swing.Contains("HR") Then - If m_DispositionList(1).IsActive = Visibility.Visible Then - SetDispositionItem(m_DispositionList(1)) - Else - If MessageBox.Show("Disposition BD is not setted in OptionPage, do you want to set?", EgtMsg(50115), MessageBoxButton.YesNo, MessageBoxImage.Asterisk, MessageBoxResult.No) = MessageBoxResult.Yes Then - SetDispositionItem(m_DispositionList(1)) - OptionModule.m_bBevelDown = Visibility.Visible - If OptionModule.m_Disposition.Name = "BU" Then - OptionModule.m_bBevelUp = Visibility.Collapsed - Else - ' salvo nel Default.ini la modifica della visibilità - DefaultWritePrivateProfileString(S_EDGE, K_BEVELD_INI, "1") - End If - Else - SetDispositionItem(m_DispositionList(0)) - ' sto modificando il bevel corrente della porta in lettura - Part.FirstReadingEdge = True - End If - End If - ElseIf sSecure = "DN" And Not m_Swing.Contains("HR") Then - If m_DispositionList(0).IsActive = Visibility.Visible Then - SetDispositionItem(m_DispositionList(0)) - Else - If MessageBox.Show("Disposition BU is not setted in OptionPage, do you want to set?", EgtMsg(50115), MessageBoxButton.YesNo, MessageBoxImage.Asterisk, MessageBoxResult.No) = MessageBoxResult.Yes Then - SetDispositionItem(m_DispositionList(0)) - OptionModule.m_bBevelUp = Visibility.Visible - If OptionModule.m_Disposition.Name = "BD" Then - OptionModule.m_bBevelDown = Visibility.Collapsed - Else - ' salvo nel Default.ini la modifica della visibilità - DefaultWritePrivateProfileString(S_EDGE, K_BEVELU_INI, "1") - End If - Else - Part.FirstReadingEdge = True - SetDispositionItem(OptionModule.m_Disposition) - End If - End If - ElseIf sSecure = "0" Then - If OptionModule.m_Disposition.Name = "BD" Then - If m_Swing.Contains("HR") Then - SetDispositionItem(m_DispositionList(1)) - Else - If MessageBox.Show("Disposition BU is not setted in OptionPage, do you want to set?", EgtMsg(50115), MessageBoxButton.YesNo, MessageBoxImage.Asterisk, MessageBoxResult.No) = MessageBoxResult.Yes Then - SetDispositionItem(m_DispositionList(0)) - OptionModule.m_bBevelUp = Visibility.Visible - OptionModule.m_bBevelDown = Visibility.Collapsed - Else - SetDispositionItem(OptionModule.m_Disposition) - Part.FirstReadingEdge = True - End If - End If - ElseIf OptionModule.m_Disposition.Name = "BU" Then - If m_Swing.Contains("HR") Then - SetDispositionItem(m_DispositionList(0)) - Else - If MessageBox.Show("Disposition BD is not setted in OptionPage, do you want to set?", EgtMsg(50115), MessageBoxButton.YesNo, MessageBoxImage.Asterisk, MessageBoxResult.No) = MessageBoxResult.Yes Then - SetDispositionItem(m_DispositionList(1)) - OptionModule.m_bBevelDown = Visibility.Visible - OptionModule.m_bBevelUp = Visibility.Collapsed - Else - SetDispositionItem(OptionModule.m_Disposition) - Part.FirstReadingEdge = True - End If - End If - Else - 'se non è selezionato nessun tipo di disposizione allora procede senza fare conti - SetDispositionItem(Part.m_DispositionList(2)) - End If - End If + '------------------------------------------------------------------------------------------------------------------------------------------------------------- + 'If sSecure = "UP" And m_Swing.Contains("HR") Then + ' ' devo controllare che nella optionpage sia selezionato il tipo di spigolo + ' If m_DispositionList(0).IsActive = Visibility.Visible Then + ' SetDispositionItem(m_DispositionList(0)) + ' Else + ' If OptionModule.m_sDisposition <> "BySwing" Then + ' MessageBoxBevel = MessageBox.Show("Door dispositiopn has been modify.", EgtMsg(50115), MessageBoxButton.OK, MessageBoxImage.Asterisk, MessageBoxResult.No) + ' Else + ' ' sono nella configurazione BySwing, quindi ativo i bel senza chiedere conferma? + ' MessageBoxBevel = MessageBoxResult.Yes + ' End If + ' If Not MessageBoxBevel = MessageBoxResult.OK Then + ' ' seleziono l'elemento dall'elenco + ' SetDispositionItem(m_DispositionList(0)) + ' ' modifico la visibilità dei bevel + ' OptionModule.m_bBevelUp = Visibility.Visible + ' ' in modalita Disposition=BD/BU solo un bevel alla volta può essere acceso, a differenza di quanto accade nell'altra modalità (secure 0) + ' If OptionModule.m_Disposition.Name = "BD" Then + ' OptionModule.m_bBevelDown = Visibility.Collapsed + ' Else + ' ' salvo nel Default.ini la modifica della visibilità + ' DefaultWritePrivateProfileString(S_EDGE, K_BEVELU_INI, "1") + ' End If + ' Else + ' Part.FirstReadingEdge = True + ' SetDispositionItem(OptionModule.m_Disposition) + ' End If + ' End If + 'ElseIf sSecure = "UP" And Not m_Swing.Contains("HR") Then + ' If m_DispositionList(1).IsActive = Visibility.Visible Then + ' SetDispositionItem(m_DispositionList(1)) + ' Else + ' If OptionModule.m_sDisposition <> "BySwing" Then + ' MessageBoxBevel = MessageBox.Show("Door dispositiopn has been modify.", EgtMsg(50115), MessageBoxButton.OK, MessageBoxImage.Asterisk, MessageBoxResult.No) + ' Else + ' MessageBoxBevel = MessageBoxResult.Yes + ' End If + ' If Not MessageBoxBevel = MessageBoxResult.OK Then + ' SetDispositionItem(m_DispositionList(1)) + ' OptionModule.m_bBevelDown = Visibility.Visible + ' If OptionModule.m_Disposition.Name = "BU" Then + ' OptionModule.m_bBevelUp = Visibility.Collapsed + ' Else + ' ' salvo nel Default.ini la modifica della visibilità + ' DefaultWritePrivateProfileString(S_EDGE, K_BEVELD_INI, "1") + ' End If + ' Else + ' SetDispositionItem(OptionModule.m_Disposition) + ' Part.FirstReadingEdge = True + ' End If + ' End If + 'ElseIf sSecure = "DN" And m_Swing.Contains("HR") Then + ' If m_DispositionList(1).IsActive = Visibility.Visible Then + ' SetDispositionItem(m_DispositionList(1)) + ' Else + ' If OptionModule.m_sDisposition <> "BySwing" Then + ' MessageBoxBevel = MessageBox.Show("Door dispositiopn has been modify.", EgtMsg(50115), MessageBoxButton.OK, MessageBoxImage.Asterisk, MessageBoxResult.No) + ' Else + ' MessageBoxBevel = MessageBoxResult.Yes + ' End If + ' If Not MessageBoxBevel = MessageBoxResult.OK Then + ' SetDispositionItem(m_DispositionList(1)) + ' OptionModule.m_bBevelDown = Visibility.Visible + ' If OptionModule.m_Disposition.Name = "BU" Then + ' OptionModule.m_bBevelUp = Visibility.Collapsed + ' Else + ' ' salvo nel Default.ini la modifica della visibilità + ' DefaultWritePrivateProfileString(S_EDGE, K_BEVELD_INI, "1") + ' End If + ' Else + ' SetDispositionItem(m_DispositionList(0)) + ' ' sto modificando il bevel corrente della porta in lettura + ' Part.FirstReadingEdge = True + ' End If + ' End If + 'ElseIf sSecure = "DN" And Not m_Swing.Contains("HR") Then + ' If m_DispositionList(0).IsActive = Visibility.Visible Then + ' SetDispositionItem(m_DispositionList(0)) + ' Else + ' If OptionModule.m_sDisposition <> "BySwing" Then + ' ' se nella configurazione è selezionato un bevel allora modifico la porta in lettura + ' ' nel caso di click "X" il + ' MessageBoxBevel = MessageBox.Show("Door dispositiopn has been modify.", EgtMsg(50115), MessageBoxButton.OK, MessageBoxImage.Asterisk, MessageBoxResult.No) + ' Else + ' MessageBoxBevel = MessageBoxResult.Yes + ' End If + ' If Not MessageBoxBevel = MessageBoxResult.OK Then + ' SetDispositionItem(m_DispositionList(0)) + ' OptionModule.m_bBevelUp = Visibility.Visible + ' If OptionModule.m_Disposition.Name = "BD" Then + ' OptionModule.m_bBevelDown = Visibility.Collapsed + ' Else + ' ' salvo nel Default.ini la modifica della visibilità + ' DefaultWritePrivateProfileString(S_EDGE, K_BEVELU_INI, "1") + ' End If + ' Else + ' Part.FirstReadingEdge = True + ' SetDispositionItem(OptionModule.m_Disposition) + ' End If + ' End If + ' ' se è secure zero devo aspettare di leggere i bevel dei profili + 'ElseIf sSecure = "0" Then + ' metto in pausa tutto fino alla lettura + 'If OptionModule.m_sDisposition = "BD" Then + ' If m_Swing.Contains("HR") Then + ' SetDispositionItem(m_DispositionList(1)) + ' Else + ' ' se sono nella configurazione by swing non comunico nulla e aggiungo il bevel mancnate + ' If OptionModule.m_sDisposition <> "0" Then + ' MessageBoxBevel = MessageBox.Show("Door dispositiopn has been modify.", EgtMsg(50115), MessageBoxButton.OK, MessageBoxImage.Asterisk, MessageBoxResult.No) + ' End If + ' If Not MessageBoxBevel = MessageBoxResult.OK Then + ' SetDispositionItem(m_DispositionList(0)) + ' OptionModule.m_bBevelUp = Visibility.Visible + ' OptionModule.m_bBevelDown = Visibility.Collapsed + ' Else + ' SetDispositionItem(OptionModule.m_Disposition) + ' Part.FirstReadingEdge = True + ' End If + ' End If + 'ElseIf OptionModule.m_sDisposition = "BU" Then + ' If Not m_Swing.Contains("HR") Then + ' SetDispositionItem(m_DispositionList(0)) + ' Else + ' If OptionModule.m_sDisposition <> "0" Then + ' MessageBoxBevel = MessageBox.Show("Door dispositiopn has been modify.", EgtMsg(50115), MessageBoxButton.OK, MessageBoxImage.Asterisk, MessageBoxResult.No) + ' End If + ' If Not MessageBoxBevel = MessageBoxResult.OK Then + ' SetDispositionItem(m_DispositionList(1)) + ' OptionModule.m_bBevelDown = Visibility.Visible + ' OptionModule.m_bBevelUp = Visibility.Collapsed + ' Else + ' SetDispositionItem(OptionModule.m_Disposition) + ' Part.FirstReadingEdge = True + ' End If + ' End If + 'Else + ' ' se non è selezionato nessun tipo di disposizione allora procede senza fare conti + ' SetDispositionItem(Part.m_DispositionList(2)) + 'End If + 'End If End If - ' passo alla riga successiva + '' passo alla riga successiva Return NextIndex(Index) End Function + ' calcola la congruenza del posizionamento e del secure + Private Sub CalcBevelFromSecure() + ' se sono nella configurazione assemblato e sto leggendo un frame + If OptionModule.m_ConfigurationSoftware = ConfigType.Assembly AndAlso Not IsNothing(Map.refAssemblyPageVM.CurrAssembly) AndAlso Not m_TypePart.Contains("DO_") Then + ' assegno i profili bevel caricati nella pagina AssemblyPage + Try + SetLockEdgeType(Map.refAssemblyPageVM.CurrAssembly.EdgeTypeList.First(Function(x) x.Name = Map.refAssemblyPageVM.CurrAssembly.LockEdgeType.Name)) + Catch ex As Exception + End Try + Try + SetHingeEdgeType(Map.refAssemblyPageVM.CurrAssembly.EdgeTypeList.First(Function(x) x.Name = Map.refAssemblyPageVM.CurrAssembly.HingeEdgeType.Name)) + Catch ex As Exception + End Try + Try + SetTopType(Map.refAssemblyPageVM.CurrAssembly.EdgeTypeList.First(Function(x) x.Name = Map.refAssemblyPageVM.CurrAssembly.TopType.Name)) + Catch ex As Exception + End Try + Try + SetBottomType(Map.refAssemblyPageVM.CurrAssembly.EdgeTypeList.First(Function(x) x.Name = Map.refAssemblyPageVM.CurrAssembly.BottomType.Name)) + Catch ex As Exception + End Try + ' la disposizione è sempre BD, non modificabile, quindi mostro a video BySwing + Try + SetDispositionItem(DispositionList.First(Function(x) x.Name = "BySwing")) + Catch ex As Exception + End Try + Else ' se è un'anta (in qualsisi tipo di configurazione) + ' controllo se almeno uno dei bevel della porta ha BV + Dim Bevel As String = String.Empty + Dim sBevelLock As String = String.Empty + Dim sBevelHinge As String = String.Empty + Dim sBevelTop As String = String.Empty + Dim sBevelBottom As String = String.Empty + ' se almeno un profilo è di tipo bevel + If m_LockEdgeType.Name = "BV" OrElse m_LockEdgeType.Name = "BU" OrElse m_LockEdgeType.Name = "BD" Then sBevelLock = m_LockEdgeType.BevelDDF + If m_HingeEdgeType.Name = "BV" OrElse m_HingeEdgeType.Name = "BU" OrElse m_HingeEdgeType.Name = "BD" Then sBevelHinge = m_HingeEdgeType.BevelDDF + If m_TopType.Name = "BV" OrElse m_TopType.Name = "BU" OrElse m_TopType.Name = "BD" Then sBevelTop = m_TopType.BevelDDF + If m_BottomType.Name = "BV" OrElse m_BottomType.Name = "BU" OrElse m_BottomType.Name = "BD" Then sBevelBottom = m_BottomType.BevelDDF + ' controllo che i bevel siano tutti uguali nello stesso Part + Bevel = ControlBevel(sBevelLock, sBevelHinge, sBevelTop, sBevelBottom) + ' nel caso di nessuna disposizione fissata da Config.ini + Select Case OptionModule.m_sDisposition + Case "BD" + SetDispositionItem(m_DispositionList(1)) + ' modifico il bevel da BU a BD + Modifybevel(Bevel, "BU") + ' la visibilità serve ad aggiornre la lista dei bevel nel caso siamo in presenza della vecchia configurazione + OptionModule.m_bBevelDown = Visibility.Visible + OptionModule.m_bBevelUp = Visibility.Collapsed + EdgeTypeCpntrol(m_LockEdgeType) + EdgeTypeCpntrol(m_HingeEdgeType) + EdgeTypeCpntrol(m_TopType) + EdgeTypeCpntrol(m_BottomType) + Case "BU" + SetDispositionItem(m_DispositionList(0)) + Modifybevel(Bevel, "BD") + ' la visibilità serve ad aggiornre la lista dei bevel nel caso siamo in presenza della vecchia configurazione + OptionModule.m_bBevelUp = Visibility.Visible + OptionModule.m_bBevelDown = Visibility.Collapsed + ' nel caso che sia stata aperta una vecchia configurazione (BU e BD presenti nell'elenco dei bevel) + EdgeTypeCpntrol(m_LockEdgeType) + EdgeTypeCpntrol(m_HingeEdgeType) + EdgeTypeCpntrol(m_TopType) + EdgeTypeCpntrol(m_BottomType) + Case Else ' BySwing + If Not String.IsNullOrEmpty(Bevel) Then + Try + ' seleziono il bevel letto nella lista delle disposizioni possibili (esiste un solo tipo di bevel per tutta la porta) + SetDispositionItem(m_DispositionList.First(Function(x) x.Name = Bevel)) + If Bevel = "BU" Then OptionModule.m_bBevelUp = Visibility.Visible + If Bevel = "BD" Then OptionModule.m_bBevelDown = Visibility.Visible + ' questo caso il secure segue le solite regole di calcolo + Catch ex As Exception + End Try + Else ' Bevel SQ + If m_Swing.Contains("HR") Then + If m_Secure = "UP" Then + SetDispositionItem(m_DispositionList(0)) + OptionModule.m_bBevelUp = Visibility.Visible + ElseIf m_Secure = "DN" Then + SetDispositionItem(m_DispositionList(1)) + OptionModule.m_bBevelDown = Visibility.Visible + Else + m_Secure = "DN" + SetDispositionItem(m_DispositionList(1)) + OptionModule.m_bBevelDown = Visibility.Visible + End If + Else + If m_Secure = "UP" Then + SetDispositionItem(m_DispositionList(1)) + OptionModule.m_bBevelDown = Visibility.Visible + ElseIf m_Secure = "DN" Then + SetDispositionItem(m_DispositionList(0)) + OptionModule.m_bBevelUp = Visibility.Visible + Else + m_Secure = "UP" + SetDispositionItem(m_DispositionList(0)) + OptionModule.m_bBevelUp = Visibility.Visible + End If + End If + 'm_Secure = "DN" + End If + End Select + End If + End Sub + ' Leggo i dati dei profili Private Function GetProfiles(Index As Integer, TypePart As String) As Integer Dim bError As Boolean = False @@ -1422,20 +1587,24 @@ Public Class Part If Not SearchKey(sLine, K_LOCKEDGE) Then Return -1 Else ' se valore nella lista - If EdgeTypeControl(LockEdgeType) Then - Try - m_LockEdgeType = EdgeTypeList.First(Function(x) x.Name = LockEdgeType) - Catch ex As Exception - If Trim(LockEdgeType) = "BU" Or Trim(LockEdgeType) = "BD" Then - Try - m_LockEdgeType = EdgeTypeList.First(Function(x) x.Name = "BV") - Catch ex2 As Exception - End Try - End If - End Try - Else - bError = True - End If + 'If EdgeTypeControl(LockEdgeType) Then + Try + m_LockEdgeType = EdgeTypeList.First(Function(x) x.Name = LockEdgeType) + ' segno il bevel che è stato letto nel ddf per il calcolo del secure + m_LockEdgeType.BevelDDF = LockEdgeType + Catch ex As Exception + If Trim(LockEdgeType) = "BU" Or Trim(LockEdgeType) = "BD" Then + Try + m_LockEdgeType = EdgeTypeList.First(Function(x) x.Name = "BV") + ' segno il bevel che è stato letto nel ddf per il calcolo del secure + m_LockEdgeType.BevelDDF = LockEdgeType + Catch ex2 As Exception + End Try + End If + End Try + ' Else + ' bError = True + 'End If End If Index = NextIndex(Index) If Index > FileContent.Count() - 1 Then Return -1 @@ -1466,20 +1635,22 @@ Public Class Part If Not SearchKey(sLine, K_HINGEEDGE) Then Return -1 Else ' se valore nella lista - If EdgeTypeControl(HingeEdgeType) Then - Try - m_HingeEdgeType = EdgeTypeList.First(Function(x) x.Name = HingeEdgeType) - Catch ex As Exception - If Trim(HingeEdgeType) = "BU" Or Trim(HingeEdgeType) = "BD" Then - Try - m_HingeEdgeType = EdgeTypeList.First(Function(x) x.Name = "BV") - Catch ex2 As Exception - End Try - End If - End Try - Else - bError = True - End If + 'If EdgeTypeControl(HingeEdgeType) Then + Try + m_HingeEdgeType = EdgeTypeList.First(Function(x) x.Name = HingeEdgeType) + m_HingeEdgeType.BevelDDF = HingeEdgeType + Catch ex As Exception + If Trim(HingeEdgeType) = "BU" Or Trim(HingeEdgeType) = "BD" Then + Try + m_HingeEdgeType = EdgeTypeList.First(Function(x) x.Name = "BV") + m_HingeEdgeType.BevelDDF = HingeEdgeType + Catch ex2 As Exception + End Try + End If + End Try + ' Else + ' bError = True + 'End If End If Index = NextIndex(Index) If Index > FileContent.Count() - 1 Then Return -1 @@ -1509,20 +1680,22 @@ Public Class Part If Not SearchKey(sLine, K_TOP) Then Return -1 Else ' se valore nella lista - If EdgeTypeControl(TopType) Then - Try - m_TopType = EdgeTypeList.First(Function(x) x.Name = TopType) - Catch ex As Exception - If Trim(TopType) = "BU" Or Trim(TopType) = "BD" Then - Try - m_TopType = EdgeTypeList.First(Function(x) x.Name = "BV") - Catch ex2 As Exception - End Try - End If - End Try - Else - bError = True - End If + 'If EdgeTypeControl(TopType) Then + Try + m_TopType = TopEdgeTypeList.First(Function(x) x.Name = TopType) + m_TopType.BevelDDF = TopType + Catch ex As Exception + If Trim(TopType) = "BU" Or Trim(TopType) = "BD" Then + Try + m_TopType = TopEdgeTypeList.First(Function(x) x.Name = "BV") + m_TopType.BevelDDF = TopType + Catch ex2 As Exception + End Try + End If + End Try + ' Else + ' bError = True + 'End If End If Index = NextIndex(Index) If Index > FileContent.Count() - 1 Then Return -1 @@ -1552,20 +1725,23 @@ Public Class Part If Not SearchKey(sLine, K_BOTTOM) Then Return -1 Else ' se valore nella lista - If EdgeTypeControl(BottomType) Then - Try - m_BottomType = EdgeTypeList.First(Function(x) x.Name = BottomType) - Catch ex As Exception - If Trim(BottomType) = "BU" Or Trim(BottomType) = "BD" Then - Try - m_BottomType = EdgeTypeList.First(Function(x) x.Name = "BV") - Catch ex2 As Exception - End Try - End If - End Try - Else - bError = True - End If + 'If EdgeTypeControl(BottomType) Then + Try + m_BottomType = TopEdgeTypeList.First(Function(x) x.Name = BottomType) + m_BottomType.BevelDDF = BottomType + Catch ex As Exception + If Trim(BottomType) = "BU" Or Trim(BottomType) = "BD" Then + Try + m_BottomType = TopEdgeTypeList.First(Function(x) x.Name = "BV") + ' in questo punto avviene la conversione del profilo Lock, non so il perchè + m_BottomType.BevelDDF = BottomType + Catch ex2 As Exception + End Try + End If + End Try + ' Else + ' bError = True + 'End If End If Index = NextIndex(Index) If Index > FileContent.Count() - 1 Then Return -1 @@ -1585,29 +1761,10 @@ Public Class Part Else m_BottomOverMaterial = BottomOverMaterial End If + CalcBevelFromSecure() Return NextIndex(Index) End Function - ' Controllo che i valori passati come spigoli siano presenti nella lista corrente (lettura DDF) - Public Function EdgeTypeControl(Edge As String) As Boolean - Dim bFound As Boolean = False - For Index = 0 To EdgeTypeList.Count - 1 - If Part.m_EdgeTypeList(Index).Name = Edge And Part.m_EdgeTypeList(Index).IsActive = Visibility.Collapsed Then - bFound = True - End If - Next - If bFound Then - If Not FirstReadingEdge Then - Dim CautionBevel As String = String.Format(EgtMsg(50151), Edge) - MessageBox.Show(CautionBevel, EgtMsg(50115), MessageBoxButton.OK, MessageBoxImage.Asterisk) - FirstReadingEdge = True - End If - Return False - Else - Return True - End If - End Function - ' Leggo i dati del componente Private Function GetCompo(Index As Integer, CompoNameDDF As String, ByRef sErrorInfo As String) As Integer ' Controllo esistenza del componente @@ -1681,7 +1838,7 @@ Public Class Part Index = NextIndex(Index) ' leggo i parametri del componente ReadParams(m_CurrCompo, sErrorInfo, Index) - ' altrimenti non c'è il trattino nel file DDF + ' altrimenti non c'è il trattino nel file DDF Else sErrorInfo &= String.Format(EgtMsg(50132), DDFName, Index + 1) sErrorInfo &= String.Format("-->" & EgtMsg(50133), CompoNameDDF) & vbCrLf @@ -1691,7 +1848,7 @@ Public Class Part ' continuo nel ciclo while Continue While End If - ' il componente non ha template (louver_cut_outs) + ' il componente non ha template (louver_cut_outs) Else ' nascondo il template m_CurrCompo.TemplateVisibility = Visibility.Collapsed @@ -1770,8 +1927,14 @@ Public Class Part If Search3Hyphens(sLine) OrElse Search3Dots(sLine) OrElse Not String.IsNullOrWhiteSpace(GetName(sLine)) OrElse sLine.Trim().StartsWith(DDF_METADATA) Then - sErrorInfo &= String.Format(EgtMsg(50139), IndexLine + 1, Trim(CompoTemplateItem.CompoParamList(IndexParam).DDFName)) - sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50140)) & vbCrLf + If Not TypeOf CurrCompoParam Is TextBoxOnOffParam Then + ' restituisco il messaggio che manca un parametro + sErrorInfo &= String.Format(EgtMsg(50139), IndexLine + 1, Trim(CompoTemplateItem.CompoParamList(IndexParam).DDFName)) + sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50140)) & vbCrLf + Else + ' significa che la TextBoxOnOff è stata disattivata + DirectCast(CurrCompoParam, TextBoxOnOffParam).SetIsActive(False) + End If Exit While End If ' Se è di tipo obbligatorio (non è OnOff) @@ -1805,13 +1968,13 @@ Public Class Part End If ' assegno al parametro del componente il valore "filtrato" DirectCast(CurrCompoParam, ComboBoxParam).SetSelItem(SelItem) - ' assegno il valore letto alla textbox + ' assegno il valore letto alla textbox ElseIf TypeOf CurrCompoParam Is TextBoxParam Then Dim sVal As String = GetValueWithoutKey(sLine) ' per ora non esegue nessun tipo di controllo sui valori letti dal file DDF DirectCast(CurrCompoParam, TextBoxParam).m_Value = sVal End If - ' se il nome esiste ma è sbagliato + ' se il nome esiste ma è sbagliato ElseIf Not String.IsNullOrWhiteSpace(sKey) Then ' se il nome non è preceduto dal trattino If Not sKey.StartsWith("- ") Then @@ -1829,7 +1992,7 @@ Public Class Part Exit While End If End If - ' Se altrimenti è una TextBoxOnOff + ' Se altrimenti è una TextBoxOnOff ElseIf TypeOf CurrCompoParam Is TextBoxOnOffParam Then ' se il nome del parametro è lo stesso di quello presente nel componente If String.Equals(Trim(CompoTemplateItem.CompoParamList(IndexParam).DDFName), GetKey(sLine)) Then @@ -1837,7 +2000,7 @@ Public Class Part Dim sVal As String = GetValueWithKey(sLine, Trim(CurrCompoParam.DDFName)) DirectCast(CurrCompoParam, TextBoxOnOffParam).m_Value = sVal DirectCast(CurrCompoParam, TextBoxOnOffParam).SetIsActive(True) - ' se il nome esiste ma è sbagliato + ' se il nome esiste ma è sbagliato ElseIf Not String.IsNullOrWhiteSpace(GetKey(sLine)) Then ' significa che la TextBoxOnOff è stata disattivata DirectCast(CurrCompoParam, TextBoxOnOffParam).SetIsActive(False) @@ -1845,7 +2008,7 @@ Public Class Part IndexParam += 1 Continue While End If - ' Altrimenti è una ComboBoxOnOffParam + ' Altrimenti è una ComboBoxOnOffParam Else ' se il nome del parametro è lo stesso di quello presente nel componente If String.Equals(Trim(CompoTemplateItem.CompoParamList(IndexParam).DDFName), Trim(GetKey(sLine))) Then @@ -1876,7 +2039,7 @@ Public Class Part End If ' assegno al parametro della compnente il valore "filtrato" DirectCast(CurrCompoParam, ComboBoxOnOffParam).SetSelItem(SelItem) - ' se il nome esiste ma è sbagliato + ' se il nome esiste ma è sbagliato ElseIf Not String.IsNullOrWhiteSpace(GetKey(sLine)) Then ' significa che la TextBoxOnOff è stata disattivata DirectCast(CurrCompoParam, ComboBoxOnOffParam).SetIsActive(False) @@ -1901,6 +2064,69 @@ Public Class Part End While End Sub + ' controllo che tutti i bevel siano dello stesso tipo + Private Function ControlBevel(BLock As String, BHinge As String, BTop As String, BBottom As String) As String + Dim BBevel As String = String.Empty + ' carico i Bevel non nulli in un vettore + Dim ArrayProfile(3) As String + If Not String.IsNullOrEmpty(BLock) Then ArrayProfile(0) = BLock Else ArrayProfile(0) = String.Empty + If Not String.IsNullOrEmpty(BHinge) Then ArrayProfile(1) = BHinge Else ArrayProfile(1) = String.Empty + If Not String.IsNullOrEmpty(BTop) Then ArrayProfile(2) = BTop Else ArrayProfile(2) = String.Empty + If Not String.IsNullOrEmpty(BBottom) Then ArrayProfile(3) = BBottom Else ArrayProfile(3) = String.Empty + For Index1 As Integer = 0 To 2 + For Index2 As Integer = Index1 + 1 To 3 + If Not String.IsNullOrEmpty(ArrayProfile(Index1)) And Not String.IsNullOrEmpty(ArrayProfile(Index2)) Then + ' eseguo il confronto + If ArrayProfile(Index1) <> ArrayProfile(Index2) Then + MessageBox.Show("Incongruity between the bevel, it has been resolved by default.", "Error", MessageBoxButton.OK, MessageBoxImage.Error) + Part.FirstReadingEdge = True ' per mantere attivo l'asterisco di modifica + BBevel = ArrayProfile(Index1) + Exit For + Else + BBevel = ArrayProfile(Index1) + End If + End If + Next + Next + Return BBevel + End Function + + ' restituisce il messaggio di modifica del bevel + Private Sub Modifybevel(Bevel As String, OppositeBevel As String) + If Bevel = OppositeBevel Then + 'MessageBox.Show("Door dispositiopn has been modify.", EgtMsg(50115), MessageBoxButton.OK, MessageBoxImage.Asterisk, MessageBoxResult.No) + bModifyBevel = True + Part.FirstReadingEdge = True + End If + ' Modifico il secure (diverso da zero) + If String.IsNullOrEmpty(Bevel) AndAlso m_Secure <> "0" AndAlso m_Secure <> DdfFile.SetSecure(m_Swing, m_DispositionItem.Name, m_Secure) Then + 'MessageBox.Show("Door dispositiopn has been modify.", EgtMsg(50115), MessageBoxButton.OK, MessageBoxImage.Asterisk, MessageBoxResult.No) + bModifyBevel = True + Part.FirstReadingEdge = True ' per mantere attivo l'asterisco di modifica + End If + ' caso speciale + If String.IsNullOrEmpty(Bevel) AndAlso m_Secure = "0" AndAlso DdfFile.SetSecure(m_Swing, m_DispositionItem.Name, m_Secure) = "UP" Then + 'MessageBox.Show("Door dispositiopn has been modify.", EgtMsg(50115), MessageBoxButton.OK, MessageBoxImage.Asterisk, MessageBoxResult.No) + bModifyBevel = True + Part.FirstReadingEdge = True ' per mantere attivo l'asterisco di modifica + End If + End Sub + + ' per mantenere la configuarbilità con la precedente versione devo riaggiornare le liste dei + Private Sub EdgeTypeCpntrol(ByRef CurrEdgeType As EdgeType) + If CurrEdgeType.Name = "BU" And OptionModule.m_sDisposition = "BD" Then + Try + CurrEdgeType = EdgeTypeList.First(Function(x) x.Name = "BD") + Catch ex As Exception + End Try + ElseIf CurrEdgeType.Name = "BD" And OptionModule.m_sDisposition = "BU" Then + Try + CurrEdgeType = EdgeTypeList.First(Function(x) x.Name = "BU") + Catch ex As Exception + End Try + End If + End Sub + #End Region ' Lettura ddf ' Genero una nuova porta da usare nella lettura di un DDF diff --git a/DoorParameters/PartPageV.xaml b/DoorParameters/PartPageV.xaml index 554f7cf..1dd4289 100644 --- a/DoorParameters/PartPageV.xaml +++ b/DoorParameters/PartPageV.xaml @@ -137,12 +137,13 @@ Style="{StaticResource DoorParamsTxBl}" Margin="20,2,0,2"/> - + IsEnabled="{Binding IsRaedOnly, Converter={StaticResource TrueToFalse}}"/> + + + AssemblyPageV.xaml + LauncherV.xaml diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index f0081b7..5a37148 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 5815870..fd0eae7 100644 --- a/OptionsWindow/OptionModule.vb +++ b/OptionsWindow/OptionModule.vb @@ -265,20 +265,20 @@ Friend Module OptionModule If String.IsNullOrWhiteSpace(m_HingeEdgeType.Name) Then m_HingeEdgeType = OptionsVM.EdgeTypeList(0) Dim TopType As String = String.Empty DefaultGetPrivateProfileString(S_EDGE, K_TOPEDGE_INI, "SQ", TopType) - For Index = 0 To OptionsVM.EdgeTypeList.Count - 1 - If OptionsVM.EdgeTypeList(Index).Name = TopType Then - m_TopType = OptionsVM.EdgeTypeList(Index) + For Index = 0 To OptionsVM.TopEdgeTypeList.Count - 1 + If OptionsVM.TopEdgeTypeList(Index).Name = TopType Then + m_TopType = OptionsVM.TopEdgeTypeList(Index) End If Next - If String.IsNullOrWhiteSpace(m_TopType.Name) Then m_TopType = OptionsVM.EdgeTypeList(0) + If String.IsNullOrWhiteSpace(m_TopType.Name) Then m_TopType = OptionsVM.TopEdgeTypeList(0) Dim BottomType As String = String.Empty DefaultGetPrivateProfileString(S_EDGE, K_BOTTOMEDGE_INI, "SQ", BottomType) - For Index = 0 To OptionsVM.EdgeTypeList.Count - 1 - If OptionsVM.EdgeTypeList(Index).Name = BottomType Then - m_BottomType = OptionsVM.EdgeTypeList(Index) + For Index = 0 To OptionsVM.TopEdgeTypeList.Count - 1 + If OptionsVM.TopEdgeTypeList(Index).Name = BottomType Then + m_BottomType = OptionsVM.TopEdgeTypeList(Index) End If Next - If String.IsNullOrWhiteSpace(m_BottomType.Name) Then m_BottomType = OptionsVM.EdgeTypeList(0) + If String.IsNullOrWhiteSpace(m_BottomType.Name) Then m_BottomType = OptionsVM.TopEdgeTypeList(0) ' Carico i valori booleani associati alla lavorazione Dim LockEdgeMachining As Boolean = False @@ -368,31 +368,31 @@ Friend Module OptionModule m_RightJambChk = RightChk Dim LockEdgeTypeAss As String = String.Empty - DefaultGetPrivateProfileString(S_EDGEASSEMBLY, K_LOCKEDGE, "", LockEdgeTypeAss) - For Index = 0 To OptionsVM.EdgeTypeList.Count - 1 - If OptionsVM.EdgeTypeList(Index).Name = LockEdgeTypeAss Then - m_LockEdgeTypeAssembly = OptionsVM.EdgeTypeList(Index) + DefaultGetPrivateProfileString(S_EDGEASSEMBLY, K_LOCKEDGE, "SQ", LockEdgeTypeAss) + For Index = 0 To OptionsVM.FrameEdgeTypeList.Count - 1 + If OptionsVM.FrameEdgeTypeList(Index).Name = LockEdgeTypeAss Then + m_LockEdgeTypeAssembly = OptionsVM.FrameEdgeTypeList(Index) End If Next Dim HingeEdgeTypeAss As String = String.Empty DefaultGetPrivateProfileString(S_EDGEASSEMBLY, K_HINGEDGE_INI, "SQ", HingeEdgeTypeAss) - For Index = 0 To OptionsVM.EdgeTypeList.Count - 1 - If OptionsVM.EdgeTypeList(Index).Name = HingeEdgeTypeAss Then - m_HingeEdgeTypeAssembly = OptionsVM.EdgeTypeList(Index) + For Index = 0 To OptionsVM.FrameEdgeTypeList.Count - 1 + If OptionsVM.FrameEdgeTypeList(Index).Name = HingeEdgeTypeAss Then + m_HingeEdgeTypeAssembly = OptionsVM.FrameEdgeTypeList(Index) End If Next Dim TopTypeAss As String = String.Empty DefaultGetPrivateProfileString(S_EDGEASSEMBLY, K_TOPEDGE_INI, "SQ", TopTypeAss) - For Index = 0 To OptionsVM.EdgeTypeList.Count - 1 - If OptionsVM.EdgeTypeList(Index).Name = TopTypeAss Then - m_TopTypeAssembly = OptionsVM.EdgeTypeList(Index) + For Index = 0 To OptionsVM.FrameEdgeTypeList.Count - 1 + If OptionsVM.FrameEdgeTypeList(Index).Name = TopTypeAss Then + m_TopTypeAssembly = OptionsVM.FrameEdgeTypeList(Index) End If Next Dim BottomTypeAss As String = String.Empty DefaultGetPrivateProfileString(S_EDGEASSEMBLY, K_BOTTOMEDGE_INI, "SQ", BottomTypeAss) - For Index = 0 To OptionsVM.EdgeTypeList.Count - 1 - If OptionsVM.EdgeTypeList(Index).Name = BottomTypeAss Then - m_BottomTypeAssembly = OptionsVM.EdgeTypeList(Index) + For Index = 0 To OptionsVM.FrameEdgeTypeList.Count - 1 + If OptionsVM.FrameEdgeTypeList(Index).Name = BottomTypeAss Then + m_BottomTypeAssembly = OptionsVM.FrameEdgeTypeList(Index) End If Next diff --git a/OptionsWindow/OptionsV.xaml b/OptionsWindow/OptionsV.xaml index c574af7..5bf1507 100644 --- a/OptionsWindow/OptionsV.xaml +++ b/OptionsWindow/OptionsV.xaml @@ -24,8 +24,8 @@ - - + + @@ -134,14 +134,14 @@ @@ -318,7 +318,7 @@ Style="{StaticResource DoorParamsTxBl}" Margin="2,0,0,2" /> @@ -328,7 +328,7 @@ Style="{StaticResource DoorParamsTxBl}" Margin="2,0,0,2" /> @@ -339,7 +339,7 @@ Style="{StaticResource DoorParamsTxBl}" Margin="2,0,0,2" /> @@ -349,7 +349,7 @@ Style="{StaticResource DoorParamsTxBl}" Margin="2,0,0,2" /> @@ -393,7 +393,7 @@ Padding="1" Margin="5,2.5,10,2.5"/> - + + Margin="5,2.5,10,-5.5" VerticalAlignment="Stretch" /> + Margin="5,2.5,10,-5.5" VerticalAlignment="Stretch"/> @@ -466,20 +465,29 @@ + + IsChecked="{Binding BevelUpIsChecked}" + Visibility="{Binding BySwingConfiguration}"/> + VerticalAlignment="Center" + Visibility="{Binding BySwingConfiguration}"/> + IsChecked="{Binding BevelDownIsChecked}" + Visibility="{Binding BySwingConfiguration}"/> + VerticalAlignment="Center" + Visibility="{Binding BySwingConfiguration}"/> diff --git a/OptionsWindow/OptionsViewModel.vb b/OptionsWindow/OptionsViewModel.vb index 9465d90..fd3fb5a 100644 --- a/OptionsWindow/OptionsViewModel.vb +++ b/OptionsWindow/OptionsViewModel.vb @@ -228,6 +228,19 @@ Public Class OptionsVM End Get End Property + Public Shared ReadOnly Property TopEdgeTypeList As ObservableCollection(Of EdgeType) + Get + Return Part.m_TopEdgeTypeList + End Get + End Property + + Public Shared ReadOnly Property FrameEdgeTypeList As ObservableCollection(Of EdgeType) + Get + Return Assembly.m_FrameEdgeTypeList + End Get + End Property + + Public Property LockEdgeType As EdgeType Get If m_LockEdgeType.IsActive = Visibility.Collapsed Then @@ -257,9 +270,15 @@ Public Class OptionsVM Public Property TopType As EdgeType Get If m_TopType.IsActive = Visibility.Collapsed Then - m_TopType = EdgeTypeList(0) + m_TopType = TopEdgeTypeList(0) + Else + Try + m_TopType = TopEdgeTypeList.First(Function(x) x.Name = m_TopType.Name) + Catch ex As Exception + m_TopType = TopEdgeTypeList(0) + End Try End If - Return OptionModule.m_TopType + Return m_TopType End Get Set(value As EdgeType) OptionModule.m_TopType = value @@ -270,9 +289,15 @@ Public Class OptionsVM Public Property BottomType As EdgeType Get If m_BottomType.IsActive = Visibility.Collapsed Then - m_BottomType = EdgeTypeList(0) + m_BottomType = TopEdgeTypeList(0) + Else + Try + m_BottomType = TopEdgeTypeList.First(Function(x) x.Name = m_BottomType.Name) + Catch ex As Exception + m_BottomType = TopEdgeTypeList(0) + End Try End If - Return OptionModule.m_BottomType + Return m_BottomType End Get Set(value As EdgeType) OptionModule.m_BottomType = value @@ -920,6 +945,38 @@ Public Class OptionsVM End Get End Property + Public ReadOnly Property DispConfiguration As String + Get + Dim Msg As String = String.Empty + If OptionModule.m_sDisposition = "BU" Then + Msg = "Wide Side Down (BU)" + m_BevelConfiguration = Visibility.Visible + m_BySwingConfiguration = Visibility.Collapsed + ElseIf OptionModule.m_sDisposition = "BD" Then + Msg = "Wide Side Up (BD)" + m_BevelConfiguration = Visibility.Visible + m_BySwingConfiguration = Visibility.Collapsed + Else + m_BevelConfiguration = Visibility.Collapsed + m_BySwingConfiguration = Visibility.Visible + End If + Return Msg + End Get + End Property + + Private m_BevelConfiguration As Visibility + Public ReadOnly Property BevelConfiguration As Visibility + Get + Return m_BevelConfiguration + End Get + End Property + + Private m_BySwingConfiguration As Visibility + Public ReadOnly Property BySwingConfiguration As Visibility + Get + Return m_BySwingConfiguration + End Get + End Property '--------------------------------------------------------------------------------------------------------------------------------------------------------------- 'tab2 Public ReadOnly Property AssemblyMsg As String @@ -1004,9 +1061,11 @@ Public Class OptionsVM #End Region ' Controllo di eliminare un bevel dalla lista: 1 se accendo un bevel, 2 se spengo un bevel, -1 tutti i casi che non sono questi + ' VisibilityBevel = il valore della optionPage Private Function CheckBevel(VisibilityBevel As Visibility, bValue As Boolean) As Integer Dim bAnser As Integer Dim bBevel As Boolean + ' converto il parametro di visibilità in un booleano If VisibilityBevel = Visibility.Visible Then bBevel = True Else @@ -1056,8 +1115,58 @@ Public Class OptionsVM End If End Function - ' creo la lista di oggetti aggiornando la visibilità dei bevel Up e Down + ' aggiorno la visibilità dei bevel Up e Down Public Sub RefreshEdgeTypeList() + '--------------------------------------------------------------------------------------------------------------------------------------------------------------- + ' mantenendo la compatibilità con la precedente confinìgurazione + If OptionModule.m_sDisposition <> "BySwing" Then + ' applico un ciclo for perchè non conosco a priori la posizione all'interno della lista dei bevel BU e BD + For IndexBevelEdgeTypeList As Integer = 0 To Part.m_EdgeTypeList.Count - 1 + If Part.m_EdgeTypeList(IndexBevelEdgeTypeList).Name = "BU" Then Part.m_EdgeTypeList(IndexBevelEdgeTypeList).IsActive = m_bBevelUp + If Part.m_EdgeTypeList(IndexBevelEdgeTypeList).Name = "BD" Then Part.m_EdgeTypeList(IndexBevelEdgeTypeList).IsActive = m_bBevelDown + Next + For IndexTopBevelEdgeTypeList As Integer = 0 To Part.m_TopEdgeTypeList.Count - 1 + If Part.m_TopEdgeTypeList(IndexTopBevelEdgeTypeList).Name = "BU" Then Part.m_TopEdgeTypeList(IndexTopBevelEdgeTypeList).IsActive = m_bBevelUp + If Part.m_TopEdgeTypeList(IndexTopBevelEdgeTypeList).Name = "BD" Then Part.m_TopEdgeTypeList(IndexTopBevelEdgeTypeList).IsActive = m_bBevelDown + Next + Else ' sono nella configurazione BySwing in cui devo sostituire i Bevel BU e BD con BV + ' devo eliminare temporaneamente dalla lista i Bevel BU e i Bevel BD + Dim IndexBV As Integer = -1 + ' nascondo tutti i bevel della lista + For IndexBevelEdgeTypeList As Integer = 0 To Part.m_EdgeTypeList.Count - 1 + If Part.m_EdgeTypeList(IndexBevelEdgeTypeList).Name = "BU" Then Part.m_EdgeTypeList(IndexBevelEdgeTypeList).IsActive = Visibility.Collapsed + If Part.m_EdgeTypeList(IndexBevelEdgeTypeList).Name = "BD" Then + Part.m_EdgeTypeList(IndexBevelEdgeTypeList).IsActive = Visibility.Collapsed + IndexBV = IndexBevelEdgeTypeList + End If + Next + Dim BVEdge As New EdgeType("BV", Visibility.Visible) + Dim ThereIsBV As Integer = -1 + ' cerco l'indice del bevel BV, se non lo trovo carico il valore dell'inidce a -1 + For Index As Integer = 0 To Part.m_EdgeTypeList.Count - 1 + If Part.m_EdgeTypeList(Index).Name = "BV" Then + ThereIsBV = Index + Exit For + End If + Next + ' inserisco il bevel BV se sono nella vecchia configurazione + If IndexBV <> -1 AndAlso IndexBV < Part.m_EdgeTypeList.Count - 1 AndAlso ThereIsBV = -1 Then + Part.m_EdgeTypeList.Insert(IndexBV, BVEdge) + Part.m_TopEdgeTypeList.Insert(IndexBV, BVEdge) + End If + If ThereIsBV <> -1 Then IndexBV = ThereIsBV + ' se sono nella vecchia configurazione sostutuisci BU/BD con BV + If IsNothing(Map.refPartPageVM.CurrPart) Then + If Map.refPartPageVM.CurrPart.LockEdgeType.Name = "BU" OrElse Map.refPartPageVM.CurrPart.LockEdgeType.Name = "BD" Then Map.refPartPageVM.CurrPart.SetLockEdgeType(Part.m_EdgeTypeList(IndexBV)) + If Map.refPartPageVM.CurrPart.HingeEdgeType.Name = "BU" OrElse Map.refPartPageVM.CurrPart.HingeEdgeType.Name = "BD" Then Map.refPartPageVM.CurrPart.SetHingeEdgeType(Part.m_EdgeTypeList(IndexBV)) + If Map.refPartPageVM.CurrPart.TopType.Name = "BU" OrElse Map.refPartPageVM.CurrPart.TopType.Name = "BD" Then Map.refPartPageVM.CurrPart.SetTopType(Part.m_EdgeTypeList(IndexBV)) + If Map.refPartPageVM.CurrPart.BottomType.Name = "BU" OrElse Map.refPartPageVM.CurrPart.BottomType.Name = "BD" Then Map.refPartPageVM.CurrPart.SetBottomType(Part.m_EdgeTypeList(IndexBV)) + Map.refPartPageVM.CurrPart.NotifyPropertyChanged("EdegTypeList") + End If + End If + + '--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + ' aggiorno la lista For IndexBeveDisp As Integer = 0 To Part.m_DispositionList.Count - 1 If Part.m_DispositionList(IndexBeveDisp).Name = "BU" Then Part.m_DispositionList(IndexBeveDisp).IsActive = OptionModule.m_bBevelUp @@ -1065,53 +1174,72 @@ Public Class OptionsVM Part.m_DispositionList(IndexBeveDisp).IsActive = OptionModule.m_bBevelDown End If Next + ' aggiorno la lista Map.refPartPageVM.CurrPart.NotifyPropertyChanged("DispositionList") - + ' verifico che l'elemento selezionato nella option page non sia stato disattivato If Not IsNothing(Map.refPartPageVM.CurrPart) Then If Map.refPartPageVM.CurrPart.DispositionItem.IsActive = Visibility.Collapsed Then Map.refPartPageVM.CurrPart.DispositionItem = Part.m_DispositionList(2) - 'NotifyPropertyChanged("LockEdgeType") - 'NotifyPropertyChanged("LockEdgeTypeAssembly") - 'Map.refPartPageVM.CurrPart.NotifyPropertyChanged("LockEdgeType") - 'NotifyPropertyChanged("HingeEdgeType") - 'NotifyPropertyChanged("HingeEdgeTypeAssembly") - 'Map.refPartPageVM.CurrPart.NotifyPropertyChanged("HingeEdgeType") - 'NotifyPropertyChanged("TopType") - 'NotifyPropertyChanged("TopTypeAssembly") - 'Map.refPartPageVM.CurrPart.NotifyPropertyChanged("TopType") - 'NotifyPropertyChanged("BottomType") - 'NotifyPropertyChanged("BottomTypeAssembly") - 'Map.refPartPageVM.CurrPart.NotifyPropertyChanged("BottomType") - 'Map.refPartPageVM.CurrPart.NotifyPropertyChanged("DispositionItem") End If If Not IsNothing(Map.refAssemblyPageVM.CurrAssembly) Then - 'Map.refAssemblyPageVM.CurrAssembly.NotifyPropertyChanged("EdgeTypeList") - 'Map.refAssemblyPageVM.CurrAssembly.NotifyPropertyChanged("TopEdgeTypeList") - 'NotifyPropertyChanged("LockEdgeType") - 'NotifyPropertyChanged("LockEdgeTypeAssembly") - 'Map.refAssemblyPageVM.CurrAssembly.NotifyPropertyChanged("LockEdgeType") - 'NotifyPropertyChanged("HingeEdgeType") - 'NotifyPropertyChanged("HingeEdgeTypeAssembly") - 'Map.refAssemblyPageVM.CurrAssembly.NotifyPropertyChanged("HingeEdgeType") - 'NotifyPropertyChanged("TopType") - 'NotifyPropertyChanged("TopTypeAssembly") - 'Map.refAssemblyPageVM.CurrAssembly.NotifyPropertyChanged("TopType") - 'NotifyPropertyChanged("BottomType") - 'NotifyPropertyChanged("BottomTypeAssembly") - 'Map.refAssemblyPageVM.CurrAssembly.NotifyPropertyChanged("BottomType") + Map.refAssemblyPageVM.CurrAssembly.NotifyPropertyChanged("EdgeTypeList") End If End Sub + ' creo le liste dei bevel e delle siposizioni Public Shared Sub CreateEdgeTypeList() + '---------------------------------------------------------------------------------------------------------- + ' carico la lista dei bevel da mostrare sugli spigoli Lock, Hinge For Index = 0 To m_StaticEdgeTypeList.Count - 1 + If m_StaticEdgeTypeList(Index) = "BU" AndAlso OptionModule.m_sDisposition = m_StaticEdgeTypeList(Index) Then + m_bBevelUp = Visibility.Visible + m_bBevelDown = Visibility.Collapsed + ElseIf m_StaticEdgeTypeList(Index) = "BD" AndAlso OptionModule.m_sDisposition = m_StaticEdgeTypeList(Index) Then + m_bBevelUp = Visibility.Collapsed + m_bBevelDown = Visibility.Visible + End If Part.m_EdgeTypeList.Add(New EdgeType(m_StaticEdgeTypeList(Index), Visibility.Visible)) Next - For IndexTop = 0 To 1 - Part.m_TopEdgeTypeList.Add(Part.m_EdgeTypeList(IndexTop)) + '---------------------------------------------------------------------------------------------------------- + ' caricare gli spigoli top e bottom facendo attenzione al tipo di configurazione! + Part.m_TopEdgeTypeList.Add(New EdgeType("SQ", Visibility.Visible)) + Try + ' controllo che nella configurazione sia presente il Bevel BV + Part.m_TopEdgeTypeList.Add(Part.m_EdgeTypeList.First(Function(x) x.Name = "BV")) + Catch ex As Exception + Try + Part.m_TopEdgeTypeList.Add(Part.m_EdgeTypeList.First(Function(x) x.Name = "BU")) + Catch ex2 As Exception + End Try + Try + Part.m_TopEdgeTypeList.Add(Part.m_EdgeTypeList.First(Function(x) x.Name = "BD")) + Catch ex2 As Exception + End Try + End Try + '---------------------------------------------------------------------------------------------------------- + ' dopo la creazione delle liste modifico la visibilità dei bevel + For IndexBevelEdgeTypeList As Integer = 0 To Part.m_EdgeTypeList.Count - 1 + If Part.m_EdgeTypeList(IndexBevelEdgeTypeList).Name = "BU" Then Part.m_EdgeTypeList(IndexBevelEdgeTypeList).IsActive = m_bBevelUp + If Part.m_EdgeTypeList(IndexBevelEdgeTypeList).Name = "BD" Then Part.m_EdgeTypeList(IndexBevelEdgeTypeList).IsActive = m_bBevelDown Next + For IndexTopBevelEdgeTypeList As Integer = 0 To Part.m_TopEdgeTypeList.Count - 1 + If Part.m_TopEdgeTypeList(IndexTopBevelEdgeTypeList).Name = "BU" Then Part.m_TopEdgeTypeList(IndexTopBevelEdgeTypeList).IsActive = m_bBevelUp + If Part.m_TopEdgeTypeList(IndexTopBevelEdgeTypeList).Name = "BD" Then Part.m_TopEdgeTypeList(IndexTopBevelEdgeTypeList).IsActive = m_bBevelDown + Next + '---------------------------------------------------------------------------------------------------------- + ' caricare gli spigoli dei frame + Assembly.m_FrameEdgeTypeList.Add(New EdgeType("SQ", Visibility.Visible)) + Try + ' controllo che nella configurazione sia presente il Bevel BV + Assembly.m_FrameEdgeTypeList.Add(Part.m_EdgeTypeList.First(Function(x) x.Name = "BV")) + Catch ex As Exception + Assembly.m_FrameEdgeTypeList.Add(New EdgeType("BV", Visibility.Visible)) + End Try + '---------------------------------------------------------------------------------------------------------- + ' carico la lista che contiene la disposizione in macchina Part.m_DispositionList.Add(New EdgeType("BU", OptionModule.m_bBevelUp)) Part.m_DispositionList.Add(New EdgeType("BD", OptionModule.m_bBevelDown)) Part.m_DispositionList.Add(New EdgeType("BySwing", Visibility.Visible)) - ' assegno il valore della disposizione + ' assegno il valore della disposizione letto dal file Config.ini If IsNothing(OptionModule.m_Disposition) Then OptionModule.m_Disposition = Part.m_DispositionList(2) ElseIf OptionModule.m_Disposition.Name <> "BU" AndAlso OptionModule.m_Disposition.Name <> "BD" Then @@ -1191,7 +1319,7 @@ Public Class OptionsVM End If MachinDir = FolderBrowserDialog.SelectedPath End Select - + End Sub Public ReadOnly Property OptionGuideCmd As ICommand @@ -1247,6 +1375,16 @@ Public Class EdgeType End Set End Property + Private m_BevelDDF As String = String.Empty + Public Property BevelDDF As String + Get + Return m_BevelDDF + End Get + Set(value As String) + m_BevelDDF = value + End Set + End Property + Sub New(sName As String, bIsActive As Visibility) m_Name = sName m_IsActive = bIsActive diff --git a/RegexFunction.vb b/RegexFunction.vb index dc49a50..5e4e7aa 100644 --- a/RegexFunction.vb +++ b/RegexFunction.vb @@ -91,4 +91,10 @@ Module RegexFunction Return Regex.Match(RemoveComment(sLine), "\s*(.*?\b)\s*:.*").Groups(1).Value End Function + ' estrae da una riga lua il contenuto scommentato + Friend Function RemoveCommentLUA(sLine As String) As String + If sLine.Contains("--") Then sLine = Regex.Match(sLine, "\s*(.*?)\s*--.*$").Groups(1).Value + Return sLine + End Function + End Module diff --git a/Resources/Refresh/Error.png b/Resources/Refresh/Error.png index 376fb15..5ef7b9d 100644 Binary files a/Resources/Refresh/Error.png and b/Resources/Refresh/Error.png differ