From 0bc8e470b976b6adfef6cbf6d9729ff692a37a8b Mon Sep 17 00:00:00 2001 From: Nicola Pievani Date: Tue, 21 Nov 2017 16:07:47 +0000 Subject: [PATCH] EgtDOORCreator 1.8j1 : - creazione di assemblati --- .../{AboutBoxView.xaml => AboutBoxV.xaml} | 2 +- ...AboutBoxView.xaml.vb => AboutBoxV.xaml.vb} | 7 +- .../{AboutBoxViewModel.vb => AboutBoxVM.vb} | 4 +- Application.xaml.vb | 9 +- Assembly/Assembly.vb | 1904 +++++++++++++++++ Assembly/AssemblyPageV.xaml | 459 ++++ Assembly/AssemblyPageV.xaml.vb | 34 + Assembly/AssemblyPageVM.vb | 265 +++ Assembly/PartDoor.vb | 55 + CompoPanel/CompoPanelV.xaml | 53 + CompoPanel/CompoPanelV.xaml.vb | 3 + ...CompoPanelViewModel.vb => CompoPanelVM.vb} | 80 +- CompoPanel/CompoPanelView.xaml | 31 - CompoPanel/CompoPanelView.xaml.vb | 3 - CompoPanel/CompoType.vb | 22 +- Constants/ConstCompo.vb | 4 +- Constants/ConstGen.vb | 4 +- Constants/ConstIni.vb | 31 + Converter/BooleanToVisibility.vb | 18 + Converter/Path.vb | 17 + Converter/ProjectVisibility.vb | 17 + Converter/TrueToFalse.vb | 11 + DdfFile.vb | 705 +++++- ...ManagerView.xaml => AssemblyManagerV.xaml} | 33 +- DoorManager/AssemblyManagerV.xaml.vb | 8 + DoorManager/AssemblyManagerVM.vb | 545 +++++ DoorManager/DoorManagerView.xaml.vb | 18 - DoorManager/DoorManagerViewModel.vb | 419 ---- DoorParameters/Compo.vb | 480 +++-- DoorParameters/DoorParametersView.xaml.vb | 6 - DoorParameters/{Door.vb => Part.vb} | 975 +++++++-- ...DoorParametersView.xaml => PartPageV.xaml} | 158 +- DoorParameters/PartPageV.xaml.vb | 3 + ...orParametersViewModel.vb => PartPageVM.vb} | 60 +- EgtDOORCreator.vbproj | 159 +- EgtDOORCreatorDictionary.xaml | 47 + Guide/{GuideView.xaml => GuideV.xaml} | 5 +- Guide/GuideV.xaml.vb | 16 + Guide/GuideView.xaml.vb | 16 - Guide/GuideViewModel.vb | 2 +- IniFile.vb | 9 + Launcher/LauncherModule.vb | 2 +- .../{LauncherView.xaml => LauncherV.xaml} | 2 +- ...LauncherView.xaml.vb => LauncherV.xaml.vb} | 0 .../{LauncherViewModel.vb => LauncherVM.vb} | 20 +- MainWindow/MainWindow.xaml.vb | 22 - .../{MainWindow.xaml => MainWindowV.xaml} | 19 +- MainWindow/MainWindowV.xaml.vb | 20 + ...MainWindowViewModel.vb => MainWindowVM.vb} | 139 +- Map.vb | 174 ++ My Project/AssemblyInfo.vb | 4 +- OptionsWindow/OptionModule.vb | 196 +- OptionsWindow/OptionsV.xaml | 661 ++++++ .../{OptionsView.xaml.vb => OptionsV.xaml.vb} | 0 OptionsWindow/OptionsView.xaml | 413 ---- OptionsWindow/OptionsViewModel.vb | 531 ++++- ParamFunction.vb | 287 +++ ProjectManager/Project.vb | 58 +- ...tManagerView.xaml => ProjectManagerV.xaml} | 2 +- ProjectManager/ProjectManagerV.xaml.vb | 3 + ...anagerViewModel.vb => ProjectManagerVM.vb} | 166 +- ProjectManager/ProjectManagerView.xaml.vb | 3 - RegexFunction.vb | 32 +- Resources/JambPage/Door.png | Bin 0 -> 2031 bytes Resources/JambPage/Jamb_L.png | Bin 0 -> 2264 bytes Resources/JambPage/Jamb_R.png | Bin 0 -> 2049 bytes Resources/JambPage/Jamb_TL.png | Bin 0 -> 409 bytes Resources/JambPage/Jamb_TM.png | Bin 0 -> 407 bytes Resources/JambPage/Jamb_TR.png | Bin 0 -> 412 bytes Resources/Refresh/BackArrow.png | Bin 0 -> 624 bytes ...ntPanelView.xaml => InstrumentPanelV.xaml} | 2 +- ...lView.xaml.vb => InstrumentPanelV.xaml.vb} | 0 ...PanelViewModel.vb => InstrumentPanelVM.vb} | 23 +- ...iewPanelView.xaml => PopUpViewPanelV.xaml} | 2 +- .../PopUpViewPanel/PopUpViewPanelV.xaml.vb | 3 + ...wPanelViewModel.vb => PopUpViewPanelVM.vb} | 20 +- .../PopUpViewPanel/PopUpViewPanelView.xaml.vb | 3 - ...freshPanelView.xaml => RefreshPanelV.xaml} | 10 +- ...anelView.xaml.vb => RefreshPanelV.xaml.vb} | 0 ...eshPanelViewModel.vb => RefreshPanelVM.vb} | 67 +- ...eneManagerView.xaml => SceneManagerV.xaml} | 14 +- SceneManager/SceneManagerV.xaml.vb | 3 + ...eManagerViewModel.vb => SceneManagerVM.vb} | 145 +- SceneManager/SceneManagerView.xaml.vb | 3 - .../{ShowPanelView.xaml => ShowPanelV.xaml} | 2 +- ...owPanelView.xaml.vb => ShowPanelV.xaml.vb} | 0 .../{ShowPanelViewModel.vb => ShowPanelVM.vb} | 17 +- .../{ViewPanelView.xaml => ViewPanelV.xaml} | 2 +- ...ewPanelView.xaml.vb => ViewPanelV.xaml.vb} | 0 .../{ViewPanelViewModel.vb => ViewPanelVM.vb} | 22 +- .../{StatusBarView.xaml => StatusBarV.xaml} | 2 +- ...atusBarView.xaml.vb => StatusBarV.xaml.vb} | 0 .../{StatusBarViewModel.vb => StatusBarVM.vb} | 9 +- Utility.vb | 92 + 94 files changed, 7927 insertions(+), 1965 deletions(-) rename AboutBoxWindow/{AboutBoxView.xaml => AboutBoxV.xaml} (96%) rename AboutBoxWindow/{AboutBoxView.xaml.vb => AboutBoxV.xaml.vb} (89%) rename AboutBoxWindow/{AboutBoxViewModel.vb => AboutBoxVM.vb} (92%) create mode 100644 Assembly/Assembly.vb create mode 100644 Assembly/AssemblyPageV.xaml create mode 100644 Assembly/AssemblyPageV.xaml.vb create mode 100644 Assembly/AssemblyPageVM.vb create mode 100644 Assembly/PartDoor.vb create mode 100644 CompoPanel/CompoPanelV.xaml create mode 100644 CompoPanel/CompoPanelV.xaml.vb rename CompoPanel/{CompoPanelViewModel.vb => CompoPanelVM.vb} (58%) delete mode 100644 CompoPanel/CompoPanelView.xaml delete mode 100644 CompoPanel/CompoPanelView.xaml.vb create mode 100644 Converter/BooleanToVisibility.vb create mode 100644 Converter/Path.vb create mode 100644 Converter/ProjectVisibility.vb create mode 100644 Converter/TrueToFalse.vb rename DoorManager/{DoorManagerView.xaml => AssemblyManagerV.xaml} (64%) create mode 100644 DoorManager/AssemblyManagerV.xaml.vb create mode 100644 DoorManager/AssemblyManagerVM.vb delete mode 100644 DoorManager/DoorManagerView.xaml.vb delete mode 100644 DoorManager/DoorManagerViewModel.vb delete mode 100644 DoorParameters/DoorParametersView.xaml.vb rename DoorParameters/{Door.vb => Part.vb} (57%) rename DoorParameters/{DoorParametersView.xaml => PartPageV.xaml} (67%) create mode 100644 DoorParameters/PartPageV.xaml.vb rename DoorParameters/{DoorParametersViewModel.vb => PartPageVM.vb} (71%) rename Guide/{GuideView.xaml => GuideV.xaml} (84%) create mode 100644 Guide/GuideV.xaml.vb delete mode 100644 Guide/GuideView.xaml.vb rename Launcher/{LauncherView.xaml => LauncherV.xaml} (95%) rename Launcher/{LauncherView.xaml.vb => LauncherV.xaml.vb} (100%) rename Launcher/{LauncherViewModel.vb => LauncherVM.vb} (80%) delete mode 100644 MainWindow/MainWindow.xaml.vb rename MainWindow/{MainWindow.xaml => MainWindowV.xaml} (67%) create mode 100644 MainWindow/MainWindowV.xaml.vb rename MainWindow/{MainWindowViewModel.vb => MainWindowVM.vb} (59%) create mode 100644 Map.vb create mode 100644 OptionsWindow/OptionsV.xaml rename OptionsWindow/{OptionsView.xaml.vb => OptionsV.xaml.vb} (100%) delete mode 100644 OptionsWindow/OptionsView.xaml create mode 100644 ParamFunction.vb rename ProjectManager/{ProjectManagerView.xaml => ProjectManagerV.xaml} (96%) create mode 100644 ProjectManager/ProjectManagerV.xaml.vb rename ProjectManager/{ProjectManagerViewModel.vb => ProjectManagerVM.vb} (69%) delete mode 100644 ProjectManager/ProjectManagerView.xaml.vb create mode 100644 Resources/JambPage/Door.png create mode 100644 Resources/JambPage/Jamb_L.png create mode 100644 Resources/JambPage/Jamb_R.png create mode 100644 Resources/JambPage/Jamb_TL.png create mode 100644 Resources/JambPage/Jamb_TM.png create mode 100644 Resources/JambPage/Jamb_TR.png create mode 100644 Resources/Refresh/BackArrow.png rename SceneManager/InstrumentPanel/{InstrumentPanelView.xaml => InstrumentPanelV.xaml} (89%) rename SceneManager/InstrumentPanel/{InstrumentPanelView.xaml.vb => InstrumentPanelV.xaml.vb} (100%) rename SceneManager/InstrumentPanel/{InstrumentPanelViewModel.vb => InstrumentPanelVM.vb} (57%) rename SceneManager/PopUpViewPanel/{PopUpViewPanelView.xaml => PopUpViewPanelV.xaml} (95%) create mode 100644 SceneManager/PopUpViewPanel/PopUpViewPanelV.xaml.vb rename SceneManager/PopUpViewPanel/{PopUpViewPanelViewModel.vb => PopUpViewPanelVM.vb} (85%) delete mode 100644 SceneManager/PopUpViewPanel/PopUpViewPanelView.xaml.vb rename SceneManager/Refresh/{RefreshPanelView.xaml => RefreshPanelV.xaml} (60%) rename SceneManager/Refresh/{RefreshPanelView.xaml.vb => RefreshPanelV.xaml.vb} (100%) rename SceneManager/Refresh/{RefreshPanelViewModel.vb => RefreshPanelVM.vb} (52%) rename SceneManager/{SceneManagerView.xaml => SceneManagerV.xaml} (83%) create mode 100644 SceneManager/SceneManagerV.xaml.vb rename SceneManager/{SceneManagerViewModel.vb => SceneManagerVM.vb} (62%) delete mode 100644 SceneManager/SceneManagerView.xaml.vb rename SceneManager/ShowPanel/{ShowPanelView.xaml => ShowPanelV.xaml} (95%) rename SceneManager/ShowPanel/{ShowPanelView.xaml.vb => ShowPanelV.xaml.vb} (100%) rename SceneManager/ShowPanel/{ShowPanelViewModel.vb => ShowPanelVM.vb} (87%) rename SceneManager/ViewPanel/{ViewPanelView.xaml => ViewPanelV.xaml} (96%) rename SceneManager/ViewPanel/{ViewPanelView.xaml.vb => ViewPanelV.xaml.vb} (100%) rename SceneManager/ViewPanel/{ViewPanelViewModel.vb => ViewPanelVM.vb} (86%) rename StatusBar/{StatusBarView.xaml => StatusBarV.xaml} (95%) rename StatusBar/{StatusBarView.xaml.vb => StatusBarV.xaml.vb} (100%) rename StatusBar/{StatusBarViewModel.vb => StatusBarVM.vb} (87%) diff --git a/AboutBoxWindow/AboutBoxView.xaml b/AboutBoxWindow/AboutBoxV.xaml similarity index 96% rename from AboutBoxWindow/AboutBoxView.xaml rename to AboutBoxWindow/AboutBoxV.xaml index 1b63673..8114129 100644 --- a/AboutBoxWindow/AboutBoxView.xaml +++ b/AboutBoxWindow/AboutBoxV.xaml @@ -1,4 +1,4 @@ - 0 Then + ' per saltare la riga che è stata appena restituita che contiene "---" + Line += 1 + End If + Part.ReadDDFPartDoor(FileContent, Line, Local_Door) + Dim DoorPiece As String = Local_Door.TypePart + ' per eliminare lo swing associato al jamb FL_L --> FL_ + If Not IsNothing(DoorPiece) Then + If DoorPiece.Count > 3 AndAlso DoorPiece.Contains("F") Then + DoorPiece = DoorPiece.Remove(3) + End If + Map.refCompoPanelVM.GoBackVisibility = Visibility.Visible + Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nAssemblyPage + Else + ' significa che stiamo per leggere una posrta singola + Local_Door.IsNotAssembly = True + Local_PartDoor.Door = Local_Door + Local_PartDoor.Door.SwingTypeList = m_SwingTypeListSinlgeDoor + Local_PartDoor.SetIsChecked(Local_Door.IsActive) + SetArrayPartDoor(Local_PartDoor, 0) + DdfFile.WriteDDFPart(GetArrayPartDoor(0).Door, IniFile.m_sTempDir & "\" & TEMP_FILE, True, False) + ExecDoors(Map.refSceneManagerVM.ProjectScene, IniFile.m_sTempDir & "\" & TEMP_FILE) + Map.refPartPageVM.CurrPart = Local_Door + Map.refCompoPanelVM.GoBackVisibility = Visibility.Collapsed + Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nDDFPage + Exit While + End If + + Select Case DoorPiece + Case "DO_1" + Local_PartDoor.Door = Local_Door + Local_PartDoor.Door.SwingTypeList = m_SwingTypeListSinlgeDoor + Local_PartDoor.SetIsChecked(Local_Door.IsActive) + SetArrayPartDoor(Local_PartDoor, 0) + Case "DO_2" + Local_PartDoor.Door = Local_Door + Local_PartDoor.Door.SwingTypeList = m_SwingTypeListRightDoor + GetArrayPartDoor(0).Door.SwingTypeList = m_SwingTypeListLeftDoor + Local_PartDoor.SetIsChecked(Local_Door.IsActive) + SetArrayPartDoor(Local_PartDoor, 1) + Case "DO_3" + Local_PartDoor.Door = Local_Door + Local_PartDoor.SetIsChecked(Local_Door.IsActive) + SetArrayPartDoor(Local_PartDoor, 2) + Case "DO_5" + Local_PartDoor.Door = Local_Door + Local_PartDoor.SetIsChecked(Local_Door.IsActive) + SetArrayPartDoor(Local_PartDoor, 3) + Case "DO_4" + Local_PartDoor.Door = Local_Door + Local_PartDoor.SetIsChecked(Local_Door.IsActive) + SetArrayPartDoor(Local_PartDoor, 4) + Case "DO_6" + Local_PartDoor.Door = Local_Door + Local_PartDoor.SetIsChecked(Local_Door.IsActive) + SetArrayPartDoor(Local_PartDoor, 5) + Case "FL_" + Local_Door.SwingTypeList = m_SwingTypeList + m_LeftJamb = Local_Door + Case "FR_" + Local_Door.SwingTypeList = m_SwingTypeList + m_RightJamb = Local_Door + Case "FT_" + Local_Door.SwingTypeList = m_SwingTypeList + m_TopJamb = Local_Door + Case "FB_" + Local_Door.SwingTypeList = m_SwingTypeList + m_BottomJamb = Local_Door + If Not m_Exterior Then + m_BottomJamb.IsActive = False + End If + End Select + '' End If + '' End If + ''Next + End While + DoorVisibility() + MatchCompo() + Return 1 + End Function + + Public Sub MatchCompo() + For IndexDoor As Integer = 0 To CInt(DoorNumber) - 1 + ResearchMatchJamb(GetArrayPartDoor(IndexDoor).Door, Map.refAssemblyPageVM.CurrAssembly.LeftJamb) + ResearchMatchJamb(GetArrayPartDoor(IndexDoor).Door, Map.refAssemblyPageVM.CurrAssembly.RightJamb) + ResearchMatchJamb(GetArrayPartDoor(IndexDoor).Door, Map.refAssemblyPageVM.CurrAssembly.TopJamb) + ResearchMatchJamb(GetArrayPartDoor(IndexDoor).Door, Map.refAssemblyPageVM.CurrAssembly.BottomJamb) + Next + If CInt(DoorNumber) > 1 Then + ResearchMatchDoor(GetArrayPartDoor(0).Door, GetArrayPartDoor(1).Door) + ResearchMatchDoor(GetArrayPartDoor(1).Door, GetArrayPartDoor(0).Door) + End If + End Sub + + Private Sub ResearchMatchJamb(Door As Part, Jamb As Part) + For IndexCompo As Integer = 0 To Door.CompoList.Count - 1 + If Not String.IsNullOrEmpty(Door.CompoList(IndexCompo).IdCode) Then + For IndexCompoJamb As Integer = 0 To Jamb.CompoList.Count - 1 + If Jamb.CompoList(IndexCompoJamb).IdCode = Door.CompoList(IndexCompo).IdCode Then + Door.CompoList(IndexCompo).refJambCompo = Jamb.CompoList(IndexCompoJamb) + Door.CompoList(IndexCompo).refJambCompo.IsReadOnly = False + Door.CompoList(IndexCompo).IsReadOnly = True + If Not File.Exists(Door.CompoList(IndexCompo).CompoType.Path & "\" & "Matching.lua") Then + EgtOutLog("SetUp error: SetUp configuration file (" & Door.CompoList(IndexCompo).CompoType.Path & "\" & "Matching.lua)" & " doesn't exist ") + 'MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 7), EgtMsg(MSG_SETUPERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error) + 'Return False + Else + EgtLuaExecFile(Door.CompoList(IndexCompo).CompoType.Path & "\" & "Matching.lua") + ' avendo il nome del file sicuramente apro quello delle cernieree quindi non devo fare altre ricerche o associazioni + EgtLuaSetGlobIntVar("STU.DoorNumber", CInt(Map.refAssemblyPageVM.CurrAssembly.DoorNumber)) + EgtLuaSetGlobStringVar("STU.CompoPath", Door.CompoList(IndexCompo).CompoType.Path) + EgtLuaSetGlobStringVar("STU.Template", Door.CompoList(IndexCompo).TemplateSelItem) + For IndexParam As Integer = 0 To Door.CompoList(IndexCompo).refJambCompo.CompoParamList.Count - 1 + If TypeOf Door.CompoList(IndexCompo).refJambCompo.CompoParamList(IndexParam) Is TextBoxParam Then + EgtLuaSetGlobStringVar("STU.InParamName", DirectCast(Door.CompoList(IndexCompo).refJambCompo.CompoParamList(IndexParam), TextBoxParam).DDFName) + EgtLuaCallFunction("STU.VisibilityParam") + EgtLuaGetGlobBoolVar("STU.IsEnable", DirectCast(Door.CompoList(IndexCompo).refJambCompo.CompoParamList(IndexParam), TextBoxParam).IsReadOnly) + DirectCast(Door.CompoList(IndexCompo).CompoParamList(IndexParam), TextBoxParam).IsReadOnly = True + ElseIf TypeOf Door.CompoList(IndexCompo).refJambCompo.CompoParamList(IndexParam) Is TextBoxOnOffParam Then + EgtLuaSetGlobStringVar("STU.InParamName", DirectCast(Door.CompoList(IndexCompo).refJambCompo.CompoParamList(IndexParam), TextBoxOnOffParam).DDFName) + EgtLuaCallFunction("STU.VisibilityParam") + EgtLuaGetGlobBoolVar("STU.IsEnable", DirectCast(Door.CompoList(IndexCompo).refJambCompo.CompoParamList(IndexParam), TextBoxOnOffParam).IsReadOnly) + DirectCast(Door.CompoList(IndexCompo).CompoParamList(IndexParam), TextBoxOnOffParam).IsReadOnly = True + ElseIf TypeOf Door.CompoList(IndexCompo).refJambCompo.CompoParamList(IndexParam) Is ComboBoxParam Then + EgtLuaSetGlobStringVar("STU.InParamName", DirectCast(Door.CompoList(IndexCompo).refJambCompo.CompoParamList(IndexParam), ComboBoxParam).DDFName) + EgtLuaCallFunction("STU.VisibilityParam") + EgtLuaGetGlobBoolVar("STU.IsEnable", DirectCast(Door.CompoList(IndexCompo).refJambCompo.CompoParamList(IndexParam), ComboBoxParam).IsReadOnly) + DirectCast(Door.CompoList(IndexCompo).CompoParamList(IndexParam), ComboBoxParam).IsReadOnly = True + End If + Next + Exit For + EgtLuaResetGlobVar("STU") + End If + End If + Next + Else + Door.CompoList(IndexCompo).IsReadOnly = True + End If + Next + End Sub + + Private Sub ResearchMatchDoor(DoorActive As Part, DoorInactive As Part) + If Not DoorActive.Swing.Contains("I") Then + For IndexCompo As Integer = 0 To DoorActive.CompoList.Count - 1 + If Not String.IsNullOrEmpty(DoorActive.CompoList(IndexCompo).IdCode) Then + For IndexCompoLeftJamb As Integer = 0 To DoorInactive.CompoList.Count - 1 + If DoorInactive.CompoList(IndexCompoLeftJamb).IdCode = DoorActive.CompoList(IndexCompo).IdCode Then + DoorActive.CompoList(IndexCompo).refJambCompo = DoorInactive.CompoList(IndexCompoLeftJamb) + DoorActive.CompoList(IndexCompo).refJambCompo.IsReadOnly = True + DoorActive.CompoList(IndexCompo).IsReadOnly = True + If Not File.Exists(DoorActive.CompoList(IndexCompo).CompoType.Path & "\" & "Matching.lua") Then + EgtOutLog("SetUp error: SetUp configuration file (" & DoorActive.CompoList(IndexCompo).CompoType.Path & "\" & "Matching.lua)" & " doesn't exist ") + 'MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 7), EgtMsg(MSG_SETUPERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error) + 'Return False + Else + EgtLuaExecFile(DoorActive.CompoList(IndexCompo).CompoType.Path & "\" & "Matching.lua") + ' avendo il nome del file sicuramente apro quello delle cernieree quindi non devo fare altre ricerche o associazioni + EgtLuaSetGlobIntVar("STU.DoorNumber", CInt(Map.refAssemblyPageVM.CurrAssembly.DoorNumber)) + EgtLuaSetGlobStringVar("STU.CompoPath", DoorActive.CompoList(IndexCompo).CompoType.Path) + EgtLuaSetGlobStringVar("STU.Template", DoorActive.CompoList(IndexCompo).TemplateSelItem) + EgtLuaCallFunction("STU.VisibilityParam") + For IndexParam As Integer = 0 To DoorActive.CompoList(IndexCompo).refJambCompo.CompoParamList.Count - 1 + If TypeOf DoorActive.CompoList(IndexCompo).refJambCompo.CompoParamList(IndexParam) Is TextBoxParam Then + EgtLuaSetGlobStringVar("STU.InParamName", DirectCast(DoorActive.CompoList(IndexCompo).refJambCompo.CompoParamList(IndexParam), TextBoxParam).DDFName) + EgtLuaGetGlobBoolVar("STU.IsEnable", DirectCast(DoorActive.CompoList(IndexCompo).refJambCompo.CompoParamList(IndexParam), TextBoxParam).IsReadOnly) + DirectCast(DoorActive.CompoList(IndexCompo).CompoParamList(IndexParam), TextBoxParam).IsReadOnly = True + ElseIf TypeOf DoorActive.CompoList(IndexCompo).refJambCompo.CompoParamList(IndexParam) Is TextBoxOnOffParam Then + EgtLuaSetGlobStringVar("STU.InParamName", DirectCast(DoorActive.CompoList(IndexCompo).refJambCompo.CompoParamList(IndexParam), TextBoxOnOffParam).DDFName) + EgtLuaGetGlobBoolVar("STU.IsEnable", DirectCast(DoorActive.CompoList(IndexCompo).refJambCompo.CompoParamList(IndexParam), TextBoxOnOffParam).IsReadOnly) + DirectCast(DoorActive.CompoList(IndexCompo).CompoParamList(IndexParam), TextBoxOnOffParam).IsReadOnly = True + ElseIf TypeOf DoorActive.CompoList(IndexCompo).refJambCompo.CompoParamList(IndexParam) Is ComboBoxParam Then + EgtLuaSetGlobStringVar("STU.InParamName", DirectCast(DoorActive.CompoList(IndexCompo).refJambCompo.CompoParamList(IndexParam), ComboBoxParam).DDFName) + EgtLuaGetGlobBoolVar("STU.IsEnable", DirectCast(DoorActive.CompoList(IndexCompo).refJambCompo.CompoParamList(IndexParam), ComboBoxParam).IsReadOnly) + DirectCast(DoorActive.CompoList(IndexCompo).CompoParamList(IndexParam), ComboBoxParam).IsReadOnly = True + End If + Next + Exit For + EgtLuaResetGlobVar("STU") + End If + End If + Next + Else + DoorActive.CompoList(IndexCompo).IsReadOnly = True + End If + Next + End If + + End Sub + ' Agiorna IsVisible delle porte contenute nell'ArrayPartDoor + Public Sub DoorVisibility() + ' aggiorno la visibilità delle porte senza però modificare la dimensione dei Jamb caricati + For Index As Integer = 0 To CInt(m_DoorNumber) - 1 + If Not IsNothing(m_ArrayPartDoor(Index)) Then + m_ArrayPartDoor(Index).IsVisible = Visibility.Visible + m_ArrayPartDoor(Index).NotifyPropertyChanged("IsVisible") + End If + Next + For Index As Integer = CInt(m_DoorNumber) To K_DOORNUMBER + If Not IsNothing(m_ArrayPartDoor(Index)) Then + m_ArrayPartDoor(Index).IsVisible = Visibility.Collapsed + m_ArrayPartDoor(Index).NotifyPropertyChanged("IsVisible") + End If + Next + If m_DoorNumber = "1" Then + OneDoorProperty = True + Else + OneDoorProperty = False + End If + NotifyPropertyChanged("CurrAssembly") + End Sub +#End Region ' Lettura Assemblato + +#Region "RULES ASSEMBLY" + Public Function LoadModuleParam(CurrCompo As Compo) As Boolean + Dim bExterior As Boolean = Exterior + Dim dThicknessDoor As Double + Dim dThicknessJamb As Double + StringToDouble(m_Thickness, dThicknessJamb) + Dim dDeltaT As Double + StringToDouble(m_DeltaThickness, dDeltaT) + Dim dThicknessHead As Double + StringToDouble(m_ThicknessHead, dThicknessHead) + Dim dLightUp As Double + StringToDouble(m_LightUp, dLightUp) + Dim dLightBottom As Double + StringToDouble(m_LightBottom, dLightBottom) + Dim dLightHinge As Double + StringToDouble(m_LightHinge, dLightHinge) + Dim dLightLock As Double + StringToDouble(m_LightLock, dLightLock) + Dim dOverlapHinge As Double + StringToDouble(m_OverlapHinge, dOverlapHinge) + Dim dOverlapLock As Double + StringToDouble(m_OverlapLock, dOverlapLock) + Dim dOverlapTop As Double + StringToDouble(m_OverlapTop, dOverlapTop) + If Not File.Exists(CurrCompo.CompoType.Path & "\" & "Matching.lua") Then + EgtOutLog("SetUp error: SetUp configuration file (" & CurrCompo.CompoType.Path & "\" & "Matching.lua)" & " doesn't exist ") + MessageBox.Show("Script Lua (" & CurrCompo.CompoType.Path & "\" & "Matching.lua" & ")has not been found", "Error", MessageBoxButton.OK, MessageBoxImage.Error) + Return False + Else + EgtLuaExecFile(CurrCompo.CompoType.Path & "\" & "Matching.lua") + EgtLuaSetGlobBoolVar("STU.Exterior", bExterior) + EgtLuaSetGlobIntVar("STU.DoorNumber", CInt(Map.refAssemblyPageVM.CurrAssembly.DoorNumber)) + EgtLuaSetGlobStringVar("STU.CompoPath", CurrCompo.CompoType.Path) + 'EgtLuaSetGlobStringVar("STU.CompoName", CurrCompo.CompoType.DDFName) + EgtLuaSetGlobStringVar("STU.Template", CurrCompo.refJambCompo.TemplateSelItem) + EgtLuaSetGlobStringVar("STU.OutParamValue", "0") + 'paramStri dell'assemblato + EgtLuaSetGlobNumVar("STU.LightUp", dLightUp) + EgtLuaSetGlobNumVar("STU.LightBottom", dLightBottom) + EgtLuaSetGlobNumVar("STU.LightHinge", dLightHinge) + EgtLuaSetGlobNumVar("STU.LightLock", dLightLock) + EgtLuaSetGlobNumVar("STU.OverlapHinge", dOverlapHinge) + EgtLuaSetGlobNumVar("STU.OverlapLock", dOverlapLock) + EgtLuaSetGlobNumVar("STU.OverlapTop", dOverlapTop) + EgtLuaSetGlobNumVar("STU.ThicknessHead", dThicknessHead) + EgtLuaSetGlobNumVar("STU.ThicknessJamb", dThicknessJamb) + EgtLuaSetGlobNumVar("STU.DeltaThickness", dDeltaT) + If Not IsNothing(Map.refPartPageVM.CurrPart) Then + StringToDouble(Map.refPartPageVM.CurrPart.Thickness, dThicknessDoor) + EgtLuaSetGlobNumVar("STU.ThicknessDoor", dThicknessDoor) + ElseIf ArrayPartDoor.Count > 0 Then + StringToDouble(GetArrayPartDoor(0).Door.Thickness, dThicknessDoor) + EgtLuaSetGlobNumVar("STU.ThicknessDoor", dThicknessDoor) + End If + Return True + End If + End Function + + ' è chaimata ogni volta che viene modificato un parametro del general dell'assemblato + Public Sub UpDateAllCompo() + Dim IdexDoorNumber As Integer = 0 + If CInt(m_DoorNumber) > ArrayPartDoor.Count Then + IdexDoorNumber = ArrayPartDoor.Count + ElseIf CInt(m_DoorNumber) < ArrayPartDoor.Count Or CInt(m_DoorNumber) = ArrayPartDoor.Count Then + IdexDoorNumber = CInt(m_DoorNumber) + End If + + Select Case IdexDoorNumber + Case 1 + For IndexDoor As Integer = 0 To IdexDoorNumber - 1 + For IndexCompo As Integer = 0 To GetArrayPartDoor(IndexDoor).Door.CompoList.Count - 1 + If Not IsNothing(GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).refJambCompo) Then + LoadModuleParam(GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo)) + UpDateCurrCompoJamb(GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo)) + End If + Next + Next + Case 2 + For IndexDoor As Integer = 0 To IdexDoorNumber - 1 + For IndexCompo As Integer = 0 To GetArrayPartDoor(IndexDoor).Door.CompoList.Count - 1 + If Not IsNothing(GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).refJambCompo) Then + LoadModuleParam(GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo)) + Select Case GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).refJambCompo.CompoType.JambSide + Case "Hinge" + UpDateCurrCompoJamb(GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo)) + Case "Lock" + UpDateCurrCompoJamb(GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo)) + End Select + + End If + Next + Next + End Select + End Sub + + Public Sub UpDateCurrCompoJamb(ByRef CurrCompo As Compo) + If Not IsNothing(CurrCompo.refJambCompo) AndAlso CurrCompo.refJambCompo.CompoParamList.Count = CurrCompo.CompoParamList.Count Then + LoadModuleParam(CurrCompo) + CurrCompo.refJambCompo.IsReadOnly = False + '-------------------------------------------------------------------------------------------------------------------------------------------------------------- + ' devo distinguere il caso della componente sulla porta o sul jamb + For IndexParam As Integer = 0 To CurrCompo.refJambCompo.CompoParamList.Count - 1 + 'ParamFunction.ParamName = CurrCompo.refJambCompo.CompoParamList(IndexParam).DDFName + If TypeOf CurrCompo.refJambCompo.CompoParamList(IndexParam) Is TextBoxParam AndAlso CurrCompo.CompoParamList(IndexParam).DDFName = CurrCompo.refJambCompo.CompoParamList(IndexParam).DDFName Then + Dim x = EgtLuaSetGlobStringVar("STU.InParamName", DirectCast(CurrCompo.CompoParamList(IndexParam), TextBoxParam).DDFName) + 'If EgtLuaCallFunction("STU.CalcParam") Then + Dim dInParamValue As Double + StringToDouble(DirectCast(CurrCompo.CompoParamList(IndexParam), TextBoxParam).m_Value, dInParamValue) + EgtLuaSetGlobNumVar("STU.InParamValue", dInParamValue) + x = EgtLuaCallFunction("STU.CalcParam") + Dim sVal As String = String.Empty + EgtLuaGetGlobStringVar("STU.OutParamValue", sVal) + DirectCast(CurrCompo.refJambCompo.CompoParamList(IndexParam), TextBoxParam).SetValue(CStr(sVal)) + EgtLuaGetGlobBoolVar("STU.IsEnable", DirectCast(CurrCompo.refJambCompo.CompoParamList(IndexParam), TextBoxParam).IsReadOnly) + 'End If + ElseIf TypeOf CurrCompo.refJambCompo.CompoParamList(IndexParam) Is ComboBoxParam AndAlso CurrCompo.CompoParamList(IndexParam).DDFName = CurrCompo.refJambCompo.CompoParamList(IndexParam).DDFName Then + DirectCast(CurrCompo.refJambCompo.CompoParamList(IndexParam), ComboBoxParam).IsReadOnly = False + ElseIf TypeOf CurrCompo.refJambCompo.CompoParamList(IndexParam) Is TextBoxOnOffParam AndAlso CurrCompo.CompoParamList(IndexParam).DDFName = CurrCompo.refJambCompo.CompoParamList(IndexParam).DDFName Then + EgtLuaSetGlobStringVar("STU.InParamName", DirectCast(CurrCompo.CompoParamList(IndexParam), TextBoxOnOffParam).DDFName) + If EgtLuaCallFunction("STU.CalcParam") Then + Dim sVal As String = String.Empty + EgtLuaSetGlobStringVar("STU.InParamValue", DirectCast(CurrCompo.CompoParamList(IndexParam), TextBoxOnOffParam).m_Value) + EgtLuaGetGlobStringVar("STU.OutParamValue", sVal) + DirectCast(CurrCompo.refJambCompo.CompoParamList(IndexParam), TextBoxOnOffParam).SetValue(CStr(sVal)) + EgtLuaGetGlobBoolVar("STU.IsEnable", DirectCast(CurrCompo.refJambCompo.CompoParamList(IndexParam), TextBoxOnOffParam).IsReadOnly) + End If + End If + Next + '-------------------------------------------------------------------------------------------------------------------------------------------------------------- + + Else + MessageBox.Show("Error in matching component in jamb, the compo on the jamb will not be modify", "Caution Matching", MessageBoxButton.OK, MessageBoxImage.Warning) + End If + EgtLuaResetGlobVar("STU") + End Sub + + 'Public Sub UpDateCurrCompoDoor(ByRef CurrCompo As Compo) + ' If Not IsNothing(CurrCompo.refJambCompo) AndAlso CurrCompo.refJambCompo.CompoParamList.Count = CurrCompo.CompoParamList.Count Then + ' LoadModuleParam(CurrCompo) + ' For IndexParam As Integer = 0 To CurrCompo.refJambCompo.CompoParamList.Count - 1 + ' ParamFunction.ParamName = CurrCompo.refJambCompo.CompoParamList(IndexParam).DDFName + ' If TypeOf CurrCompo.refJambCompo.CompoParamList(IndexParam) Is TextBoxParam AndAlso CurrCompo.CompoParamList(IndexParam).DDFName = CurrCompo.refJambCompo.CompoParamList(IndexParam).DDFName Then + ' DirectCast(CurrCompo.refJambCompo.CompoParamList(IndexParam), TextBoxParam).SetValue(DirectCast(CurrCompo.CompoParamList(IndexParam), TextBoxParam).m_Value) + ' ElseIf TypeOf CurrCompo.refJambCompo.CompoParamList(IndexParam) Is TextBoxOnOffParam AndAlso CurrCompo.CompoParamList(IndexParam).DDFName = CurrCompo.refJambCompo.CompoParamList(IndexParam).DDFName Then + ' DirectCast(CurrCompo.refJambCompo.CompoParamList(IndexParam), TextBoxOnOffParam).SetValue(DirectCast(CurrCompo.CompoParamList(IndexParam), TextBoxOnOffParam).m_Value) + ' End If + ' Next + ' Else + ' MessageBox.Show("Error in matching component in jamb, the compo on the jamb will not be modify", "Caution Matching", MessageBoxButton.OK, MessageBoxImage.Warning) + ' End If + 'End Sub + + ' calcola la giusta lista di swing per ogni porta e ricalcolo la dimensione dei Jamb Top e Bottom (width) + Public Sub DoorVisibilityNew() + ' definisco gli swing riferiti ai Jamb e quindi anche i nomi da associare alle porte durante la creazione di una nuova porta + Dim bInvertDoor As Boolean = False + Dim AppPartDoor As New PartDoor + Select Case DoorNumber + Case "1" ' passaggio da due porte ad una porta + OneDoorProperty = True + ' inverto la posizioned delle porte + If GetArrayPartDoor(0).Door.Swing.Contains("I") Then + AppPartDoor = GetArrayPartDoor(1) + SetArrayPartDoor(GetArrayPartDoor(0), 1) + SetArrayPartDoor(AppPartDoor, 0) + GetArrayPartDoor(0).Door.TypePart = "DO_1" + GetArrayPartDoor(0).NotifyPropertyChanged("Type") + GetArrayPartDoor(1).Door.TypePart = "DO_2" + GetArrayPartDoor(1).NotifyPropertyChanged("Type") + End If + ' leggo lo swing posseduto dalla prima porta (delle due quella attiva) e assegno il nuovo swing + GetArrayPartDoor(0).Door.SwingTypeList = OptionModule.m_SwingTypeListSinlgeDoor + If GetArrayPartDoor(0).Door.Swing.Contains("L") Then + If GetArrayPartDoor(0).Door.Swing.Contains("HR") Then + GetArrayPartDoor(0).Door.SetSwing(GetArrayPartDoor(0).Door.SwingTypeList(2)) + Else + GetArrayPartDoor(0).Door.SetSwing(GetArrayPartDoor(0).Door.SwingTypeList(0)) + End If + Else + If GetArrayPartDoor(0).Door.Swing.Contains("HR") Then + GetArrayPartDoor(0).Door.SetSwing(GetArrayPartDoor(0).Door.SwingTypeList(3)) + Else + GetArrayPartDoor(0).Door.SetSwing(GetArrayPartDoor(0).Door.SwingTypeList(1)) + End If + End If + '-------------------------------------------------------------------------------------------------------------------------------------------------------------- + ' Elimino tutti le componenti sul Jamb (che ora diventa di Tipo L) eliminando dalla porta due + For IndexDeleteCompo As Integer = GetArrayPartDoor(1).Door.CompoList.Count - 1 To 0 Step -1 + GetArrayPartDoor(1).Door.CompoList(IndexDeleteCompo).Delete() + Next + ' ricarico tutti i riferimenti della porta vecchia sul jamb + For IndexDeleteCompo As Integer = 0 To GetArrayPartDoor(0).Door.CompoList.Count - 1 + If Not IsNothing(GetArrayPartDoor(0).Door.CompoList(IndexDeleteCompo).refJambCompo) Then + + End If + Next + '-------------------------------------------------------------------------------------------------------------------------------------------------------------- + ' riassegno gli swing ai Jamb + LeftJamb.SetSwing(GetArrayPartDoor(0).Door.Swing) + TopJamb.SetSwing(GetArrayPartDoor(0).Door.Swing) + RightJamb.SetSwing(GetArrayPartDoor(0).Door.Swing) + BottomJamb.SetSwing(GetArrayPartDoor(0).Door.Swing) + If LeftJamb.Swing.Contains("L") Then + LeftJamb.TypePart = "FL_H" + RightJamb.TypePart = "FR_L" + Else + LeftJamb.TypePart = "FL_L" + RightJamb.TypePart = "FR_H" + End If + BottomJamb.TypePart = "FB_B" + TopJamb.TypePart = "FT_T" + NotifyPropertyChanged("CurrAssembly") + Case "2" ' passaggio da una porta a due porte + OneDoorProperty = False + If GetArrayPartDoor(0).Door.Swing.Contains("RH") Or GetArrayPartDoor(0).Door.Swing.Contains("RHR") Then bInvertDoor = True + HeightDoor(GetArrayPartDoor(0).Door.Height) + If bInvertDoor Then + AppPartDoor = GetArrayPartDoor(0) + SetArrayPartDoor(GetArrayPartDoor(1), 0) + SetArrayPartDoor(AppPartDoor, 1) + GetArrayPartDoor(0).Door.TypePart = "DO_1" + GetArrayPartDoor(0).Door.Code = "Door1" + GetArrayPartDoor(0).NotifyPropertyChanged("Type") + GetArrayPartDoor(1).Door.TypePart = "DO_2" + GetArrayPartDoor(0).Door.Code = "Door2" + GetArrayPartDoor(1).NotifyPropertyChanged("Type") + End If + GetArrayPartDoor(0).Door.SwingTypeList = OptionModule.m_SwingTypeListLeftDoor + GetArrayPartDoor(1).Door.SwingTypeList = OptionModule.m_SwingTypeListRightDoor + Dim IndexDoor As Integer = 0 + If bInvertDoor Then IndexDoor = 1 + + If GetArrayPartDoor(IndexDoor).Door.Swing.Contains("L") Then + If GetArrayPartDoor(IndexDoor).Door.Swing.Contains("HR") Then + 'assegno LHRA + GetArrayPartDoor(0).Door.SetSwing(GetArrayPartDoor(0).Door.SwingTypeList(1)) + GetArrayPartDoor(1).Door.SetSwing(GetArrayPartDoor(1).Door.SwingTypeList(1)) + ' elimino le compo dal Jamb destro + For IndexCompo As Integer = 0 To GetArrayPartDoor(0).Door.CompoList.Count - 1 + If GetArrayPartDoor(0).Door.CompoList(IndexCompo).CompoType.DDFName = "locks" Then + If Not IsNothing(GetArrayPartDoor(0).Door.CompoList(IndexCompo).refJambCompo) Then + Map.refPartPageVM.CurrPart = GetArrayPartDoor(0).Door + GetArrayPartDoor(0).Door.CompoList(IndexCompo).Delete() + End If + End If + Next + Else + 'assegno LHA + GetArrayPartDoor(0).Door.SetSwing(GetArrayPartDoor(0).Door.SwingTypeList(2)) + GetArrayPartDoor(1).Door.SetSwing(GetArrayPartDoor(1).Door.SwingTypeList(2)) + For IndexCompo As Integer = 0 To GetArrayPartDoor(0).Door.CompoList.Count - 1 + If GetArrayPartDoor(0).Door.CompoList(IndexCompo).CompoType.DDFName = "locks" Then + If Not IsNothing(GetArrayPartDoor(0).Door.CompoList(IndexCompo).refJambCompo) Then + Map.refPartPageVM.CurrPart = GetArrayPartDoor(0).Door + GetArrayPartDoor(0).Door.CompoList(IndexCompo).Delete() + End If + End If + Next + End If + Else + If GetArrayPartDoor(IndexDoor).Door.Swing.Contains("HR") Then + 'assegno RHRA + GetArrayPartDoor(0).Door.SetSwing(GetArrayPartDoor(0).Door.SwingTypeList(3)) + GetArrayPartDoor(1).Door.SetSwing(GetArrayPartDoor(1).Door.SwingTypeList(3)) + For IndexCompo As Integer = 0 To GetArrayPartDoor(1).Door.CompoList.Count - 1 + If GetArrayPartDoor(1).Door.CompoList(IndexCompo).CompoType.DDFName = "locks" Then + If Not IsNothing(GetArrayPartDoor(1).Door.CompoList(IndexCompo).refJambCompo) Then + Map.refPartPageVM.CurrPart = GetArrayPartDoor(0).Door + GetArrayPartDoor(1).Door.CompoList(IndexCompo).Delete() + End If + End If + Next + Else + 'assegno RHA + GetArrayPartDoor(0).Door.SetSwing(GetArrayPartDoor(0).Door.SwingTypeList(0)) + GetArrayPartDoor(1).Door.SetSwing(GetArrayPartDoor(1).Door.SwingTypeList(0)) + For IndexCompo As Integer = 0 To GetArrayPartDoor(0).Door.CompoList.Count - 1 + If GetArrayPartDoor(1).Door.CompoList(IndexCompo).CompoType.DDFName = "locks" Then + If Not IsNothing(GetArrayPartDoor(1).Door.CompoList(IndexCompo).refJambCompo) Then + Map.refPartPageVM.CurrPart = GetArrayPartDoor(0).Door + GetArrayPartDoor(1).Door.CompoList(IndexCompo).Delete() + End If + End If + Next + End If + End If + + LeftJamb.SetSwing(GetArrayPartDoor(0).Door.Swing) + TopJamb.SetSwing(GetArrayPartDoor(0).Door.Swing) + RightJamb.SetSwing(GetArrayPartDoor(1).Door.Swing) + BottomJamb.SetSwing(GetArrayPartDoor(1).Door.Swing) + LeftJamb.TypePart = "FL_H" + RightJamb.TypePart = "FR_H" + BottomJamb.TypePart = "FB_B" + TopJamb.TypePart = "FT_T" + NotifyPropertyChanged("CurrAssembly") + End Select + ' azzero le dimensioni appena create della porta + m_BottomJamb.SetWidth("0") + m_TopJamb.SetWidth("0") + For Index As Integer = 0 To CInt(m_DoorNumber) - 1 + If Not IsNothing(m_ArrayPartDoor(Index)) Then + m_ArrayPartDoor(Index).IsVisible = Visibility.Visible + WidthJamb(GetArrayPartDoor(Index).Door.Width) + m_ArrayPartDoor(Index).NotifyPropertyChanged("IsVisible") + m_ArrayPartDoor(Index).NotifyPropertyChanged("TypePart") + End If + Next + For Index As Integer = CInt(m_DoorNumber) To K_DOORNUMBER + If Not IsNothing(m_ArrayPartDoor(Index)) Then + m_ArrayPartDoor(Index).IsVisible = Visibility.Collapsed + m_ArrayPartDoor(Index).NotifyPropertyChanged("IsVisible") + m_ArrayPartDoor(Index).NotifyPropertyChanged("TypePart") + End If + Next + SetTopWidth() + End Sub + ' calcola l'altezza dei jamb Left e right data l'altezza della porta + Public Sub HeightJamb(HeighDoor As String) + Dim dLightUp As Double + Dim dLightBottom As Double + Dim dThicknessHead As Double + Dim dHeight As Double + Dim dOverlapTop As Double + Dim dThichknessJamb As Double + StringToDouble(Map.refAssemblyPageVM.CurrAssembly.LightUp, dLightUp) + StringToDouble(Map.refAssemblyPageVM.CurrAssembly.LightBottom, dLightBottom) + StringToDouble(Map.refAssemblyPageVM.CurrAssembly.ThicknessHead, dThicknessHead) + StringToDouble(HeighDoor, dHeight) + StringToDouble(Map.refAssemblyPageVM.CurrAssembly.OverlapTop, dOverlapTop) + StringToDouble(Map.refAssemblyPageVM.CurrAssembly.Width, dThichknessJamb) + ' se è exterior + If Map.refAssemblyPageVM.CurrAssembly.Exterior Then + Map.refAssemblyPageVM.CurrAssembly.LeftJamb.SetHeight(DoubleToString(dLightBottom + dThicknessHead + dHeight - dOverlapTop + dLightUp + dThichknessJamb, 4)) + Map.refAssemblyPageVM.CurrAssembly.RightJamb.SetHeight(DoubleToString(dLightBottom + dThicknessHead + dHeight - dOverlapTop + dLightUp + dThichknessJamb, 4)) + Else + Map.refAssemblyPageVM.CurrAssembly.LeftJamb.SetHeight(DoubleToString(dLightUp + dLightBottom + dThicknessHead + dHeight, 4)) + Map.refAssemblyPageVM.CurrAssembly.RightJamb.SetHeight(DoubleToString(dLightUp + dLightBottom + dThicknessHead + dHeight, 4)) + End If + End Sub + ' Ricalcola la dimensione di tutte le porte ricevendo come valore esterno la dimensione della porta modificata + Public Sub HeightDoor(HeighDoor As String) + For Index As Integer = 0 To m_ArrayPartDoor.Count - 1 + GetArrayPartDoor(Index).Door.SetHeight(HeighDoor) + Next + End Sub + ' questa funzione è chiamata durante la creazione di un nuovo assemblato, ogni volat che viene chiamta ricalcola la dimensione del TopJamb + Public Sub SetTopWidth() + ' azzero le dimensioni + m_BottomJamb.SetWidth("0") + m_TopJamb.SetWidth("0") + Dim IdexDoor As Integer = 0 + ' controllo che il numero di porte da aprire sia maggiore del numero di porte create + If CInt(m_DoorNumber) > ArrayPartDoor.Count Then + IdexDoor = ArrayPartDoor.Count + ElseIf CInt(m_DoorNumber) < ArrayPartDoor.Count Or CInt(m_DoorNumber) = ArrayPartDoor.Count Then + IdexDoor = CInt(m_DoorNumber) + End If + ' chiamo la funzione sotto per il calcolo del TopJamb + For Index As Integer = 0 To IdexDoor - 1 + WidthJamb(GetArrayPartDoor(Index).Door.Width) + Next + End Sub + ' passato come riferimento la larghezza della porta viene calcolata la dimensione dei Jamb Top e Bottom (per ricalcolare la dimensione opJamb.Width = "0") + Private Sub WidthJamb(WidthDoor As String) + Dim dLightHinge As Double + Dim dLightLock As Double + Dim dOverlapLock As Double + Dim dOverlapHinge As Double + Dim dWidth As Double + Dim dMinWidth As Double + ' la misura del TopJamb viene modificata nel ciclo for quindi passo la misura corrente + Dim dActualWidth As Double + StringToDouble(Map.refAssemblyPageVM.CurrAssembly.LightHinge, dLightHinge) + StringToDouble(Map.refAssemblyPageVM.CurrAssembly.LightLock, dLightLock) + StringToDouble(Map.refAssemblyPageVM.CurrAssembly.OverlapLock, dOverlapLock) + StringToDouble(Map.refAssemblyPageVM.CurrAssembly.OverlapHinge, dOverlapHinge) + StringToDouble(WidthDoor, dWidth) + StringToDouble(Map.refAssemblyPageVM.CurrAssembly.TopJamb.Width, dActualWidth) + If Exterior Then + dMinWidth = dLightHinge + dLightLock + Else + dMinWidth = dLightHinge + dLightLock + dOverlapLock + dOverlapHinge + End If + ' se la finzione è chiama per la prima volta (cioè è nel primo ciclo) allora le misure sono nulle (=0) + If dActualWidth = 0 Then + Map.refAssemblyPageVM.CurrAssembly.TopJamb.SetWidth(DoubleToString(dMinWidth + dWidth, 4)) + Map.refAssemblyPageVM.CurrAssembly.BottomJamb.SetWidth(DoubleToString(dMinWidth + dWidth, 4)) + Else + ' se una porta è già stata chiamata allora modifico i parametri + If Exterior Then + Map.refAssemblyPageVM.CurrAssembly.TopJamb.SetWidth(DoubleToString(dWidth + dLightHinge + dActualWidth, 4)) + Map.refAssemblyPageVM.CurrAssembly.BottomJamb.SetWidth(DoubleToString(dWidth + dLightHinge + dActualWidth, 4)) + Else + Map.refAssemblyPageVM.CurrAssembly.TopJamb.SetWidth(DoubleToString(dWidth + dActualWidth + dLightHinge - dOverlapLock + dOverlapHinge, 4)) + Map.refAssemblyPageVM.CurrAssembly.BottomJamb.SetWidth(DoubleToString(dWidth + dActualWidth + dLightHinge - dOverlapLock + dOverlapHinge, 4)) + End If + End If + End Sub + ' calcola la dimensione spessore dei Jamb (per tutti lo stesso) + Public Sub SetThicKnessJamb() + m_BottomJamb.SetThickness(m_Thickness) + m_TopJamb.SetThickness(m_Thickness) + m_LeftJamb.SetThickness(m_Thickness) + m_RightJamb.SetThickness(m_Thickness) + End Sub + ' questa funzione può essere richiamata solo dopo che sono state create tutte le porte! + Private Sub TopBottomWidth() + Dim dLightHinge As Double + Dim dLightLock As Double + Dim dOverlapLock As Double + Dim dOverlapHinge As Double + Dim dWidth0 As Double + Dim dWidth1 As Double + Dim dActualWidth As Double + StringToDouble(Map.refAssemblyPageVM.CurrAssembly.LightHinge, dLightHinge) + StringToDouble(Map.refAssemblyPageVM.CurrAssembly.LightLock, dLightLock) + StringToDouble(Map.refAssemblyPageVM.CurrAssembly.OverlapLock, dOverlapLock) + StringToDouble(Map.refAssemblyPageVM.CurrAssembly.OverlapHinge, dOverlapHinge) + Select Case DoorNumber + Case "1" + If Exterior Then + StringToDouble(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(0).Door.Width, dWidth0) + dActualWidth = dLightHinge + dLightLock + Map.refAssemblyPageVM.CurrAssembly.TopJamb.SetWidth(DoubleToString(dWidth0 + dActualWidth, 4)) + Map.refAssemblyPageVM.CurrAssembly.BottomJamb.SetWidth(DoubleToString(dWidth0 + dActualWidth, 4)) + Else + StringToDouble(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(0).Door.Width, dWidth0) + dActualWidth = dLightHinge + dLightLock + dOverlapLock + dOverlapHinge + Map.refAssemblyPageVM.CurrAssembly.TopJamb.SetWidth(DoubleToString(dWidth0 + dActualWidth, 4)) + Map.refAssemblyPageVM.CurrAssembly.BottomJamb.SetWidth(DoubleToString(dWidth0 + dActualWidth, 4)) + End If + Case "2" + StringToDouble(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(0).Door.Width, dWidth0) + StringToDouble(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(1).Door.Width, dWidth1) + If Exterior Then + dActualWidth = dLightHinge + dLightHinge + dLightLock + dWidth0 + Map.refAssemblyPageVM.CurrAssembly.TopJamb.SetWidth(DoubleToString(dWidth1 + dActualWidth, 4)) + Map.refAssemblyPageVM.CurrAssembly.BottomJamb.SetWidth(DoubleToString(dWidth1 + dActualWidth, 4)) + Else + dActualWidth = dLightHinge + dLightHinge + dLightLock + dOverlapHinge + dOverlapHinge + dWidth0 + Map.refAssemblyPageVM.CurrAssembly.TopJamb.SetWidth(DoubleToString(dWidth1 + dActualWidth, 4)) + Map.refAssemblyPageVM.CurrAssembly.BottomJamb.SetWidth(DoubleToString(dWidth1 + dActualWidth, 4)) + End If + End Select + End Sub + ' dimensione gli spessori dei Jamb (l'unico diverso dagli altri è quello top) + Public Sub SetWidthJamb() + m_BottomJamb.SetHeight(m_Width) + m_TopJamb.SetHeight(m_ThicknessHead) + m_LeftJamb.SetWidth(m_Width) + m_RightJamb.SetWidth(m_Width) + End Sub + ' ricalcola il valore degli swing dalla modifica dello swing della porta + Public Sub UpdateSwing(sSwing As String) + Dim bInvertDoor As Boolean = False + Select Case DoorNumber + Case "1" + ' aggiorno l'elenco dello swing della porta + GetArrayPartDoor(0).Door.SwingTypeList = OptionModule.m_SwingTypeListSinlgeDoor + GetArrayPartDoor(0).Door.SetSwing(GetArrayPartDoor(0).Door.SwingTypeList(GetArrayPartDoor(0).Door.SwingTypeList.IndexOf(sSwing))) + ' aggiorno gli swing sui Jamb (tutti hanno lo stesso swing) + If m_LeftJamb.Swing.Contains("L") AndAlso Not sSwing.Contains("L") Then + Dim JambAppo As Part + JambAppo = m_LeftJamb + m_LeftJamb = m_RightJamb + m_RightJamb = JambAppo + ElseIf Not m_LeftJamb.Swing.Contains("L") AndAlso sSwing.Contains("L") Then + Dim JambAppo As Part + JambAppo = m_LeftJamb + m_LeftJamb = m_RightJamb + m_RightJamb = JambAppo + End If + LeftJamb.SetSwing(GetArrayPartDoor(0).Door.Swing) + TopJamb.SetSwing(GetArrayPartDoor(0).Door.Swing) + RightJamb.SetSwing(GetArrayPartDoor(0).Door.Swing) + BottomJamb.SetSwing(GetArrayPartDoor(0).Door.Swing) + If Map.refAssemblyPageVM.CurrAssembly.Exterior Then + If LeftJamb.Swing.Contains("L") Then + LeftJamb.TypePart = "FL_HE" + RightJamb.TypePart = "FR_LE" + Else + LeftJamb.TypePart = "FL_LE" + RightJamb.TypePart = "FR_HE" + End If + BottomJamb.TypePart = "FB_BE" + TopJamb.TypePart = "FT_TE" + Else + If LeftJamb.Swing.Contains("L") Then + LeftJamb.TypePart = "FL_H" + RightJamb.TypePart = "FR_L" + Else + LeftJamb.TypePart = "FL_L" + RightJamb.TypePart = "FR_H" + End If + BottomJamb.TypePart = "FB_B" + TopJamb.TypePart = "FT_T" + End If + + NotifyPropertyChanged("CurrAssembly") + + Case "2" + GetArrayPartDoor(0).Door.SwingTypeList = OptionModule.m_SwingTypeListLeftDoor + GetArrayPartDoor(1).Door.SwingTypeList = OptionModule.m_SwingTypeListRightDoor + ' ricerco all'interno dell'elenco l'indice associaro allo swing cercato ->GetArrayPartDoor(0).Door.SwingTypeList.IndexOf(sSwing) + Dim IndexSwing As Integer + If sSwing.Contains("L") Then + IndexSwing = GetArrayPartDoor(0).Door.SwingTypeList.IndexOf(sSwing) + Else + IndexSwing = GetArrayPartDoor(1).Door.SwingTypeList.IndexOf(sSwing) + End If + GetArrayPartDoor(0).Door.SetSwing(GetArrayPartDoor(0).Door.SwingTypeList(IndexSwing)) + GetArrayPartDoor(1).Door.SetSwing(GetArrayPartDoor(1).Door.SwingTypeList(IndexSwing)) + LeftJamb.SetSwing(GetArrayPartDoor(0).Door.Swing) + TopJamb.SetSwing(GetArrayPartDoor(0).Door.Swing) + RightJamb.SetSwing(GetArrayPartDoor(1).Door.Swing) + BottomJamb.SetSwing(GetArrayPartDoor(1).Door.Swing) + If Map.refAssemblyPageVM.CurrAssembly.Exterior Then + LeftJamb.TypePart = "FL_HE" + RightJamb.TypePart = "FR_HE" + BottomJamb.TypePart = "FB_BE" + TopJamb.TypePart = "FT_TE" + Else + LeftJamb.TypePart = "FL_H" + RightJamb.TypePart = "FR_H" + BottomJamb.TypePart = "FB_B" + TopJamb.TypePart = "FT_T" + End If + + NotifyPropertyChanged("CurrAssembly") + End Select + End Sub + + ' clacola il rabbet sul profilo top dei Jamb (quindi solo su quelli laterali) + Public Sub TopRabbetJamb() + Dim sThicknessHead As String = Map.refAssemblyPageVM.CurrAssembly.ThicknessHead + Dim sOverlapHinge As String = Map.refAssemblyPageVM.CurrAssembly.OverlapHinge + Dim sOverLapLock As String = Map.refAssemblyPageVM.CurrAssembly.OverlapLock + Dim sLightUp As String = Map.refAssemblyPageVM.CurrAssembly.LightUp + Select Case DoorNumber + Case "1" + If Not m_LeftJamb.Swing.Contains("L") Then + SetRabbetJamb(Map.refAssemblyPageVM.CurrAssembly.LeftJamb, sThicknessHead, sOverLapLock, sLightUp) + SetRabbetJamb(Map.refAssemblyPageVM.CurrAssembly.RightJamb, sThicknessHead, sOverlapHinge, sLightUp) + Else + SetRabbetJamb(Map.refAssemblyPageVM.CurrAssembly.LeftJamb, sThicknessHead, sOverlapHinge, sLightUp) + SetRabbetJamb(Map.refAssemblyPageVM.CurrAssembly.RightJamb, sThicknessHead, sOverLapLock, sLightUp) + End If + Case "2" + SetRabbetJamb(Map.refAssemblyPageVM.CurrAssembly.LeftJamb, sThicknessHead, sOverlapHinge, sLightUp) + SetRabbetJamb(Map.refAssemblyPageVM.CurrAssembly.RightJamb, sThicknessHead, sOverlapHinge, sLightUp) + End Select + End Sub + Private Sub SetRabbetJamb(ByRef Jamb As Part, sThicknessHead As String, sOverlap As String, sLightUp As String) + Dim CompoListIndex As Integer = CompoPanelVM.CompoTypeList.Count - 1 + Dim bRabbet As Boolean = False + Dim IndexCompo As Integer + If Jamb.CompoList.Count > 0 Then + For IndexCompo = 0 To Jamb.CompoList.Count - 1 + If Jamb.CompoList(IndexCompo).CompoType.DDFName = CompoPanelVM.CompoTypeList(CompoListIndex).DDFName Then + If DirectCast(Jamb.CompoList(IndexCompo).CompoParamList(0), ComboBoxParam).SelItem = DirectCast(Jamb.CompoList(IndexCompo).CompoParamList(0), ComboBoxParam).ItemList(0) Then + bRabbet = True + Exit For + End If + End If + Next + ' se eiste il rabbet Lo modifico + If bRabbet Then + SetTopRabbetParam(sThicknessHead, sOverlap, Jamb, IndexCompo, sLightUp) + Else + ' lo aggiungo e lo modifico + Jamb.AddNewCompo(CompoPanelVM.CompoTypeList(CompoListIndex)) + SetTopRabbetParam(sThicknessHead, sOverlap, Jamb, Jamb.CompoList.Count - 1, sLightUp) + End If + Else + ' lo aggiungo e lo modifico + Jamb.AddNewCompo(CompoPanelVM.CompoTypeList(CompoListIndex)) + SetTopRabbetParam(sThicknessHead, sOverlap, Jamb, 0, sLightUp) + End If + End Sub + Private Sub SetTopRabbetParam(sThicknessHead As String, sOverlapTop As String, ByRef Jamb As Part, IndexCompo As Integer, sLightUp As String) + Dim CurrCompoParam As CompoParam = Jamb.CompoList(IndexCompo).CompoParamList(1) + If TypeOf CurrCompoParam Is TextBoxParam Then + Dim TextParam As TextBoxParam = DirectCast(CurrCompoParam, TextBoxParam) + TextParam.m_Value = sThicknessHead + TextParam.NotifyPropertyChanged("Value") + End If + CurrCompoParam = Jamb.CompoList(IndexCompo).CompoParamList(2) + If TypeOf CurrCompoParam Is TextBoxParam Then + Dim TextParam As TextBoxParam = DirectCast(CurrCompoParam, TextBoxParam) + Dim sRabbetDepth As String = sOverlapTop + TextParam.m_Value = sRabbetDepth + TextParam.NotifyPropertyChanged("Value") + End If + End Sub + + ' calcola il rabbet sul lato Hinge solo se è stata selezionata la proprietà exterior + ' calcola il rabbet sul lato Bottom solo se è stata selezionata la proprietà exterior + Public Sub BottomRabbetJamb() + Dim sThicknessDoor As String = GetArrayPartDoor(0).Door.Thickness + Dim sOverLapHinge As String = Map.refAssemblyPageVM.CurrAssembly.OverlapHinge + Dim sOverLapLock As String = Map.refAssemblyPageVM.CurrAssembly.OverlapLock + Dim sOverLapTop As String = Map.refAssemblyPageVM.CurrAssembly.OverlapTop + Dim sWidthJamb As String = Map.refAssemblyPageVM.CurrAssembly.Width + Dim IndexBottom As Integer = 1 + Select Case DoorNumber + Case "1" + If Not m_LeftJamb.Swing.Contains("L") Then + RabbetExterior(Map.refAssemblyPageVM.CurrAssembly.LeftJamb, sThicknessDoor, sWidthJamb, sOverLapLock, IndexBottom) + RabbetExterior(Map.refAssemblyPageVM.CurrAssembly.RightJamb, sThicknessDoor, sWidthJamb, sOverLapHinge, IndexBottom) + Else + RabbetExterior(Map.refAssemblyPageVM.CurrAssembly.LeftJamb, sThicknessDoor, sWidthJamb, sOverLapHinge, IndexBottom) + RabbetExterior(Map.refAssemblyPageVM.CurrAssembly.RightJamb, sThicknessDoor, sWidthJamb, sOverLapLock, IndexBottom) + End If + Case "2" + RabbetExterior(Map.refAssemblyPageVM.CurrAssembly.LeftJamb, sThicknessDoor, sWidthJamb, sOverLapHinge, IndexBottom) + RabbetExterior(Map.refAssemblyPageVM.CurrAssembly.RightJamb, sThicknessDoor, sWidthJamb, sOverLapHinge, IndexBottom) + End Select + End Sub + ' il lato hinge è anche sul TopJamb con la profondità uguale a tutti gli altri + Public Sub HingeRabbetJamb() + Dim sThicknessDoor As String = GetArrayPartDoor(0).Door.Thickness + Dim sDeltaT As String = Map.refAssemblyPageVM.CurrAssembly.DeltaThickness + Dim sOverLapHinge As String = Map.refAssemblyPageVM.CurrAssembly.OverlapHinge + Dim sOverLapLock As String = Map.refAssemblyPageVM.CurrAssembly.OverlapLock + Dim sOverLapTop As String = Map.refAssemblyPageVM.CurrAssembly.OverlapTop + Dim IndexHinge As Integer = 2 + Select Case DoorNumber + Case "1" + If Not m_LeftJamb.Swing.Contains("L") Then + RabbetExterior(Map.refAssemblyPageVM.CurrAssembly.LeftJamb, sThicknessDoor, sDeltaT, sOverLapLock, IndexHinge) + RabbetExterior(Map.refAssemblyPageVM.CurrAssembly.RightJamb, sThicknessDoor, sDeltaT, sOverLapHinge, IndexHinge) + RabbetExterior(Map.refAssemblyPageVM.CurrAssembly.TopJamb, sThicknessDoor, sDeltaT, sOverLapTop, IndexHinge) + Else + RabbetExterior(Map.refAssemblyPageVM.CurrAssembly.LeftJamb, sThicknessDoor, sDeltaT, sOverLapHinge, IndexHinge) + RabbetExterior(Map.refAssemblyPageVM.CurrAssembly.RightJamb, sThicknessDoor, sDeltaT, sOverLapLock, IndexHinge) + RabbetExterior(Map.refAssemblyPageVM.CurrAssembly.TopJamb, sThicknessDoor, sDeltaT, sOverLapTop, IndexHinge) + End If + Case "2" + RabbetExterior(Map.refAssemblyPageVM.CurrAssembly.LeftJamb, sThicknessDoor, sDeltaT, sOverLapHinge, IndexHinge) + RabbetExterior(Map.refAssemblyPageVM.CurrAssembly.RightJamb, sThicknessDoor, sDeltaT, sOverLapHinge, IndexHinge) + RabbetExterior(Map.refAssemblyPageVM.CurrAssembly.TopJamb, sThicknessDoor, sDeltaT, sOverLapTop, IndexHinge) + End Select + End Sub + Private Sub SetHingeRabbetParam(sThicknessDoor As String, sDeltaT As String, sOverlap As String, ByRef Jamb As Part, CurrCompo As Compo, IndexSide As Integer) + Dim dThicknessDoor As Double + Dim dDeltaT As Double + StringToDouble(sThicknessDoor, dThicknessDoor) + StringToDouble(sDeltaT, dDeltaT) + Select Case IndexSide + Case 2 + Dim CurrCompoParam As CompoParam = CurrCompo.CompoParamList(0) + Dim Index As Integer = 0 + ' width + CurrCompoParam = CurrCompo.CompoParamList(1) + If TypeOf DirectCast(CurrCompoParam, CompoParam) Is TextBoxParam Then + Dim TextParam As TextBoxParam = DirectCast(CurrCompoParam, TextBoxParam) + TextParam.m_Value = DoubleToString(dDeltaT + dThicknessDoor, 4) + TextParam.NotifyPropertyChanged("Value") + End If + ' depth + CurrCompoParam = CurrCompo.CompoParamList(2) + If TypeOf DirectCast(CurrCompoParam, CompoParam) Is TextBoxParam Then + Dim TextParam As TextBoxParam = DirectCast(CurrCompoParam, TextBoxParam) + Dim sRabbetDepth As String = sOverlap + TextParam.m_Value = sRabbetDepth + TextParam.NotifyPropertyChanged("Value") + End If + Case 1 + ' inseriamo i parametri per la creazione del rabbet sul fondo + Dim CurrCompoParam As CompoParam = CurrCompo.CompoParamList(0) + Dim Index As Integer = 0 + CurrCompoParam = CurrCompo.CompoParamList(1) + ' width + If TypeOf DirectCast(CurrCompoParam, CompoParam) Is TextBoxParam Then + Dim TextParam As TextBoxParam = DirectCast(CurrCompoParam, TextBoxParam) + TextParam.m_Value = DoubleToString(dDeltaT, 4) + TextParam.NotifyPropertyChanged("Value") + End If + ' Depth + CurrCompoParam = CurrCompo.CompoParamList(2) + If TypeOf DirectCast(CurrCompoParam, CompoParam) Is TextBoxParam Then + Dim TextParam As TextBoxParam = DirectCast(CurrCompoParam, TextBoxParam) + Dim sRabbetDepth As String = sOverlap + TextParam.m_Value = sRabbetDepth + TextParam.NotifyPropertyChanged("Value") + End If + CurrCompoParam = CurrCompo.CompoParamList(3) + If TypeOf DirectCast(CurrCompoParam, CompoParam) Is TextBoxOnOffParam Then + Dim TextOnOffParam As TextBoxOnOffParam = DirectCast(CurrCompoParam, TextBoxOnOffParam) + Dim sAngle As String = "2" + TextOnOffParam.m_Value = sAngle + TextOnOffParam.IsActive = True + TextOnOffParam.NotifyPropertyChanged("Value") + End If + End Select + + End Sub + Public Sub RabbetExterior(ByRef Jamb As Part, sThicknessDoor As String, sDeltaT As String, sOverLap As String, nIndexSide As Integer) + 'Dim IndexHinge As Integer = 2 + 'Dim IndexBottom As Integer = 1 + + Dim CompoListIndex As Integer = CompoPanelVM.CompoTypeList.Count - 1 + Dim bRabbet As Boolean = False + Dim IndexCompo As Integer + If m_Exterior Then + If Jamb.CompoList.Count > 0 Then + For IndexCompo = 0 To Jamb.CompoList.Count - 1 + If Jamb.CompoList(IndexCompo).CompoType.DDFName = CompoPanelVM.CompoTypeList(CompoListIndex).DDFName Then + If DirectCast(Jamb.CompoList(IndexCompo).CompoParamList(0), ComboBoxParam).SelItem = DirectCast(Jamb.CompoList(IndexCompo).CompoParamList(0), ComboBoxParam).ItemList(nIndexSide) Then + bRabbet = True + Exit For + End If + End If + Next + If bRabbet Then + SetHingeRabbetParam(sThicknessDoor, sDeltaT, sOverLap, Jamb, Jamb.CompoList(IndexCompo), nIndexSide) + Else + ' lo aggiungo e lo modifico + Dim Local_Compo As Compo = Jamb.AddNewCompo(CompoPanelVM.CompoTypeList(CompoListIndex)) + DirectCast(Local_Compo.CompoParamList(0), ComboBoxParam).SelItem = DirectCast(Local_Compo.CompoParamList(0), ComboBoxParam).ItemList(nIndexSide) + SetHingeRabbetParam(sThicknessDoor, sDeltaT, sOverLap, Jamb, Local_Compo, nIndexSide) + End If + Else + ' lo aggiungo e lo modifico + Dim Local_Compo As Compo = Jamb.AddNewCompo(CompoPanelVM.CompoTypeList(CompoListIndex)) + DirectCast(Local_Compo.CompoParamList(0), ComboBoxParam).SelItem = DirectCast(Local_Compo.CompoParamList(0), ComboBoxParam).ItemList(nIndexSide) + SetHingeRabbetParam(sThicknessDoor, sDeltaT, sOverLap, Jamb, Local_Compo, nIndexSide) + End If + ' + Else + For IndexCompo = 0 To Jamb.CompoList.Count - 1 + If Jamb.CompoList(IndexCompo).CompoType.DDFName = CompoPanelVM.CompoTypeList(CompoListIndex).DDFName Then + If DirectCast(Jamb.CompoList(IndexCompo).CompoParamList(0), ComboBoxParam).SelItem = DirectCast(Jamb.CompoList(IndexCompo).CompoParamList(0), ComboBoxParam).ItemList(nIndexSide) Then + bRabbet = True + Exit For + End If + End If + Next + If bRabbet Then Jamb.CompoList.RemoveAt(IndexCompo) + End If + End Sub + + ' ricalcola la posizione di tutti gli hardware + Public Sub ReplaceHardware() + For IndexDoor As Integer = 0 To CInt(DoorNumber) - 1 + For IndexCompo As Integer = 0 To Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList.Count - 1 + If Not IsNothing(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).refJambCompo) Then + For IndexParam As Integer = 0 To Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).CompoParamList.Count - 1 + If TypeOf Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).CompoParamList(IndexParam) Is TextBoxParam Then + DirectCast(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).CompoParamList(IndexParam), TextBoxParam).Value = DirectCast(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).CompoParamList(IndexParam), TextBoxParam).Value + End If + Next + End If + Next + Next + End Sub + +#End Region ' Rules Assembly + + Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged + + Public Sub NotifyPropertyChanged(propName As String) + RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName)) + End Sub +End Class diff --git a/Assembly/AssemblyPageV.xaml b/Assembly/AssemblyPageV.xaml new file mode 100644 index 0000000..eff1ea6 --- /dev/null +++ b/Assembly/AssemblyPageV.xaml @@ -0,0 +1,459 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CompoPanel/CompoPanelV.xaml.vb b/CompoPanel/CompoPanelV.xaml.vb new file mode 100644 index 0000000..d88b827 --- /dev/null +++ b/CompoPanel/CompoPanelV.xaml.vb @@ -0,0 +1,3 @@ +Public Class CompoPanelV + +End Class diff --git a/CompoPanel/CompoPanelViewModel.vb b/CompoPanel/CompoPanelVM.vb similarity index 58% rename from CompoPanel/CompoPanelViewModel.vb rename to CompoPanel/CompoPanelVM.vb index 2072f99..4ba4c21 100644 --- a/CompoPanel/CompoPanelViewModel.vb +++ b/CompoPanel/CompoPanelVM.vb @@ -3,12 +3,14 @@ Imports System.Collections.ObjectModel Imports EgtUILib Imports System.IO -Public Class CompoPanelViewModel +Public Class CompoPanelVM Implements INotifyPropertyChanged - Private m_rfMainWindowViewModel As MainWindowViewModel - Private m_rfDoorParametersViewModel As DoorParametersViewModel - Dim m_Chapter As String + Public ReadOnly Property GoToAssembly As String + Get + Return "GoToAssembly" + End Get + End Property Private Shared m_CompoTypeList As New ObservableCollection(Of CompoType) Public Shared ReadOnly Property CompoTypeList As ObservableCollection(Of CompoType) @@ -17,20 +19,43 @@ Public Class CompoPanelViewModel End Get End Property + Private m_IsVisible As Visibility + Public Property IsVisible As Visibility + Get + Return m_IsVisible + End Get + Set(value As Visibility) + m_IsVisible = value + NotifyPropertyChanged("IsVisible") + End Set + End Property + + Private m_GoBackVisibility As Visibility = Visibility.Visible + Public Property GoBackVisibility As Visibility + Get + Return m_GoBackVisibility + End Get + Set(value As Visibility) + m_GoBackVisibility = value + NotifyPropertyChanged("GoBackVisibility") + End Set + End Property + ' Definizione comando Private m_CmdCompoBtn As ICommand + Private m_CmdGoToAssemblyBtn As ICommand ' definizione comando Private m_EnterRefreshCmd As ICommand - Sub New(MainWindowViewModel As MainWindowViewModel) - m_rfMainWindowViewModel = MainWindowViewModel - m_rfDoorParametersViewModel = DirectCast(m_rfMainWindowViewModel.DoorParameters.DataContext, DoorParametersViewModel) + Sub New() + Map.SetRefCompoPanelVM(Me) Dim IndexCompoOrder = 0 Dim CompoPanelList As List(Of String) = OptionModule.m_CompoPaneOrder ' Lettura file ini per generare bottoni Dim Index As Integer = 1 Dim CompoName As String = String.Empty Dim CompoNameDDF As String = String.Empty + Dim Side As String = String.Empty ' Carico un vettore con il nome delle Path delle componenti IniFile.m_CompoDir = IniFile.m_sDoorsDirPath & "\Compo" If Not Directory.Exists(IniFile.m_CompoDir) Then @@ -45,8 +70,9 @@ Public Class CompoPanelViewModel Dim CurrCompoPath As String = CompoArray(Index) & "\" & ConstCompo.CONFIGINI_FILE_NAME If File.Exists(CurrCompoPath) Then GetPrivateProfileCompoName(ConstCompo.S_COMPO, ConstCompo.K_NAME, CompoNameDDF, CompoName, CurrCompoPath) + GetPrivateProfileJambSide("PositionSide", "Side", Side, CurrCompoPath) If CompoPanelList(IndexCompoOrder) = CompoNameDDF Then - m_CompoTypeList.Add(New CompoType(CompoName, CompoNameDDF, CompoArray(Index))) + m_CompoTypeList.Add(New CompoType(CompoName, CompoNameDDF, CompoArray(Index), Side)) Exit For End If End If @@ -79,10 +105,12 @@ Public Class CompoPanelViewModel Public Sub CompoBtn(param As Object) Dim m_CurrCompoType As CompoType = DirectCast(param, CompoType) - If Not IsNothing(m_rfDoorParametersViewModel.CurrDoor) Then - m_rfDoorParametersViewModel.CurrDoor.AddNewCompo(m_CurrCompoType) - ''richiamo la pagina della guida ssociata alla componente selezionata - 'GuideViewModel.m_AddressGuide = "Compo" & "\" & m_CurrCompoType.DDFName + If Not IsNothing(Map.refPartPageVM.CurrPart) Then + Dim NewCompo As Compo = Map.refPartPageVM.CurrPart.AddNewCompo(m_CurrCompoType) + '' appena aggiungo una componente nuova calcolo le sue componenti correttamente modificate + If Not IsNothing(NewCompo.refJambCompo) Then + Map.refAssemblyPageVM.CurrAssembly.UpDateCurrCompoJamb(NewCompo) + End If Else MessageBox.Show(EgtMsg(50108), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Exclamation) End If @@ -90,6 +118,32 @@ Public Class CompoPanelViewModel #End Region ' CompoBtnCommand +#Region "GoToAssemblyBtnCommand" + + ''' + ''' Returns a command that do Exec. + ''' + Public ReadOnly Property GoToAssemblyBtnCommand As ICommand + Get + If m_CmdGoToAssemblyBtn Is Nothing Then + m_CmdGoToAssemblyBtn = New Command(AddressOf GoToAssemblyBtn) + End If + Return m_CmdGoToAssemblyBtn + End Get + End Property + + ''' + ''' Execute the Exec. This method is invoked by the ExecCommand. + ''' + ''' + + Public Sub GoToAssemblyBtn(param As Object) + Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nAssemblyPage + ExecDoors(Map.refSceneManagerVM.ProjectScene, IniFile.m_sTempDir & "\" & TEMP_ASSEMBLY) + End Sub + +#End Region ' GoToAssemblyBtnCommand + #Region "ENTERREFRESH" ''' @@ -105,7 +159,7 @@ Public Class CompoPanelViewModel End Property Public Sub EnterRefresh() - DirectCast(m_rfMainWindowViewModel.SceneManager.DataContext, SceneManagerViewModel).RefreshBtn() + Map.refSceneManagerVM.RefreshBtn() End Sub #End Region ' EnterRefresh diff --git a/CompoPanel/CompoPanelView.xaml b/CompoPanel/CompoPanelView.xaml deleted file mode 100644 index f2b4084..0000000 --- a/CompoPanel/CompoPanelView.xaml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/DoorManager/AssemblyManagerV.xaml.vb b/DoorManager/AssemblyManagerV.xaml.vb new file mode 100644 index 0000000..438431a --- /dev/null +++ b/DoorManager/AssemblyManagerV.xaml.vb @@ -0,0 +1,8 @@ +Public Class AssemblyManagerV + + Private Sub Door_MouseLeftButtonDown(sender As Object, e As MouseButtonEventArgs) + Dim Item As ListBoxItem = DirectCast(sender, ListBoxItem) + e.Handled = Map.refAssemblyManagerVM.OpenSelectedAssembly(DirectCast(Item.DataContext, AssemblyName)) + End Sub + +End Class diff --git a/DoorManager/AssemblyManagerVM.vb b/DoorManager/AssemblyManagerVM.vb new file mode 100644 index 0000000..47fce90 --- /dev/null +++ b/DoorManager/AssemblyManagerVM.vb @@ -0,0 +1,545 @@ +Imports System.Collections.ObjectModel +Imports System.ComponentModel +Imports System.IO +Imports EgtUILib + +Public Class AssemblyManagerVM + Implements INotifyPropertyChanged + + ' percorso della porta corrente (creata o già esistente nella cartella) + + Private NewAssembly As Boolean = False + Friend DeleteNewPart As Integer = 1 + + Private SelAssembly As New Assembly + Friend MsgResult As MessageBoxResult + + ' creiamo un nuovo progetto: un nome e una lista di porte + Private m_CurrProject As New Project + Public Property CurrProject As Project + Get + Return m_CurrProject + End Get + Set(value As Project) + m_CurrProject = value + End Set + End Property + + Private m_SelectedAssembly As New AssemblyName + Public Property SelectedAssembly As AssemblyName + Get + Return m_SelectedAssembly + End Get + Set(value As AssemblyName) + m_SelectedAssembly = value + NotifyPropertyChanged("SelectedAssembly") + End Set + End Property + +#Region "MESSAGES" + Public ReadOnly Property AddNewDoorToolTip As String + Get + Return EgtMsg(50302) + End Get + End Property + + Public ReadOnly Property RemoveDoorToolTip As String + Get + Return EgtMsg(50303) + End Get + End Property +#End Region 'MESSAGES + + ' Definizione comandi + Private m_cmdAddAssembly As ICommand + Private m_cmdRemoveDoor As ICommand + + Sub New() + Map.SetRefDoorManagerVM(Me) + End Sub + +#Region "METHODS" + Private CreateRabbet As Boolean = False +#Region "Apertura e salvataggio" + Public Sub RemoveFromAssemblyList() + Dim SelIndex As Integer = m_CurrProject.AssemblyList.IndexOf(m_SelectedAssembly) + m_CurrProject.AssemblyList.Remove(m_SelectedAssembly) + CurrProject.NotifyPropertyChanged("AssemblyList") + If m_CurrProject.AssemblyList.Count > 0 Then + ' aggiorno la porta da visualizzare + If SelIndex > m_CurrProject.AssemblyList.Count - 1 Then + m_SelectedAssembly = m_CurrProject.AssemblyList(SelIndex - 1) + OpenSelectedAssembly(SelectedAssembly) + Else + m_SelectedAssembly = m_CurrProject.AssemblyList(SelIndex) + OpenSelectedAssembly(SelectedAssembly) + End If + ' se non ci sono altre porte nella lista allora + Else + ' elimino qualsiasi resto di porta + Map.refAssemblyPageVM.CurrAssembly = Nothing + ' aggiorni l'immagine a nulla + EgtNewFile() + EgtZoom(ZM.ALL) + End If + End Sub + ' restituisce un intero associato ad un messaggioa a seconda che il file esista oppure no + Private Function MsgDeleteOrNotSave(ByVal value As AssemblyName) As Integer + If File.Exists(value.Name) Then + Return 50109 + Else + Return 50116 + End If + End Function + ' salva il file corrente o se è stato appena creato lo elimina dalla lista + Friend Function SaveCurrentAssembly() As Boolean + ' se nessun elemento è selezionato allora continua + If Not IsNothing(m_SelectedAssembly) Then + ' se il file è modificato allora chiedo se salvare o non salvare o continuare + If m_SelectedAssembly.IsModify Then + MsgResult = MessageBox.Show(String.Format(EgtMsg(MsgDeleteOrNotSave(m_SelectedAssembly)), Path.GetFileNameWithoutExtension(m_SelectedAssembly.Name)), EgtMsg(50110), MessageBoxButton.YesNoCancel, MessageBoxImage.Warning) + ' decido di salvare + If MsgResult = MessageBoxResult.Yes Then + m_SelectedAssembly.IsModify = False + Part.FirstReadingEdge = False + SelectedAssembly.NotifyPropertyChanged("IsModify") + If Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(0).Door.IsNotAssembly Then + DdfFile.WriteDDFPart(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(0).Door, m_SelectedAssembly.Name, True, False) + Else + DdfFile.WriteDDFAssembly(Map.refAssemblyPageVM.CurrAssembly, m_SelectedAssembly.Name, True) + End If + 'Map.refPartPageVM.bSetChange = False + Return True + ' decido di non salvare + ElseIf MsgResult = MessageBoxResult.No Then + ' devo eliminare dall'elenco degli assemblati o non salvare nulla + Part.FirstReadingEdge = False + If Not File.Exists(m_SelectedAssembly.Name) Then + CurrProject.AssemblyList.Remove(m_SelectedAssembly) + Else + m_SelectedAssembly.IsModify = False + End If + Return True + ' decido di interrompere la selezione + Else + ' interrompi le operazioni di creazione o selezione + Return False + End If + Else + 'se il file non è stato modificato allora posso procedere + Return True + End If + Else + ' altrimenti il progetto è vuoto quindi non accade nulla nel salvataggio + Return True + End If + End Function + ' Apre il File in selzionato o crea un nuovo oggetto + Public Function OpenSelectedAssembly(value As AssemblyName) As Boolean + If SaveCurrentAssembly() Then + SelectedAssembly = value + If File.Exists(m_SelectedAssembly.Name) Then + Map.refAssemblyPageVM.CurrAssembly = CreateNewAssembly(m_SelectedAssembly.Name) + Assembly.ReadDDFAssembly(m_SelectedAssembly.Name, Map.refAssemblyPageVM.CurrAssembly) + DdfFile.WriteDDFAssembly(Map.refAssemblyPageVM.CurrAssembly, IniFile.m_sTempDir & "\" & TEMP_ASSEMBLY, True) + 'Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nAssemblyPage + NotifyPropertyChanged("SelectedAssembly") + ' se è avvenuta la modifica dei valori dei bevel devo avvisare che vi è stata una modifica + ' dopo aver caricato tutti i valori all'apertura del progetto devo riportare la modifica a false + m_SelectedAssembly.IsModify = Part.FirstReadingEdge + If Not Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(0).Door.IsNotAssembly Then + ExecDoors(Map.refSceneManagerVM.ProjectScene, IniFile.m_sTempDir & "\" & TEMP_ASSEMBLY) + End If + Return True + Else + ' modifico il nome dell'assemblato + m_SelectedAssembly.IsModify = True + 'Map.refAssemblyPageVM.CurrAssembly = Nothing + CreateRabbet = True + Map.refAssemblyPageVM.CurrAssembly = CreateNewAssembly(m_SelectedAssembly.Name) + DdfFile.WriteDDFAssembly(Map.refAssemblyPageVM.CurrAssembly, IniFile.m_sTempDir & "\" & TEMP_ASSEMBLY, True) + Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nAssemblyPage + CreateRabbet = False + ExecDoors(Map.refSceneManagerVM.ProjectScene, IniFile.m_sTempDir & "\" & TEMP_ASSEMBLY) + NotifyPropertyChanged("SelectedAssembly") + Return True + End If + 'NotifyPropertyChanged("SelectedAssembly") + Else + Return False + End If + End Function +#End Region ' Apertura e salvataggio + +#Region "Creazione e caricamento degli oggetti dell'assemblato" + ' Caricamento dei dati della pagina generale degli assemblati + Friend Function CreateNewAssembly(value As String) As Assembly + '' se non esisteva nessuna porta allora posso procedere + 'm_SelectedAssembly.Name = value + 'NotifyPropertyChanged("SelectedAssembly") + ' costruisco un nuvo assemblato e lo carico con i valori + Dim Local_SelAssembly As New Assembly + Local_SelAssembly.NewAssembly = NewAssembly + Local_SelAssembly.SetExterior(OptionModule.m_Exterior) + Local_SelAssembly.DoorListNumber = OptionModule.m_DoorsListNumber + ' Carico tutti i vettori in sola lettura (i metodi set non contengono nessuna operazione) + Local_SelAssembly.SetThickness(OptionModule.m_ThicknessJamb) + Local_SelAssembly.SetWidth(OptionModule.m_WidthJamb) + Local_SelAssembly.SetLightUp(OptionModule.m_LightUp) + Local_SelAssembly.SetLightLock(OptionModule.m_LightLock) + Local_SelAssembly.SetLightBottom(OptionModule.m_LightBottom) + Local_SelAssembly.SetLightHinge(OptionModule.m_LightHinge) + Local_SelAssembly.SetThicknessHead(OptionModule.m_ThicknessHead) + Local_SelAssembly.SetOverlapHinge(OptionModule.m_OverlapHinge) + Local_SelAssembly.SetOverlapLock(OptionModule.m_OverlapLock) + Local_SelAssembly.SetOverlapTop(OptionModule.m_OverlapTop) + Local_SelAssembly.SetDeltaThickness(OptionModule.m_DeltaThickness) + Local_SelAssembly.SetLockEdgeType(OptionModule.m_LockEdgeTypeAssembly) + Local_SelAssembly.SetHingeEdgeType(OptionModule.m_HingeEdgeTypeAssembly) + Local_SelAssembly.SetTopType(OptionModule.m_TopTypeAssembly) + Local_SelAssembly.SetBottomType(OptionModule.m_BottomTypeAssembly) + Local_SelAssembly.SetLockEdgeMachining(OptionModule.m_LockEdgeMachiningAssembly) + Local_SelAssembly.SetHingeEdgeMachining(OptionModule.m_HingeEdgeMachiningAssembly) + Local_SelAssembly.SetTopMachining(OptionModule.m_TopMachiningAssembly) + Local_SelAssembly.SetBottomMachining(OptionModule.m_BottomMachiningAssembly) + Local_SelAssembly.SetLockEdgeOverMaterial(OptionModule.m_LockEdgeOverMaterialAssembly) + Local_SelAssembly.SetHingeEdgeOverMaterial(OptionModule.m_HingeEdgeOverMaterialAssembly) + Local_SelAssembly.SetTopOverMaterial(OptionModule.m_TopOverMaterialAssembly) + Local_SelAssembly.SetBottomOverMaterial(OptionModule.m_BottomOverMaterialAssembly) + Local_SelAssembly.SetDoorNumber(OptionModule.m_DoorsNumber) + ' costruisco e carico le parti + CreatePart(Local_SelAssembly) + ' carico l'assemblato che sto creando in locale (così da poter gestire i Jamb) + Map.refAssemblyPageVM.CurrAssembly = Local_SelAssembly + CreateDoor(Local_SelAssembly) + ' calcolo la dimensione dei Jambs in funzione del numero di porte visibili + Local_SelAssembly.DoorVisibilityNew() + Local_SelAssembly.TopRabbetJamb() + 'Local_SelAssembly.HingeRabbetJamb() + Return Local_SelAssembly + End Function + ' creazione dei jamb + Private Sub CreatePart(ByRef CurrAssembly As Assembly) + CurrAssembly.LeftJamb = New Part + CurrAssembly.LeftJamb.TypePart = "FL_" + CurrAssembly.LeftJamb.SetThickness(CurrAssembly.Thickness) + CurrAssembly.LeftJamb.SetWidth(CurrAssembly.Width) + CurrAssembly.LeftJamb.SwingTypeList = OptionModule.m_SwingTypeList + CurrAssembly.LeftJamb.IsActive = OptionModule.m_LeftJambChk + + CurrAssembly.RightJamb = New Part + CurrAssembly.RightJamb.TypePart = "FR_" + CurrAssembly.RightJamb.SetThickness(CurrAssembly.Thickness) + CurrAssembly.RightJamb.SetWidth(CurrAssembly.Width) + CurrAssembly.RightJamb.SwingTypeList = OptionModule.m_SwingTypeList + CurrAssembly.RightJamb.IsActive = OptionModule.m_RightJambChk + + CurrAssembly.TopJamb = New Part + CurrAssembly.TopJamb.TypePart = "FT_" + CurrAssembly.TopJamb.SetThickness(CurrAssembly.Thickness) + CurrAssembly.TopJamb.SetHeight(CurrAssembly.ThicknessHead) + CurrAssembly.TopJamb.SwingTypeList = OptionModule.m_SwingTypeList + CurrAssembly.TopJamb.IsActive = OptionModule.m_TopJambChk + CurrAssembly.BottomJamb = New Part + + CurrAssembly.BottomJamb.TypePart = "FB_" + CurrAssembly.BottomJamb.SetThickness(CurrAssembly.Thickness) + CurrAssembly.BottomJamb.SetHeight(CurrAssembly.Width) + CurrAssembly.BottomJamb.SwingTypeList = OptionModule.m_SwingTypeList + CurrAssembly.BottomJamb.IsActive = OptionModule.m_BottomJambChk + End Sub + ' Caricamento del vettore delle porte, Se già ne esite 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 K_DOORNUMBER + ref_PartDoor = New PartDoor + ref_Door = New Part + ref_Door.TypePart = "DO_" & IndexDoor + 1 + LoadDefaultPartOne(ref_Door) + ref_PartDoor.Door = ref_Door + CurrAssembly.ArrayPartDoor.Add(ref_PartDoor) + Next + End Sub + + ' carica i valori di default negli oggetti appena creati + Public Sub LoadDefaultPartOne(ByRef ref_Part As Part) + 'OptionModule.GeneralDoor.CompoList.Clear() + '--------------------------------------------------------------------------------------------------------------- + ' Date le dimensioni della porta calcoliamo la dimensione dei Jamb + ref_Part.Width = OptionModule.m_Width + ref_Part.Height = OptionModule.m_Height + ref_Part.Thickness = OptionModule.m_Thickness + '--------------------------------------------------------------------------------------------------------------- + ' i parametri che seguono non influenzano in alcun modo i jamb + ref_Part.SetSwing(OptionModule.m_Swing) + ref_Part.IsActive = False + ref_Part.Measure = OptionModule.m_SelectedMeasureUnit + ref_Part.Weight = OptionModule.m_Weight + ref_Part.LockEdgeType = OptionModule.m_LockEdgeType + ref_Part.HingeEdgeType = OptionModule.m_HingeEdgeType + ref_Part.TopType = OptionModule.m_TopType + ref_Part.BottomType = OptionModule.m_BottomType + ref_Part.LockEdgeMachining = OptionModule.m_LockEdgeMachining + ref_Part.HingeEdgeMachining = OptionModule.m_HingeEdgeMachining + ref_Part.TopMachining = OptionModule.m_TopMachining + ref_Part.BottomMachining = OptionModule.m_BottomMachining + ref_Part.LockEdgeOverMaterial = OptionModule.m_LockEdgeOverMaterial + ref_Part.HingeEdgeOverMaterial = OptionModule.m_HingeEdgeOverMaterial + ref_Part.TopOverMaterial = OptionModule.m_TopOverMaterial + ref_Part.BottomOverMaterial = OptionModule.m_BottomOverMaterial + End Sub + +#End Region ' Creazione e caricamento degli oggetti dell'assemblato + + ' controllo che tutti gli oggetti siano stati creati + Private Function CurrAssembyIsNotEmpty(ref_CurrAssembly As Assembly) As Boolean + Dim bJambExist As Boolean = False + Dim bDoorExist As Boolean = False + If Not IsNothing(ref_CurrAssembly.BottomJamb) Or Not IsNothing(ref_CurrAssembly.LeftJamb) Or Not IsNothing(ref_CurrAssembly.RightJamb) Or Not IsNothing(ref_CurrAssembly.TopJamb) Then + bJambExist = True + End If + If CInt(ref_CurrAssembly.DoorNumber) > 0 Then + bDoorExist = True + End If + If bJambExist And bDoorExist Then + Return True + Else + Return False + End If + Return False + End Function + + Private Sub DeleteDoorFromList() + Dim SelIndex As Integer = m_CurrProject.AssemblyList.IndexOf(m_SelectedAssembly) + Dim ExtensionFile As String = Path.GetExtension(m_SelectedAssembly.Name) + Dim FileName As String = Path.GetFileName(m_SelectedAssembly.Name) + ' modifico l'estensione del file + FileName = FileName.Replace(ExtensionFile, ".err") + ' qui modifico il nome del file, ma ancora non è sostituito nel sistema + m_SelectedAssembly.Name = m_SelectedAssembly.Name.Replace(Path.GetFileName(m_SelectedAssembly.Name), FileName) + m_CurrProject.AssemblyList.RemoveAt(SelIndex) + CurrProject.NotifyPropertyChanged("AssemblyList") + ' se la lista non è rimasta vuota + If m_CurrProject.AssemblyList.Count > 0 Then + ' aggiorno la porta da visualizzare + If SelIndex > m_CurrProject.AssemblyList.Count - 1 Then + SelectedAssembly = m_CurrProject.AssemblyList(SelIndex - 1) + Else + SelectedAssembly = m_CurrProject.AssemblyList(SelIndex) + End If + ' se non ci sono altre porte nella lista allora + Else + ' elimino qualsiasi resto di porta + Map.refPartPageVM.CurrPart = Nothing + ' aggiorni l'immagine a nulla + EgtNewFile() + EgtZoom(ZM.ALL) + End If + End Sub + +#End Region ' METHODS + +#Region "COMMANDS" + +#Region "AddDoorCommand" + + ''' + ''' Returns a command that do New. + ''' + Public ReadOnly Property AddAssemblyCommand As ICommand + Get + If m_cmdAddAssembly Is Nothing Then + m_cmdAddAssembly = New Command(AddressOf AddAssembly) + End If + Return m_cmdAddAssembly + End Get + End Property + + ''' + ''' Execute the New. This method is invoked by the NewCommand. + ''' + Public Sub AddAssembly() + If Not SaveCurrentAssembly() Then + Exit Sub + End If + Dim NameExist As Boolean = True + Dim ImportTemplate As String = String.Empty + '--------------------------------------------------------------------------------------------------------------------------------------------------- + ' CHIEDO SE SI VUOLE IMPOTRTARE UN TEMPLATE + + ''Prima di tutto chiedo se vuole aprire un template + 'If MessageBox.Show(EgtMsg(50146), EgtMsg(50110), MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes) = MessageBoxResult.Yes Then + ' ' Apro la finestra di dailogo aperta direttamente sulla cartella cercata + ' Dim OpenFileDialog As New System.Windows.Forms.OpenFileDialog + ' OpenFileDialog.InitialDirectory = IniFile.m_TemplateDir + ' If OpenFileDialog.ShowDialog <> Forms.DialogResult.OK Then + ' ' se la risposta è diversa da OK esce + ' Return + ' End If + ' ' carico l'indirizzo del template che voglio aprire + ' ImportTemplate = OpenFileDialog.FileName + 'End If + '---------------------------------------------------------------------------------------------------------------------------------------------------- + ' lancio la finestra per la creazione di una nuova porta + Dim SaveFileDialog As New EgtWPFLib5.EgtSaveFileDialog + SaveFileDialog.Title = K_NEWDOOR + SaveFileDialog.Directory = m_CurrProject.Name + SaveFileDialog.Extension = K_DDFEXTENSION + ' se decido di chiuedere la finestra + If Not SaveFileDialog.EgtShowDialog Then + Return + End If + ' Controllo se ha estensione il nome della porta + If Path.HasExtension(SaveFileDialog.FileName) Then + Dim sExtension As String = Path.GetExtension(SaveFileDialog.FileName) + If Not sExtension.ToLower = K_DDFEXTENSION Then + SaveFileDialog.FileName = SaveFileDialog.FileName.Replace(sExtension, K_DDFEXTENSION) + End If + Else + SaveFileDialog.FileName &= K_DDFEXTENSION + End If + ' controllo che il nome non sia presente nella lista + Dim bNameExist As Boolean = False + Dim IndexDoorList As Integer + For IndexDoorList = 0 To CurrProject.AssemblyList.Count - 1 + If CurrProject.AssemblyList(IndexDoorList).Name = SaveFileDialog.FileName Then + ' se il nome è nella lista allora esco dal ciclo e rendo falsa la variabile bNameExist + bNameExist = True + Exit For + End If + bNameExist = False + Next + ' se il nome è nella lista allora sovrascirvo sulla porta esistente + If bNameExist Then + ' elimino la porta esistente + File.Delete(SaveFileDialog.FileName) + ' elimino dalla lista + m_CurrProject.AssemblyList.RemoveAt(IndexDoorList) + CurrProject.NotifyPropertyChanged("AssemblyList") + End If + + ' aggiungo il nome del file alla lista degli assemblati + Dim Local_AssemblyName As New AssemblyName + Local_AssemblyName.Name = SaveFileDialog.FileName + Local_AssemblyName.IsModify = False + CurrProject.AssemblyList.Add(Local_AssemblyName) + ' aggiorno la lista + CurrProject.NotifyPropertyChanged("AssemblyList") + '------------------------------------------------------------------------------------------------------------------------------------------------ + ' LETTURA DI UN FILE DI TIPO TEMPLATE + + 'If String.IsNullOrEmpty(ImportTemplate) Then + ' NewAssembly = True + 'Else + ' ' !!!!se sto aprendo un template significa che devo leggere un file già esistente!!!! + ' NewAssembly = False + ' ' creo il file ddf associato al template + ' Dim TemplateDoor As New Part + ' Part.ReadDDF(ImportTemplate, TemplateDoor) + ' WriteDDF(TemplateDoor, SaveFileDialog.FileName, False) + 'End If + '------------------------------------------------------------------------------------------------------------------------------------------------ + ' carico il nome ceme Assemblato selezionato + OpenSelectedAssembly(Local_AssemblyName) + End Sub + +#End Region ' AddDoorCommand + +#Region "RemoveDoorCommand" + + ''' + ''' Returns a command that do New. + ''' + Public ReadOnly Property RemoveDoorCommand As ICommand + Get + If m_cmdRemoveDoor Is Nothing Then + m_cmdRemoveDoor = New Command(AddressOf RemoveAssembly) + End If + Return m_cmdRemoveDoor + End Get + End Property + + ''' + ''' Execute the New. This method is invoked by the NewCommand. + ''' + Public Sub RemoveAssembly() + Dim DeletingQuestion As Integer = 0 + Dim DeletingResult As MessageBoxResult = MessageBoxResult.No + If IsNothing(m_SelectedAssembly) Then Return + ''DeleteNewPart = -1 + '' salvo il nome del file che sta per essere eliminato + 'Dim RemoveDoorName As String = Path.GetFileNameWithoutExtension(m_SelectedAssembly) + + ''If Map.refPartPageVM.CurrPart.NewPart Then + '' ' se sono arrivato qui signifoca che sto chiudendo il programma con una porta nuova aperta ma non salvata + '' ' se ho dichiarato che non voglio salvare significa che devo eliminare + '' DeletingResult = MessageBoxResult.Yes + 'Else + ' ' stamp a video il messaggio per chiedere se eliminare + ' DeletingResult = MessageBox.Show(String.Format(EgtMsg(50116), Path.GetFileNameWithoutExtension(m_SelectedAssembly)), EgtMsg(50110), MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No) + 'End if + DeletingResult = MessageBox.Show(String.Format(EgtMsg(50117), Path.GetFileNameWithoutExtension(m_SelectedAssembly.Name)), EgtMsg(50110), MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No) + ' chiedo se devo eliminere il file: se si + If DeletingResult = MessageBoxResult.Yes Then + ' ricerco l'indice del file all'interno della lista delle porte + 'SetNameCurrAssemblyAsSaved(m_SelectedAssembly) + 'Dim SelIndex As Integer = m_CurrProject.AssemblyList.IndexOf(m_SelectedAssembly) + ' elimino dall'elenco dei file + If File.Exists(m_SelectedAssembly.Name) Then + File.Delete(m_SelectedAssembly.Name) + End If + RemoveFromAssemblyList() + ' elimino dalla lista + ' m_CurrProject.AssemblyList.Remove(m_SelectedAssembly) + ' CurrProject.NotifyPropertyChanged("AssemblyList") + ' '' per quando torno nel m_SelectedDoor...per non chiedere di salvare o eliminare + ' 'DeleteNewPart = -1 + ' '' se la lista non è rimasta vuota + ' If m_CurrProject.AssemblyList.Count > 0 Then + ' ' aggiorno la porta da visualizzare + ' If SelIndex > m_CurrProject.AssemblyList.Count - 1 Then + ' SelectedAssembly = m_CurrProject.AssemblyList(SelIndex - 1) + ' OpenSelectedAssembly(SelectedAssembly) + ' Else + ' SelectedAssembly = m_CurrProject.AssemblyList(SelIndex) + ' OpenSelectedAssembly(SelectedAssembly) + ' End If + ' ' se non ci sono altre porte nella lista allora + ' Else + ' ' elimino qualsiasi resto di porta + ' Map.refJambPageVM.CurrAssembly = Nothing + ' ' aggiorni l'immagine a nulla + ' EgtNewFile() + ' EgtZoom(ZM.ALL) + ' End If + Else + 'altrimenti salvo il file + DdfFile.WriteDDFAssembly(Map.refAssemblyPageVM.CurrAssembly, m_SelectedAssembly.Name, True) + End If + End Sub + +#End Region ' RemoveDoorCommand + +#End Region ' Commands + + Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged + + Public Sub NotifyPropertyChanged(propName As String) + RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName)) + End Sub + +End Class diff --git a/DoorManager/DoorManagerView.xaml.vb b/DoorManager/DoorManagerView.xaml.vb deleted file mode 100644 index 8523750..0000000 --- a/DoorManager/DoorManagerView.xaml.vb +++ /dev/null @@ -1,18 +0,0 @@ -Public Class DoorManagerView - - Private m_rfDoorManagerViewModel As DoorManagerViewModel - - Sub New(rfDoorManagerViewModel As DoorManagerViewModel) - ' This call is required by the designer. - InitializeComponent() - ' Add any initialization after the InitializeComponent() call. - Me.DataContext = rfDoorManagerViewModel - m_rfDoorManagerViewModel = rfDoorManagerViewModel - End Sub - - Private Sub Door_MouseLeftButtonDown(sender As Object, e As MouseButtonEventArgs) - Dim Item As ListBoxItem = DirectCast(sender, ListBoxItem) - e.Handled = Not m_rfDoorManagerViewModel.ChooseSelectedDoor(CStr(Item.DataContext)) - End Sub - -End Class diff --git a/DoorManager/DoorManagerViewModel.vb b/DoorManager/DoorManagerViewModel.vb deleted file mode 100644 index 81d68e2..0000000 --- a/DoorManager/DoorManagerViewModel.vb +++ /dev/null @@ -1,419 +0,0 @@ -Imports System.Collections.ObjectModel -Imports System.ComponentModel -Imports System.IO -Imports EgtUILib - -Public Class DoorManagerViewModel - Implements INotifyPropertyChanged - Private m_rfMainWindowViewModel As MainWindowViewModel - ' percorso della porta corrente (creata o già esistente nella cartella) !!! attenzione !!! - ' ora non si parla piu di avere una porta selezoionata ma ben si un assemblay selezionato, - ' questo comporta che possono esistere anche due porte contemporaneamente - Private m_SelectedDoor As String - Private NewDoor As Boolean = False - Friend DeleteNewDoor As Integer = 1 - - Private SelDoor As New Door - ' devo aggiungere la possibilità di creare anche una seconda porta (o in latermativa di non creare nessuna porta?) - Private SelDoor2 As New Door - - Friend MsgResult As MessageBoxResult - - ' creiamo un nuovo progetto: un nome e una lista di porte--> questo non deve essere modificato - Private m_CurrProject As New Project - Public Property CurrProject As Project - Get - Return m_CurrProject - End Get - Set(value As Project) - m_CurrProject = value - End Set - End Property - - ' percorso della porta in lettura (o creazione)--> che in realtà è i percorso dell'assemblay - Public Property SelectedDoor As String - Get - Return m_SelectedDoor - End Get - Set(value As String) - m_SelectedDoor = value - NotifyPropertyChanged("SelectedDoor") - End Set - End Property - - Private Sub DeleteDoorFromList() - Dim SelIndex As Integer = m_CurrProject.DoorList.IndexOf(m_SelectedDoor) - Dim ExtensionFile As String = Path.GetExtension(m_SelectedDoor) - Dim FileName As String = Path.GetFileName(m_SelectedDoor) - ' modifico l'estensione del file - FileName = FileName.Replace(ExtensionFile, ".err") - ' qui modifico il nome del file, ma ancora non è sostituito nel sistema - m_SelectedDoor = m_SelectedDoor.Replace(Path.GetFileName(m_SelectedDoor), FileName) - m_CurrProject.DoorList.RemoveAt(SelIndex) - CurrProject.NotifyPropertyChanged("DoorList") - ' se la lista non è rimasta vuota - If m_CurrProject.DoorList.Count > 0 Then - ' aggiorno la porta da visualizzare - If SelIndex > m_CurrProject.DoorList.Count - 1 Then - SelectedDoor = m_CurrProject.DoorList(SelIndex - 1) - Else - SelectedDoor = m_CurrProject.DoorList(SelIndex) - End If - ' se non ci sono altre porte nella lista allora - Else - ' elimino qualsiasi resto di porta - DirectCast(m_rfMainWindowViewModel.DoorParameters.DataContext, DoorParametersViewModel).CurrDoor = Nothing - ' aggiorni l'immagine a nulla - EgtNewFile() - EgtZoom(ZM.ALL) - End If - End Sub - - Public ReadOnly Property AddNewDoorToolTip As String - Get - Return EgtMsg(50302) - End Get - End Property - - Public ReadOnly Property RemoveDoorToolTip As String - Get - Return EgtMsg(50303) - End Get - End Property - - ' Definizione comandi - Private m_cmdAddDoor As ICommand - Private m_cmdRemoveDoor As ICommand - - Sub New(ByRef MainWindowViewModel As MainWindowViewModel) - m_rfMainWindowViewModel = MainWindowViewModel - End Sub - -#Region "METHODS" - ' questa funzione permetterà di leggere la scelta dell'assemblato (il nome del file da aprire) - Friend Function ChooseSelectedDoor(value As String) As Boolean - Dim Index As Integer = -1 - - If IsNothing(value) Then Return False - ' riferimento alla porta (per stampare il DDF) - Dim DoorParametersViewModel As DoorParametersViewModel = DirectCast(m_rfMainWindowViewModel.DoorParameters.DataContext, DoorParametersViewModel) - ' se eiste il file selezionato - If value = m_SelectedDoor Then - Return True - Exit Function - End If - If File.Exists(m_SelectedDoor) Then - ' prima di cambiare porta selezionata chiedo il salvataggio il quella precedente - ' se esiste una porta corrente associata al nome allora scrivo il file ddf per il disegno - If Not IsNothing(DoorParametersViewModel.CurrDoor) Then - ' è necessario che il file passato alla grafica non presenti espressioni numeriche - DdfFile.WriteDDF(DoorParametersViewModel.CurrDoor, IniFile.m_sTempDir & "\CurrDoor.ddf", True) - - Select Case DeleteNewDoor - ' se è una porta appena creata - Case 0 - ' chiedo se deve essere eliminata la porta che era stata creata - RemoveDoor() - DeleteNewDoor = 1 - ' se è una porta "vecchia" - Case 1 - ' confronto il file della porta originale e quello aggiornato: se i due file sono uguali eccetto la data - ' non faccio nulla - If DdfFile.SetModify(m_rfMainWindowViewModel) Then - - Else - ' altrimenti chiedo di salvare il file di disegno - MsgResult = MessageBox.Show(String.Format(EgtMsg(50109), Path.GetFileNameWithoutExtension(m_SelectedDoor)), EgtMsg(50110), MessageBoxButton.YesNoCancel, MessageBoxImage.Warning) - If MsgResult = MessageBoxResult.Yes Then - DdfFile.WriteDDF(DoorParametersViewModel.CurrDoor, m_SelectedDoor, True) - DirectCast(m_rfMainWindowViewModel.DoorParameters.DataContext, DoorParametersViewModel).bSetChange = False - ElseIf MsgResult = MessageBoxResult.Cancel Then - - 'NotifyPropertyChanged("SelectedDoor") - Return False - ElseIf (MsgResult = MessageBoxResult.No AndAlso DoorParametersViewModel.CurrDoor.NewDoor = True) Then - RemoveDoor() - End If - End If - - End Select - End If - End If - ' tolgo l'* dal titolo a prescindere che il file sia stato o no salvato - Dim SetTitle = DirectCast(m_rfMainWindowViewModel.DoorParameters.DataContext, DoorParametersViewModel).CurrProject.Name - m_rfMainWindowViewModel.ProjectNameMsg = SetTitle - ' se non esisteva nessuna porta allora posso procedere - m_SelectedDoor = value - NotifyPropertyChanged("SelectedDoor") - SelDoor = Nothing - SelDoor = New Door - SelDoor.NewDoor = NewDoor - If SelDoor.NewDoor Then - 'OptionModule.GeneralDoor.CompoList.Clear() - SelDoor.Width = OptionModule.m_Width - SelDoor.Height = OptionModule.m_Height - SelDoor.Thickness = OptionModule.m_Thickness - SelDoor.Weight = OptionModule.m_Weight - SelDoor.Swing = OptionModule.m_Swing - - SelDoor.LockEdgeType = OptionModule.m_LockEdgeType - SelDoor.HingeEdgeType = OptionModule.m_HingeEdgeType - SelDoor.TopType = OptionModule.m_TopType - SelDoor.BottomType = OptionModule.m_BottomType - - SelDoor.LockEdgeMachining = OptionModule.m_LockEdgeMachining - SelDoor.HingeEdgeMachining = OptionModule.m_HingeEdgeMachining - SelDoor.TopMachining = OptionModule.m_TopMachining - SelDoor.BottomMachining = OptionModule.m_BottomMachining - SelDoor.LockEdgeOverMaterial = OptionModule.m_LockEdgeOverMaterial - SelDoor.HingeEdgeOverMaterial = OptionModule.m_HingeEdgeOverMaterial - SelDoor.TopOverMaterial = OptionModule.m_TopOverMaterial - SelDoor.BottomOverMaterial = OptionModule.m_BottomOverMaterial - ' assegno la porta creata alla Programma come porta corrente - DoorParametersViewModel.CurrDoor = SelDoor - ' scrivo il ddf della nuova porta come file temp - If Not IsNothing(DoorParametersViewModel.CurrDoor) Then DdfFile.WriteDDF(DoorParametersViewModel.CurrDoor, IniFile.m_sTempDir & "\CurrDoor.ddf", True) - ' e stampo il nuovo ddf - DdfFile.WriteDDF(DoorParametersViewModel.CurrDoor, m_SelectedDoor, True) - ' quindi da ora la nuova porta ha un suo DDF che possiamo trattare come tutti gli altri - ' assegno il valore falso cosi da non ripetere questa operazione nel caso in cui si arrivi dalla funzione AddDoor - SelDoor.NewDoor = True - NewDoor = False - End If - ' per aggiornare la parte grafica - ' se il nome della porta è uno spazio vuoto allora non genero la porta ( per esempio sto aprendo una cartella vuota) - If Not String.IsNullOrWhiteSpace(m_SelectedDoor) Then - ' leggo il file ddf - Door.ReadDDF(m_SelectedDoor, SelDoor) - ' assegno come porta del programma quella aperta - DoorParametersViewModel.CurrDoor = SelDoor - ' copio il file DDF come file DDF temporaneo - If Not IsNothing(DoorParametersViewModel.CurrDoor) Then - DdfFile.WriteDDF(SelDoor, IniFile.m_sTempDir & "\CurrDoor.ddf", True) - ExecDoors(DirectCast(m_rfMainWindowViewModel.SceneManager.DataContext, SceneManagerViewModel).ProjectScene, IniFile.m_sTempDir & "\CurrDoor.ddf") - ' dal MainWindowViewModel accediamo alla ScenaManagerViewModel (primo DirectCast) - ' dalla StatusBar accediamo alla proprietà pubblica UnitMeasure - DirectCast(DirectCast(m_rfMainWindowViewModel.SceneManager.DataContext, SceneManagerViewModel).StatusBar.DataContext, StatusBarViewModel).UnitMeasure = SelDoor.Measure - End If - End If - If IsNothing(SelDoor) Then - MessageBox.Show(EgtMsg(50145), EgtMsg(50118), MessageBoxButton.OK, MessageBoxImage.Exclamation) - DoorParametersViewModel.CurrDoor = Nothing - DeleteDoorFromList() - End If - Return True - End Function -#End Region ' METHODS - -#Region "COMMANDS" - -#Region "AddDoorCommand" - - ''' - ''' Returns a command that do New. - ''' - Public ReadOnly Property AddDoorCommand As ICommand - Get - If m_cmdAddDoor Is Nothing Then - m_cmdAddDoor = New Command(AddressOf AddDoor) - End If - Return m_cmdAddDoor - End Get - End Property - - ''' - ''' Execute the New. This method is invoked by the NewCommand. - ''' - Public Sub AddDoor() - Dim NameExist As Boolean = True - Dim ImportTemplate As String = String.Empty - 'Prima di tutto chiedo se vuole aprire un template - If MessageBox.Show(EgtMsg(50146), EgtMsg(50110), MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes) = MessageBoxResult.Yes Then - ' Apro la finestra di dailogo aperta direttamente sulla cartella cercata - Dim OpenFileDialog As New System.Windows.Forms.OpenFileDialog - - - OpenFileDialog.InitialDirectory = IniFile.m_TemplateDir - If OpenFileDialog.ShowDialog <> Forms.DialogResult.OK Then - ' se la risposta è diversa da OK esce - Return - End If - ' carico l'indirizzo del template che voglio aprire - ImportTemplate = OpenFileDialog.FileName - End If - - ' lancio la finestra per la creazione di una nuova porta - Dim SaveFileDialog As New EgtWPFLib5.EgtSaveFileDialog - SaveFileDialog.Title = K_NEWDOOR - SaveFileDialog.Directory = m_CurrProject.Name - SaveFileDialog.Extension = K_DDFEXTENSION - 'SaveFileDialog.FileName = m_CurrProject.Name & "\" - ' se decido di chiuedere la finestra - If Not SaveFileDialog.EgtShowDialog Then - Return - End If - ' Controllo se ha estensione il nome della porta - If Path.HasExtension(SaveFileDialog.FileName) Then - Dim sExtension As String = Path.GetExtension(SaveFileDialog.FileName) - If Not sExtension.ToLower = K_DDFEXTENSION Then - SaveFileDialog.FileName = SaveFileDialog.FileName.Replace(sExtension, K_DDFEXTENSION) - End If - Else - SaveFileDialog.FileName &= K_DDFEXTENSION - End If - ' controllo che il nome non sia presente nella lista - Dim bNameExist As Boolean = False - Dim IndexDoorList As Integer - For IndexDoorList = 0 To CurrProject.DoorList.Count - 1 - If CurrProject.DoorList(IndexDoorList) = SaveFileDialog.FileName Then - ' se il nome è nella lista allora esco dal ciclo e rendo falsa la variabile bNameExist - bNameExist = True - Exit For - End If - bNameExist = False - Next - - ' se il nome è nella lista allora sovrascirvo sulla porta esistente - If bNameExist Then - ' elimino la porta esistente - File.Delete(SaveFileDialog.FileName) - ' elimino dalla lista - m_CurrProject.DoorList.Remove(SaveFileDialog.FileName) - CurrProject.NotifyPropertyChanged("DoorList") - End If - - ' aggiungo il nome del file alla lista delle porte - CurrProject.DoorList.Add(SaveFileDialog.FileName) - ' aggiorno la lista - CurrProject.NotifyPropertyChanged("DoorList") - NewDoor = True - - If String.IsNullOrEmpty(ImportTemplate) Then - NewDoor = True - Else - NewDoor = False - ' creo il file ddf associato al template - Dim TemplateDoor As New Door - Door.ReadDDF(ImportTemplate, TemplateDoor) - WriteDDF(TemplateDoor, SaveFileDialog.FileName, False) - End If - ChooseSelectedDoor(SaveFileDialog.FileName) - SelectedDoor = SaveFileDialog.FileName - ' con la dichiarazione seguente salto non considero più di chiedere se eliminare la porta già esistente - DeleteNewDoor = 1 - End Sub - -#End Region ' AddDoorCommand - -#Region "RemoveDoorCommand" - - ''' - ''' Returns a command that do New. - ''' - Public ReadOnly Property RemoveDoorCommand As ICommand - Get - If m_cmdRemoveDoor Is Nothing Then - m_cmdRemoveDoor = New Command(AddressOf RemoveDoor) - End If - Return m_cmdRemoveDoor - End Get - End Property - - ''' - ''' Execute the New. This method is invoked by the NewCommand. - ''' - Public Sub RemoveDoor() - Dim DeletingQuestion As Integer = 0 - Dim DeletingResult As MessageBoxResult = MessageBoxResult.No - - If Not IsNothing(m_SelectedDoor) Then - DeleteNewDoor = -1 - ' salvo il nome del file che sta per essere eliminato - Dim RemoveDoorName As String = Path.GetFileNameWithoutExtension(m_SelectedDoor) - - If DirectCast(m_rfMainWindowViewModel.DoorParameters.DataContext, DoorParametersViewModel).CurrDoor.NewDoor Then - ' se sono arrivato qui signifoca che sto chiudendo il programma con una porta nuova aperta ma non salvata - ' se ho dichiarato che non voglio salvare significa che devo eliminare - DeletingResult = MessageBoxResult.Yes - Else - ' stamp a video il messaggio per chiedere se eliminare - DeletingResult = MessageBox.Show(String.Format(EgtMsg(50116), Path.GetFileNameWithoutExtension(m_SelectedDoor)), EgtMsg(50110), MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No) - End If - - ' chiedo se devo eliminere il file: se si - If DeletingResult = MessageBoxResult.Yes Then - ' ricerco l'indice del file all'interno della lista delle porte - Dim SelIndex As Integer = m_CurrProject.DoorList.IndexOf(m_SelectedDoor) - ' elimino dall'elenco dei file - File.Delete(m_SelectedDoor) - ' elimino dalla lista - m_CurrProject.DoorList.Remove(m_SelectedDoor) - CurrProject.NotifyPropertyChanged("DoorList") - ' per quando torno nel m_SelectedDoor...per non chiedere di salvare o eliminare - DeleteNewDoor = -1 - ' se la lista non è rimasta vuota - If m_CurrProject.DoorList.Count > 0 Then - ' aggiorno la porta da visualizzare - If SelIndex > m_CurrProject.DoorList.Count - 1 Then - SelectedDoor = m_CurrProject.DoorList(SelIndex - 1) - ChooseSelectedDoor(SelectedDoor) - Else - SelectedDoor = m_CurrProject.DoorList(SelIndex) - ChooseSelectedDoor(SelectedDoor) - End If - ' se non ci sono altre porte nella lista allora - Else - ' elimino qualsiasi resto di porta - DirectCast(m_rfMainWindowViewModel.DoorParameters.DataContext, DoorParametersViewModel).CurrDoor = Nothing - ' aggiorni l'immagine a nulla - EgtNewFile() - EgtZoom(ZM.ALL) - End If - Else - ' altrimenti salvo il file - DdfFile.WriteDDF(DirectCast(m_rfMainWindowViewModel.DoorParameters.DataContext, DoorParametersViewModel).CurrDoor, m_SelectedDoor, True) - End If - End If - End Sub - -#End Region ' RemoveDoorCommand - -#End Region ' Commands - - Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged - - Public Sub NotifyPropertyChanged(propName As String) - RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName)) - End Sub - -End Class - -' Restituisce solo il nome del file del progetto aperto -Public Class PathConverter - Implements IValueConverter - - Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert - Dim sPath As String = CStr(value) - Return Path.GetFileNameWithoutExtension(sPath) - End Function - - Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack - Throw New NotImplementedException - End Function - -End Class - -' Nasconde i pulsanti +/- se la lista di porte non contiene nulla -Public Class ProjectVisibilityConverter - Implements IValueConverter - - Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert - Dim sProjectName As String = CStr(value) - Return If(Directory.Exists(sProjectName), Visibility.Visible, Visibility.Collapsed) - End Function - - Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack - Throw New NotImplementedException - End Function - -End Class \ No newline at end of file diff --git a/DoorParameters/Compo.vb b/DoorParameters/Compo.vb index 540e2d5..1130ee6 100644 --- a/DoorParameters/Compo.vb +++ b/DoorParameters/Compo.vb @@ -6,24 +6,24 @@ Imports EgtUILib Public Class Compo Implements INotifyPropertyChanged Friend TempFileDDF As String = IniFile.m_sTempDir & "\" & TEMP_FILE - Friend m_rfCurrDoor As Door + 'Friend m_rfCurrDoor As Part ' definizione della funzione delegato: riceve il valore di modifica della compo e della general 'Delegate Function CompareIsModify(rIsModifyCompo As Boolean, rIsModifyDoor As Boolean) As Boolean - ' aggiorno la variabile globale di cambiamento: verifico che sia il template che una combo/text sono state modificate - Function IsModify() As Boolean - If m_IsModifiedTemplateSelItem Then - Return True - End If - For IndexCompoParamList = 0 To Me.CompoParamList.Count - 1 - If Me.CompoParamList(IndexCompoParamList).m_IsModifyCompoParam Then - m_rfCurrDoor.m_IsModifyDoor = True - Return True - End If - Next - Return False - End Function + '' aggiorno la variabile globale di cambiamento: verifico che sia il template che una combo/text sono state modificate + 'Function IsModify() As Boolean + ' If m_IsModifiedTemplateSelItem Then + ' Return True + ' End If + ' For IndexCompoParamList = 0 To Me.CompoParamList.Count - 1 + ' If Me.CompoParamList(IndexCompoParamList).m_IsModifyCompoParam Then + ' m_rfCurrDoor.m_IsModifyDoor = True + ' Return True + ' End If + ' Next + ' Return False + 'End Function ' creo la stringa che contiene la lista degli errori Dim ErrorList As String = String.Empty @@ -36,6 +36,36 @@ Public Class Compo End Get End Property + Private m_refCompoJamb As Compo + Public Property refJambCompo As Compo + Get + Return m_refCompoJamb + End Get + Set(value As Compo) + m_refCompoJamb = value + End Set + End Property + + Private m_IsReadOnly As Boolean = True + Public Property IsReadOnly As Boolean + Get + Return m_IsReadOnly + End Get + Set(value As Boolean) + m_IsReadOnly = value + End Set + End Property + + Private m_IdCode As String + Public Property IdCode As String + Get + Return m_IdCode + End Get + Set(value As String) + m_IdCode = value + End Set + End Property + #Region "Template ComboBox" Private m_TemplateName As String @@ -76,8 +106,9 @@ Public Class Compo End Get Set(value As String) SetTemplateSelItem(value) - m_IsModifiedTemplateSelItem = True - m_rfCurrDoor.SetTitle() + 'm_IsModifiedTemplateSelItem = True + 'm_rfCurrDoor.SetTitle() + Map.refAssemblyManagerVM.SelectedAssembly.IsModify = True End Set End Property @@ -92,7 +123,6 @@ Public Class Compo If Not File.Exists(CurrItemPath) Then Return m_TemplateSelItem = value ' creo la stringa che contiene la lista degli errori - Dim ParamIndex As Integer = 1 Dim ConfigDefault As String = String.Empty Dim NewCompoParam As CompoParam = Nothing @@ -113,27 +143,22 @@ Public Class Compo For LineIndex = 0 To ReadCurrCompo.Count - 1 ' copio il valore della riga Dim CurrCompoFileLine As String = ReadCurrCompo(LineIndex) - ' cerco il titolo [Graphic parameters]: se lo trovo If RegexFunction.IsGraphicParametersTitle(CurrCompoFileLine) Then ' mi preparo per leggere la prima riga dopo il titolo - Dim ParamIndex As Integer = 1 Dim NewCompoParam As CompoParam = Nothing Dim bIsFinished As Boolean = False - ' se la lettura del primo parametro "--Default=" restituisce un valore non nullo If Not String.IsNullOrWhiteSpace(ParamLine(ReadCurrCompo(LineIndex + ParamIndex), K_DEFAULT)) Then Dim ConfigDefault As String = Trim(ParamLine(ReadCurrCompo(LineIndex + ParamIndex), K_DEFAULT)) If Not IsNumeric(ConfigDefault) Then ' se il valore letto non è numerico allora esco dal cilo per la lettura dei parametri Exit For - Else ReadParamConfig(NewCompoParam, ErrorList, ParamIndex, ConfigDefault) Exit For End If - Else ' se il primo parametro non è "Dafault" allora mi aspetto di leggere i parametri While Not bIsFinished @@ -176,6 +201,54 @@ Public Class Compo End If Next End If + '---------------------------------------------------------------------------------------------------------------------------------------------- + Dim FrameCompoFile As String = String.Empty + Dim FrameCompoFileConfig As String = String.Empty + If Not IsNothing(Me.refJambCompo) Then + If Not File.Exists(Me.CompoType.Path & "\" & "Matching.lua") Then + EgtOutLog("SetUp error: SetUp configuration file (" & Me.CompoType.Path & "\" & "Matching.lua)" & " doesn't exist ") + 'MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 7), EgtMsg(MSG_SETUPERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error) + 'Return False + Else + EgtLuaExecFile(Me.CompoType.Path & "\" & "Matching.lua") + EgtLuaSetGlobIntVar("STU.DoorNumber", CInt(Map.refAssemblyPageVM.CurrAssembly.DoorNumber)) + EgtLuaSetGlobStringVar("STU.CompoPath", Me.CompoType.Path) + EgtLuaSetGlobStringVar("STU.Template", Me.TemplateSelItem) + EgtLuaCallFunction("STU.Matching") + EgtLuaGetGlobStringVar("STU.OutTemplate", FrameCompoFile) + ' se esite una corrispondenza nella tabella allora procedo + If Not String.IsNullOrEmpty(FrameCompoFile) Then + If Not SearchFileConfig(FrameCompoFile, FrameCompoFileConfig) Then + MessageBox.Show("Compo does not exist", "Error", MessageBoxButton.OK, MessageBoxImage.Error) + Else + Dim FrameCompoNameDDF As String = String.Empty + Dim FrameCompoName As String = String.Empty + Dim Side As String = String.Empty + 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("PositionSide", "Side", Side, CurrCompoPath) + If String.IsNullOrEmpty(Side) Then Side = Me.CompoType.JambSide + Me.refJambCompo.CompoType.SetDDFName(FrameCompoNameDDF) + Me.refJambCompo.CompoType.SetName(FrameCompoName) + Dim FrameCompoDirectory As String + FrameCompoDirectory = FrameCompoFileConfig.Remove(FrameCompoFileConfig.LastIndexOf("\")) + Me.refJambCompo.CompoType.SetPath(FrameCompoDirectory) + Me.refJambCompo.CompoType.SetJambSide(Side) + End If + End If + If Not IsNothing(Me.refJambCompo) Then + ' Carico il nome + FrameCompoFile = FrameCompoFile.Substring(FrameCompoFileConfig.LastIndexOf("\") + 1) + + Me.refJambCompo.SetTemplateSelItemRefCompo(FrameCompoFile, Me) + Map.refAssemblyPageVM.CurrAssembly.UpDateCurrCompoJamb(Me) + End If + End If + End If + End If + '---------------------------------------------------------------------------------------------------------------------------------------------- End Sub ' setto la lista dei parametri da caricare la lista dei paramestri @@ -223,6 +296,144 @@ Public Class Compo End If End Sub + ' a differenza delle funzioni sopra queste ricevono come parametro l'oggetto compo che deve essere modificato + ' il prossimo passo sarà eliminare le funzioni sopra scritte per lasciare solo queste +#Region "SettemplateREFCOMPO" + Friend Sub SetTemplateSelItemRefCompo(value As String, CurrRefCompo As Compo) + Dim CurrConfig As String = CurrRefCompo.refJambCompo.CompoType.Path & "\" & CONFIGINI_FILE_NAME + Dim CurrItemPath As String = CurrRefCompo.refJambCompo.CompoType.Path & "\" & value + Dim ErrorList As String = String.Empty + ' se il file ha estensione nge + If Path.HasExtension(CurrItemPath) AndAlso Path.GetExtension(CurrItemPath).ToLower = K_NGEEXTENSION Then + ' controllo che esiste il file altrimenti esco + If Not File.Exists(CurrItemPath) Then Return + CurrRefCompo.refJambCompo.TemplateSelItem = value + ' creo la stringa che contiene la lista degli errori + Dim ParamIndex As Integer = 1 + Dim ConfigDefault As String = String.Empty + Dim NewCompoParam As CompoParam = Nothing + EgtUILib.GetPrivateProfileString(S_NGECONFIG, K_DEFAULT, "", ConfigDefault, CurrConfig) + ' ricerco la parola chiave Param nella stringa nel file Cinfig.ini + ReadParamConfig(NewCompoParam, ErrorList, ParamIndex, ConfigDefault) + Else + ' se il file non ha estensione allora creo l'estensione .lua + CurrItemPath &= K_LUAEXTENSION + ' controllo che esiste il file altrimenti esco + If Not File.Exists(CurrItemPath) Then Return + CurrRefCompo.refJambCompo.TemplateSelItem = value + ' carico un vettore con le stringhe del file corrente + Dim ReadCurrCompo() As String = File.ReadAllLines(CurrItemPath) + Dim EndOfFile As Boolean = False + ' leggo il vettore di stringhe del file corrente + For LineIndex = 0 To ReadCurrCompo.Count - 1 + ' copio il valore della riga + Dim CurrCompoFileLine As String = ReadCurrCompo(LineIndex) + ' cerco il titolo [Graphic parameters]: se lo trovo + If RegexFunction.IsGraphicParametersTitle(CurrCompoFileLine) Then + ' mi preparo per leggere la prima riga dopo il titolo + Dim ParamIndex As Integer = 1 + Dim NewCompoParam As CompoParam = Nothing + Dim bIsFinished As Boolean = False + ' se la lettura del primo parametro "--Default=" restituisce un valore non nullo + If Not String.IsNullOrWhiteSpace(ParamLine(ReadCurrCompo(LineIndex + ParamIndex), K_DEFAULT)) Then + Dim ConfigDefault As String = Trim(ParamLine(ReadCurrCompo(LineIndex + ParamIndex), K_DEFAULT)) + If Not IsNumeric(ConfigDefault) Then + ' se il valore letto non è numerico allora esco dal cilo per la lettura dei parametri + Exit For + Else + ReadParamConfig(NewCompoParam, ErrorList, ParamIndex, ConfigDefault) + Exit For + End If + Else + ' se il primo parametro non è "Dafault" allora mi aspetto di leggere i parametri + While Not bIsFinished + ' attualizzo il componente a nulla + NewCompoParam = Nothing + ' cerco nella riga successiva al titolo il primo parametro + If Not String.IsNullOrWhiteSpace(ReadCurrCompo(LineIndex + ParamIndex)) Then + Dim ReadLine As String + ' carico i valori della stringa che seguono la chiave "--Param1=" + ReadLine = ParamLine(ReadCurrCompo(LineIndex + ParamIndex), K_PARAM & ParamIndex) + + ' se uno dei paraemtri è completamente sbagliato allora restituisce falso e non riempo la NewCompoParam che rimane Nothing + bIsFinished = Not ReadParam(ReadLine, NewCompoParam, ErrorList) + Else + ' altrimenti se la riga è vuota mi sposto alla successiva + LineIndex += 1 + ' e continuo il ciclo while + Continue While + End If + ' insrisco la nuova componenenet: se la riga è vuota o la componente non è stata creata allora il componete è Nothing + InsertCompoParam(NewCompoParam, ParamIndex) + ' se il parametro è stato creato passa alla riga successiva + If Not bIsFinished Then ParamIndex += 1 + End While + NotifyPropertyChanged("TemplateSelItem") + End If + + ' esiste già una lista + For DeleteIndex = Me.refJambCompo.CompoParamList.Count - 1 To ParamIndex - 1 Step -1 + Me.refJambCompo.CompoParamList.RemoveAt(DeleteIndex) + Next + Exit For + ElseIf LineIndex = ReadCurrCompo.Count - 1 Then + ' se non trovo il capitoletto nel file leggo i parametri di default del file Config.ini + + Dim ParamIndex As Integer = 1 + Dim NewCompoParam As CompoParam = Nothing + ReadParamConfigRefCompo(NewCompoParam, ErrorList, ParamIndex, "", CurrRefCompo) + Exit For + End If + Next + End If + End Sub + + ' setto la lista dei parametri da caricare la lista dei paramestri + Private Sub ReadParamConfigRefCompo(ByRef NewCompoParam As CompoParam, ByRef ErrorList As String, ParamIndex As Integer, DefaultConfig As String, CurrRefCompo As Compo) + Dim sParam As String = String.Empty + Dim CurrConfig As String = CurrRefCompo.CompoType.Path & "\" & CONFIGINI_FILE_NAME + Dim S_CHAPTER As String + + If String.IsNullOrWhiteSpace(DefaultConfig) Then + S_CHAPTER = S_GR_PARAM_DEFAULT & "1" + Else + S_CHAPTER = S_GR_PARAM_DEFAULT & DefaultConfig + End If + + While EgtUILib.GetPrivateProfileString(S_CHAPTER, K_PARAM & ParamIndex, "", sParam, CurrConfig) > 0 + If Not String.IsNullOrWhiteSpace(sParam) Then + ' leggo il tipo di parametro + ReadParam(sParam, NewCompoParam, ErrorList) + ' carico il parametro nella lista della componente + InsertCompoParamRef(NewCompoParam, ParamIndex, CurrRefCompo) + End If + ParamIndex += 1 + End While + ' controllo di aver tolto tutti i parametri che potrrebbero esistere da una precedente chiamata + For DeleteIndex = CurrRefCompo.CompoParamList.Count - 1 To ParamIndex - 1 Step -1 + CurrRefCompo.CompoParamList.RemoveAt(DeleteIndex) + Next + End Sub + + ' inserisco il parametro letto nella lista dei paramtri senza modificare i parametri già esistenti + Private Sub InsertCompoParamRef(NewCompoParam As CompoParam, ParamIndex As Integer, CurrRefCompo As Compo) + If Not IsNothing(NewCompoParam) Then + ' se non esiste l'indice + If Not CurrRefCompo.CompoParamList.Count > ParamIndex - 1 Then + ' creo il parametro combo + CurrRefCompo.CompoParamList.Insert(ParamIndex - 1, NewCompoParam) + Else + ' se esiste ma è diverso il nome DDF + If Not m_CompoParamList(ParamIndex - 1).DDFName = NewCompoParam.DDFName Then + ' creo il nuovo parametro combo + CurrRefCompo.CompoParamList.RemoveAt(ParamIndex - 1) + CurrRefCompo.CompoParamList.Insert(ParamIndex - 1, NewCompoParam) + End If + End If + End If + End Sub +#End Region ' SetTemplateREFCOMPO + ' leggo il nome DDF e il nome, restituisco il nome solo se esiste un messaggio associato Private Function MsgControl(sDDFName As String, sName As String, ByRef sErrorList As String) As String ' se è numerico ma non esiste un messaggio associato @@ -269,9 +480,9 @@ Public Class Compo Next ' se il nome DDF non è separato dal diviso vuol dire che non c'è nessun messaggio associato, quindi scrivo due volte il messaggio DDF If sItems(1).Split("/"c).Count = 1 Then - NewCompoParam = New ComboBoxParam(Trim(sItems(1)), MsgControl(Trim(sItems(1)), "-1", sErrorList), ComboItemList, DDFComboItemList, ComboItemList(0)) + NewCompoParam = New ComboBoxParam(Trim(sItems(1)), MsgControl(Trim(sItems(1)), "-1", sErrorList), Me, ComboItemList, DDFComboItemList, ComboItemList(0)) Else - NewCompoParam = New ComboBoxParam(Trim(sItems(1).Split("/"c)(0)), Trim(MsgControl(sItems(1).Split("/"c)(0), sItems(1).Split("/"c)(1), sErrorList)), ComboItemList, DDFComboItemList, ComboItemList(0)) + NewCompoParam = New ComboBoxParam(Trim(sItems(1).Split("/"c)(0)), Trim(MsgControl(sItems(1).Split("/"c)(0), sItems(1).Split("/"c)(1), sErrorList)), Me, ComboItemList, DDFComboItemList, ComboItemList(0)) End If Return True Else @@ -282,9 +493,9 @@ Public Class Compo Case "TextBox" 'ConvertTextBoxString(sItems) - Dim dHeight As Double + Dim dHeight As Double = 500 ' leggo il valore altezza che già esite nella porta - StringToDouble(m_rfCurrDoor.Height, dHeight) + '------------------------------StringToDouble(m_rfCurrDoor.Height, dHeight) Dim dDefaultValue As Double ' verifico che sono presenti "TextBox; NomeDDF/Nome" If sItems.Count > 2 Then @@ -297,58 +508,22 @@ Public Class Compo If dDefaultValue < dHeight Then ' verifico che sono presenti "TextBox; NomeDDF/Nome; Valore; NomeLista; NomeElementoLista" If sItems.Count > 4 Then - '' ' creo la lista associata alla TextBox se esiste almeno un elemento - '' Dim DDFComboValuelList As New List(Of String) - '' ' carico gli elementi della lista in un vettore - '' Dim sComboItemList() As String = sItems(5).Split(","c) - '' ' carico la lista dal vettore - '' For ItemIndex = 0 To sComboItemList.Count - 1 - '' DDFComboValuelList.Add(Trim(sComboItemList(ItemIndex))) - '' Next - '' ' cerco nella lista dei paraletri già esistenti il nome della lista a cui fa riferimento - '' For ParamIndex = 0 To m_CompoParamList.Count - 1 - '' Dim CurrCompoParam As CompoParam = m_CompoParamList(ParamIndex) - '' ' verifico che il nome della lista associata esista - '' If CurrCompoParam.DDFName = sItems(4) Then - '' ' verifico che il nome del paramertro è di una combobox - '' If TypeOf CurrCompoParam Is ComboBoxParam Then - '' ' creo la componente nuova - '' NewCompoParam = New TextBoxParam(sItems(1), MsgControl(sItems(1), Utility.ReadMsg(sItems(2)), sErrorList), sDefaultValue, DirectCast(CurrCompoParam, ComboBoxParam), DDFComboValuelList) - '' Return True - '' Else - '' ' se esiste il nome della lista associata ma non è una combobox creo il componente senza la lista - '' NewCompoParam = New TextBoxParam(sItems(1), MsgControl(sItems(1), sItems(2), sErrorList), sDefaultValue, Nothing, Nothing) - '' sErrorList &= String.Format(EgtMsg(50122), sItems(4), m_CompoType.DDFName) - '' Return True - '' End If - '' Exit For - '' End If - '' Next - '' ' se non trovo nella lista dei parametri il nome della lista creo il componente senza la lista - '' NewCompoParam = New TextBoxParam(sItems(1), MsgControl(sItems(1), sItems(2), sErrorList), sDefaultValue, Nothing, Nothing) - '' sErrorList &= String.Format(EgtMsg(50121), sItems(4), m_CompoType.DDFName) - '' Return True - ''ElseIf sItems.Count = 4 Then - '' 'se non esiste una lista ma solo il nome della lista - '' NewCompoParam = New TextBoxParam(sItems(1), MsgControl(sItems(1), sItems(2), sErrorList), sDefaultValue, Nothing, Nothing) - '' sErrorList &= String.Format(EgtMsg(50123), sItems(4), m_CompoType.DDFName) - '' Return True ElseIf sItems.Count = 3 Then ' se la text contiente solo 4 parametri If sItems(1).Split("/"c).Count = 1 Then - NewCompoParam = New TextBoxParam(Trim(sItems(1)), MsgControl(Trim(sItems(1)), "-1", sErrorList), sDefaultValue, Nothing, Nothing) + NewCompoParam = New TextBoxParam(Trim(sItems(1)), MsgControl(Trim(sItems(1)), "-1", sErrorList), Me, sDefaultValue, Nothing, Nothing) Else - NewCompoParam = New TextBoxParam(Trim(sItems(1).Split("/"c)(0)), Trim(MsgControl(sItems(1).Split("/"c)(0), sItems(1).Split("/"c)(1), sErrorList)), sDefaultValue, Nothing, Nothing) + NewCompoParam = New TextBoxParam(Trim(sItems(1).Split("/"c)(0)), Trim(MsgControl(sItems(1).Split("/"c)(0), sItems(1).Split("/"c)(1), sErrorList)), Me, sDefaultValue, Nothing, Nothing) End If Return True End If Else ' se la misura passata è più grande di quella della porta non carico il valore e creo il parametro senza lista If sItems(1).Split("/"c).Count = 1 Then - NewCompoParam = New TextBoxParam(Trim(sItems(1)), MsgControl(Trim(sItems(1)), "-1", sErrorList), "0.000", Nothing, Nothing) + NewCompoParam = New TextBoxParam(Trim(sItems(1)), MsgControl(Trim(sItems(1)), "-1", sErrorList), Me, "0.000", Nothing, Nothing) sErrorList &= String.Format(EgtMsg(50124), MsgControl(sItems(1), "-1", sErrorList), m_CompoType.DDFName, sDefaultValue) Else - NewCompoParam = New TextBoxParam(Trim(sItems(1).Split("/"c)(0)), Trim(MsgControl(sItems(1).Split("/"c)(0), sItems(1).Split("/"c)(1), sErrorList)), "0.000", Nothing, Nothing) + NewCompoParam = New TextBoxParam(Trim(sItems(1).Split("/"c)(0)), Trim(MsgControl(sItems(1).Split("/"c)(0), sItems(1).Split("/"c)(1), sErrorList)), Me, "0.000", Nothing, Nothing) sErrorList &= String.Format(EgtMsg(50124), MsgControl(sItems(1).Split("/"c)(0), sItems(1).Split("/"c)(1), sErrorList), m_CompoType.DDFName, sDefaultValue) End If @@ -357,9 +532,9 @@ Public Class Compo End If Else If sItems(1).Split("/"c).Count = 1 Then - NewCompoParam = New TextBoxParam(Trim(sItems(1)), MsgControl(Trim(sItems(1)), "-1", sErrorList), "0.000", Nothing, Nothing) + NewCompoParam = New TextBoxParam(Trim(sItems(1)), MsgControl(Trim(sItems(1)), "-1", sErrorList), Me, "0.000", Nothing, Nothing) Else - NewCompoParam = New TextBoxParam(Trim(sItems(1).Split("/"c)(0)), Trim(MsgControl(sItems(1).Split("/"c)(0), sItems(1).Split("/"c)(1), sErrorList)), "0.000", Nothing, Nothing) + NewCompoParam = New TextBoxParam(Trim(sItems(1).Split("/"c)(0)), Trim(MsgControl(sItems(1).Split("/"c)(0), sItems(1).Split("/"c)(1), sErrorList)), Me, "0.000", Nothing, Nothing) End If Dim ErrorExpression As String = String.Format(EgtMsg(50147), NewCompoParam.Name, sItems(2)) @@ -370,10 +545,10 @@ Public Class Compo ElseIf sItems.Count = 2 Then ' se la stringa ha 2 elemtni "TextBox; NomeDDF/Nome" If sItems(1).Split("/"c).Count = 1 Then - NewCompoParam = New TextBoxParam(Trim(sItems(1)), MsgControl(Trim(sItems(1)), "-1", sErrorList), "0.000", Nothing, Nothing) + NewCompoParam = New TextBoxParam(Trim(sItems(1)), MsgControl(Trim(sItems(1)), "-1", sErrorList), Me, "0.000", Nothing, Nothing) sErrorList &= String.Format(EgtMsg(50125), MsgControl(sItems(1), "-1", sErrorList), m_CompoType.DDFName) Else - NewCompoParam = New TextBoxParam(Trim(sItems(1).Split("/"c)(0)), Trim(MsgControl(sItems(1).Split("/"c)(0), sItems(1).Split("/"c)(1), sErrorList)), "0.000", Nothing, Nothing) + NewCompoParam = New TextBoxParam(Trim(sItems(1).Split("/"c)(0)), Trim(MsgControl(sItems(1).Split("/"c)(0), sItems(1).Split("/"c)(1), sErrorList)), Me, "0.000", Nothing, Nothing) sErrorList &= String.Format(EgtMsg(50125), MsgControl(sItems(1).Split("/"c)(0), sItems(1).Split("/"c)(1), sErrorList), m_CompoType.DDFName) End If Return True @@ -386,9 +561,9 @@ Public Class Compo End If Case "TextBoxOnOff" - Dim dHeight As Double + Dim dHeight As Double = 500 ' leggo il valore altezza che già esite nella porta - StringToDouble(m_rfCurrDoor.Height, dHeight) + '------------------------------------------------StringToDouble(m_rfCurrDoor.Height, dHeight) Dim dDefaultValue As Double ' verifico che sono presenti "TextBox; NomeDDF/Nome" If sItems.Count > 2 Then @@ -401,58 +576,22 @@ Public Class Compo If dDefaultValue < dHeight Then ' verifico che sono presenti "TextBox; NomeDDF/Nome; Valore; NomeLista; NomeElementoLista" If sItems.Count > 4 Then - '' ' creo la lista associata alla TextBox se esiste almeno un elemento - '' Dim DDFComboValuelList As New List(Of String) - '' ' carico gli elementi della lista in un vettore - '' Dim sComboItemList() As String = sItems(5).Split(","c) - '' ' carico la lista dal vettore - '' For ItemIndex = 0 To sComboItemList.Count - 1 - '' DDFComboValuelList.Add(Trim(sComboItemList(ItemIndex))) - '' Next - '' ' cerco nella lista dei paraletri già esistenti il nome della lista a cui fa riferimento - '' For ParamIndex = 0 To m_CompoParamList.Count - 1 - '' Dim CurrCompoParam As CompoParam = m_CompoParamList(ParamIndex) - '' ' verifico che il nome della lista associata esista - '' If CurrCompoParam.DDFName = sItems(4) Then - '' ' verifico che il nome del paramertro è di una combobox - '' If TypeOf CurrCompoParam Is ComboBoxParam Then - '' ' creo la componente nuova - '' NewCompoParam = New TextBoxOnOffParam(sItems(1), MsgControl(sItems(1), Utility.ReadMsg(sItems(2)), sErrorList), sDefaultValue, DirectCast(CurrCompoParam, ComboBoxParam), DDFComboValuelList) - '' Return True - '' Else - '' ' se esiste il nome della lista associata ma non è una combobox creo il componente senza la lista - '' NewCompoParam = New TextBoxOnOffParam(sItems(1), MsgControl(sItems(1), sItems(2), sErrorList), sDefaultValue, Nothing, Nothing) - '' sErrorList &= String.Format(EgtMsg(50122), sItems(4), m_CompoType.DDFName) - '' Return True - '' End If - '' Exit For - '' End If - '' Next - '' ' se non trovo nella lista dei parametri il nome della lista creo il componente senza la lista - '' NewCompoParam = New TextBoxOnOffParam(sItems(1), MsgControl(sItems(1), sItems(2), sErrorList), sDefaultValue, Nothing, Nothing) - '' sErrorList &= String.Format(EgtMsg(50121), sItems(4), m_CompoType.DDFName) - '' Return True - ''ElseIf sItems.Count = 4 Then - '' 'se non esiste una lista ma solo il nome della lista - '' NewCompoParam = New TextBoxOnOffParam(sItems(1), MsgControl(sItems(1), sItems(2), sErrorList), sDefaultValue, Nothing, Nothing) - '' sErrorList &= String.Format(EgtMsg(50123), sItems(4), m_CompoType.DDFName) - '' Return True ElseIf sItems.Count = 3 Then ' se la text contiente solo 4 parametri If sItems(1).Split("/"c).Count = 1 Then - NewCompoParam = New TextBoxOnOffParam(Trim(sItems(1)), MsgControl(Trim(sItems(1)), "-1", sErrorList), sDefaultValue, Nothing, Nothing) + NewCompoParam = New TextBoxOnOffParam(Trim(sItems(1)), MsgControl(Trim(sItems(1)), "-1", sErrorList), Me, sDefaultValue, Nothing, Nothing) Else - NewCompoParam = New TextBoxOnOffParam(Trim(sItems(1).Split("/"c)(0)), Trim(MsgControl(sItems(1).Split("/"c)(0), sItems(1).Split("/"c)(1), sErrorList)), sDefaultValue, Nothing, Nothing) + NewCompoParam = New TextBoxOnOffParam(Trim(sItems(1).Split("/"c)(0)), Trim(MsgControl(sItems(1).Split("/"c)(0), sItems(1).Split("/"c)(1), sErrorList)), Me, sDefaultValue, Nothing, Nothing) End If Return True End If Else ' se la misura passata è più grande di quella della porta non carico il valore e creo il parametro senza lista If sItems(1).Split("/"c).Count = 1 Then - NewCompoParam = New TextBoxOnOffParam(Trim(sItems(1)), MsgControl(Trim(sItems(1)), "-1", sErrorList), "0.000", Nothing, Nothing) + NewCompoParam = New TextBoxOnOffParam(Trim(sItems(1)), MsgControl(Trim(sItems(1)), "-1", sErrorList), Me, "0.000", Nothing, Nothing) sErrorList &= String.Format(EgtMsg(50124), MsgControl(sItems(1), "-1", sErrorList), m_CompoType.DDFName, sDefaultValue) Else - NewCompoParam = New TextBoxOnOffParam(Trim(sItems(1).Split("/"c)(0)), Trim(MsgControl(sItems(1).Split("/"c)(0), sItems(1).Split("/"c)(1), sErrorList)), "0.000", Nothing, Nothing) + NewCompoParam = New TextBoxOnOffParam(Trim(sItems(1).Split("/"c)(0)), Trim(MsgControl(sItems(1).Split("/"c)(0), sItems(1).Split("/"c)(1), sErrorList)), Me, "0.000", Nothing, Nothing) sErrorList &= String.Format(EgtMsg(50124), MsgControl(sItems(1).Split("/"c)(0), sItems(1).Split("/"c)(1), sErrorList), m_CompoType.DDFName, sDefaultValue) End If ' ma faccio andare avanti nella lettura dei parametri @@ -460,9 +599,9 @@ Public Class Compo End If Else If sItems(1).Split("/"c).Count = 1 Then - NewCompoParam = New TextBoxOnOffParam(Trim(sItems(1)), MsgControl(Trim(sItems(1)), "-1", sErrorList), "0.000", Nothing, Nothing) + NewCompoParam = New TextBoxOnOffParam(Trim(sItems(1)), MsgControl(Trim(sItems(1)), "-1", sErrorList), Me, "0.000", Nothing, Nothing) Else - NewCompoParam = New TextBoxOnOffParam(Trim(sItems(1).Split("/"c)(0)), Trim(MsgControl(sItems(1).Split("/"c)(0), sItems(1).Split("/"c)(1), sErrorList)), "0.000", Nothing, Nothing) + NewCompoParam = New TextBoxOnOffParam(Trim(sItems(1).Split("/"c)(0)), Trim(MsgControl(sItems(1).Split("/"c)(0), sItems(1).Split("/"c)(1), sErrorList)), Me, "0.000", Nothing, Nothing) End If Dim ErrorExpression As String = String.Format(EgtMsg(50147), NewCompoParam.Name, sItems(2)) @@ -473,10 +612,10 @@ Public Class Compo ElseIf sItems.Count = 2 Then ' se la stringa ha 2 elemtni "TextBox; NomeDDF/Nome" If sItems(1).Split("/"c).Count = 1 Then - NewCompoParam = New TextBoxOnOffParam(Trim(sItems(1)), MsgControl(Trim(sItems(1)), "-1", sErrorList), "0.000", Nothing, Nothing) + NewCompoParam = New TextBoxOnOffParam(Trim(sItems(1)), MsgControl(Trim(sItems(1)), "-1", sErrorList), Me, "0.000", Nothing, Nothing) sErrorList &= String.Format(EgtMsg(50125), MsgControl(sItems(1), "-1", sErrorList), m_CompoType.DDFName) Else - NewCompoParam = New TextBoxOnOffParam(Trim(sItems(1).Split("/"c)(0)), Trim(MsgControl(sItems(1).Split("/"c)(0), sItems(1).Split("/"c)(1), sErrorList)), "0.000", Nothing, Nothing) + NewCompoParam = New TextBoxOnOffParam(Trim(sItems(1).Split("/"c)(0)), Trim(MsgControl(sItems(1).Split("/"c)(0), sItems(1).Split("/"c)(1), sErrorList)), Me, "0.000", Nothing, Nothing) sErrorList &= String.Format(EgtMsg(50125), MsgControl(sItems(1).Split("/"c)(0), sItems(1).Split("/"c)(1), sErrorList), m_CompoType.DDFName) End If Return True @@ -587,7 +726,7 @@ Public Class Compo ' Definizione comando Private m_CmdDelete As ICommand - Sub New(CompoType As CompoType, MyDoor As Door) + Sub New(CompoType As CompoType, MyDoor As Part) m_CompoType = CompoType m_rfCurrDoor = MyDoor End Sub @@ -603,7 +742,7 @@ Public Class Compo Get If m_CmdDelete Is Nothing Then m_CmdDelete = New Command(AddressOf Delete) - End If + End If Return m_CmdDelete End Get End Property @@ -612,7 +751,8 @@ Public Class Compo ''' Execute the Exec. This method is invoked by the ExecCommand. ''' Public Sub Delete() - m_rfCurrDoor.RemoveCompo(Me) + Map.refPartPageVM.CurrPart.RemoveCompo(Me) + Map.refAssemblyManagerVM.SelectedAssembly.IsModify = True End Sub #End Region ' DeleteCommand @@ -628,7 +768,6 @@ Public Class Compo End Class Public Class CompoParam - Friend Shared m_rfSetTitle As Action Friend m_IsModifyCompoParam As Boolean = False @@ -653,9 +792,20 @@ Public Class CompoParam End Set End Property - Sub New(sDDFName As String, sName As String) + Private m_CurrCompo As Compo + Public Property CurrCompo As Compo + Get + Return m_CurrCompo + End Get + Set(value As Compo) + m_CurrCompo = value + End Set + End Property + + Sub New(sDDFName As String, sName As String, CurrCompo As Compo) m_DDFName = sDDFName m_Name = sName + m_CurrCompo = CurrCompo End Sub End Class @@ -663,6 +813,16 @@ Public Class TextBoxParam Inherits CompoParam Implements INotifyPropertyChanged + Private m_IsReadOnly As Boolean = True + Public Property IsReadOnly As Boolean + Get + Return m_IsReadOnly + End Get + Set(value As Boolean) + m_IsReadOnly = value + End Set + End Property + Dim dValue As Double = -1 Friend m_Value As String Public Property Value As String @@ -673,9 +833,28 @@ Public Class TextBoxParam m_Value = value NotifyPropertyChanged("ToolTipValue") m_IsModifyCompoParam = True - m_rfSetTitle() + If Not IsNothing(CurrCompo.refJambCompo) Then + Map.refAssemblyPageVM.CurrAssembly.LoadModuleParam(CurrCompo) + If Not File.Exists(CurrCompo.CompoType.Path & "\" & "Matching.lua") Then + EgtOutLog("SetUp error: SetUp configuration file (" & CurrCompo.CompoType.Path & "\" & "Matching.lua)" & " doesn't exist ") + MessageBox.Show("Script Lua (" & CurrCompo.CompoType.Path & "\" & "Matching.lua" & ")has not been found", "Error", MessageBoxButton.OK, MessageBoxImage.Error) + Return + Else + EgtLuaSetGlobIntVar("STU.DoorNumber", CInt(Map.refAssemblyPageVM.CurrAssembly.DoorNumber)) + EgtLuaSetGlobStringVar("STU.CompoPath", CurrCompo.CompoType.Path) + EgtLuaSetGlobStringVar("STU.Template", CurrCompo.TemplateSelItem) + EgtLuaCallFunction("STU.Matching") + UpdateParam() + EgtLuaResetGlobVar("STU") + End If + End If + Map.refAssemblyManagerVM.SelectedAssembly.IsModify = True End Set End Property + Public Sub SetValue(sValue As String) + m_Value = sValue + NotifyPropertyChanged("ToolTipValue") + End Sub Public ReadOnly Property ToolTipValue As String Get @@ -688,8 +867,6 @@ Public Class TextBoxParam End Get End Property - - Private m_ComboValuelList As New List(Of String) Public Property ComboValuelList As List(Of String) Get @@ -712,8 +889,37 @@ Public Class TextBoxParam End Set End Property - Sub New(sDDFName As String, sName As String, sValue As String, ComboBox As ComboBoxParam, ComboValuelList As List(Of String)) - MyBase.New(sDDFName, sName) + Public Sub UpdateParam() + For IndexParam As Integer = 0 To CurrCompo.refJambCompo.CompoParamList.Count - 1 + If TypeOf CurrCompo.refJambCompo.CompoParamList(IndexParam) Is TextBoxParam AndAlso CurrCompo.CompoParamList(IndexParam).DDFName = CurrCompo.refJambCompo.CompoParamList(IndexParam).DDFName Then + Dim x = EgtLuaSetGlobStringVar("STU.InParamName", DirectCast(CurrCompo.CompoParamList(IndexParam), TextBoxParam).DDFName) + Dim dInParamValue As Double + StringToDouble(DirectCast(CurrCompo.CompoParamList(IndexParam), TextBoxParam).m_Value, dInParamValue) + EgtLuaSetGlobNumVar("STU.InParamValue", dInParamValue) + EgtLuaCallFunction("STU.CalcParam") + Dim sVal As String = String.Empty + EgtLuaGetGlobStringVar("STU.OutParamValue", sVal) + DirectCast(CurrCompo.refJambCompo.CompoParamList(IndexParam), TextBoxParam).SetValue(CStr(sVal)) + EgtLuaGetGlobBoolVar("STU.IsEnable", DirectCast(CurrCompo.refJambCompo.CompoParamList(IndexParam), TextBoxParam).IsReadOnly) + Return + ElseIf TypeOf CurrCompo.refJambCompo.CompoParamList(IndexParam) Is ComboBoxParam AndAlso CurrCompo.CompoParamList(IndexParam).DDFName = CurrCompo.refJambCompo.CompoParamList(IndexParam).DDFName Then + DirectCast(CurrCompo.refJambCompo.CompoParamList(IndexParam), ComboBoxParam).IsReadOnly = False + Return + ElseIf TypeOf CurrCompo.refJambCompo.CompoParamList(IndexParam) Is TextBoxOnOffParam AndAlso CurrCompo.CompoParamList(IndexParam).DDFName = CurrCompo.refJambCompo.CompoParamList(IndexParam).DDFName Then + EgtLuaSetGlobStringVar("STU.InParamName", DirectCast(CurrCompo.CompoParamList(IndexParam), TextBoxOnOffParam).DDFName) + EgtLuaCallFunction("STU.CalcParam") + Dim sVal As String = String.Empty + EgtLuaSetGlobStringVar("STU.InParamValue", DirectCast(CurrCompo.CompoParamList(IndexParam), TextBoxOnOffParam).m_Value) + EgtLuaGetGlobStringVar("STU.OutParamValue", sVal) + DirectCast(CurrCompo.refJambCompo.CompoParamList(IndexParam), TextBoxOnOffParam).SetValue(CStr(sVal)) + EgtLuaGetGlobBoolVar("STU.IsEnable", DirectCast(CurrCompo.refJambCompo.CompoParamList(IndexParam), TextBoxOnOffParam).IsReadOnly) + Return + End If + Next + End Sub + + Sub New(sDDFName As String, sName As String, CurrCompo As Compo, sValue As String, ComboBox As ComboBoxParam, ComboValuelList As List(Of String)) + MyBase.New(sDDFName, sName, CurrCompo) m_Value = sValue m_ComboBox = ComboBox m_ComboValuelList = ComboValuelList @@ -729,6 +935,16 @@ End Class Public Class ComboBoxParam Inherits CompoParam + Private m_IsReadOnly As Boolean = True + Public Property IsReadOnly As Boolean + Get + Return m_IsReadOnly + End Get + Set(value As Boolean) + m_IsReadOnly = value + End Set + End Property + Private m_ItemList As New List(Of String) Public Property ItemList As List(Of String) Get @@ -757,7 +973,7 @@ Public Class ComboBoxParam Set(value As String) m_SelItem = value m_IsModifyCompoParam = True - m_rfSetTitle() + Map.refAssemblyManagerVM.SelectedAssembly.IsModify = True End Set End Property @@ -765,12 +981,11 @@ Public Class ComboBoxParam m_SelItem = value End Sub - Sub New(sDDFName As String, sName As String, ItemList As List(Of String), ItemListDDF As List(Of String), sSelItem As String) - MyBase.New(sDDFName, sName) + Sub New(sDDFName As String, sName As String, CurrCompo As Compo, ItemList As List(Of String), ItemListDDF As List(Of String), sSelItem As String) + MyBase.New(sDDFName, sName, CurrCompo) m_ItemList = ItemList m_ItemListDDF = ItemListDDF m_SelItem = sSelItem - End Sub End Class @@ -785,10 +1000,11 @@ Public Class TextBoxOnOffParam End Get Set(value As Boolean) m_IsActive = value + Map.refAssemblyManagerVM.SelectedAssembly.IsModify = True End Set End Property - Sub New(sDDFName As String, sName As String, sValue As String, ComboBox As ComboBoxParam, ComboValuelList As List(Of String)) - MyBase.New(sDDFName, sName, sValue, ComboBox, ComboValuelList) + Sub New(sDDFName As String, sName As String, CurrCompo As Compo, sValue As String, ComboBox As ComboBoxParam, ComboValuelList As List(Of String)) + MyBase.New(sDDFName, sName, CurrCompo, sValue, ComboBox, ComboValuelList) End Sub End Class \ No newline at end of file diff --git a/DoorParameters/DoorParametersView.xaml.vb b/DoorParameters/DoorParametersView.xaml.vb deleted file mode 100644 index 648a6cf..0000000 --- a/DoorParameters/DoorParametersView.xaml.vb +++ /dev/null @@ -1,6 +0,0 @@ -Public Class DoorParametersView - - Private Sub ComboBox_DataContextChanged(sender As Object, e As DependencyPropertyChangedEventArgs) - - End Sub -End Class diff --git a/DoorParameters/Door.vb b/DoorParameters/Part.vb similarity index 57% rename from DoorParameters/Door.vb rename to DoorParameters/Part.vb index deea63b..e4889f4 100644 --- a/DoorParameters/Door.vb +++ b/DoorParameters/Part.vb @@ -4,41 +4,84 @@ Imports System.IO Imports EgtUILib Imports System.Text.RegularExpressions -Public Class Door +Public Class Part Implements INotifyPropertyChanged Friend m_IsModifyDoor As Boolean = False Friend Shared m_rfModifyTitle As Action(Of Boolean) - ' restituisce vero/falso valutando se le componenti o le generals della porta sono state modificate - Private Function IsModify() As Boolean - If m_IsModifyDoor Then Return True - ' se esiste almeno un elemento nella lista dei componenti - If Not IsNothing(Me.CompoList) Then - ' assegno ad una variabile locale il vallore della componente, e ripeto per tutte le componenti della lista - For IndexCompoList = 0 To Me.CompoList.Count - 1 - Dim rCompo As Compo = Me.CompoList(IndexCompoList) - If Me.CompoList(IndexCompoList).IsModify Then - Return True - End If - Next - End If - Return False - End Function + ' '' restituisce vero/falso valutando se le componenti o le generals della porta sono state modificate + ''Private Function IsModify() As Boolean + '' If m_IsModifyDoor Then Return True + '' ' se esiste almeno un elemento nella lista dei componenti + '' If Not IsNothing(Me.CompoList) Then + '' ' assegno ad una variabile locale il vallore della componente, e ripeto per tutte le componenti della lista + '' For IndexCompoList = 0 To Me.CompoList.Count - 1 + '' Dim rCompo As Compo = Me.CompoList(IndexCompoList) + '' If Me.CompoList(IndexCompoList).IsModify Then + '' Return True + '' End If + '' Next + '' End If + '' Return False + ''End Function - Friend Sub SetTitle() - m_rfModifyTitle(IsModify) - End Sub + 'Friend Sub SetTitle() + ' m_rfModifyTitle(IsModify) + 'End Sub #Region "GENERAL" - Private m_SwingTypeList As List(Of String) = New List(Of String) - Public ReadOnly Property SwingTypeList As List(Of String) +#Region "Nuove proprietà delle parti" + + ' serve ad attribuire il nome all'oggetto che stiamo per creare (Il vecchio frame ora indicato nel DDF come piece) + Private m_TypePart As String + Public Property TypePart As String Get - ' restituisco il valore della lista che è stato creato all'avvio - Return OptionModule.m_SwingTypeList + Return m_TypePart End Get + Set(value As String) + m_TypePart = value + NotifyPropertyChanged("TypePart") + End Set + End Property + ' per sapere se il check è attivo + Private m_IsActive As Boolean + Public Property IsActive As Boolean + Get + Return m_IsActive + End Get + Set(value As Boolean) + m_IsActive = value + Map.refAssemblyManagerVM.SelectedAssembly.IsModify = True + End Set + End Property + Public Sub SetIsActive(bIsActive As Boolean) + m_IsActive = bIsActive + NotifyPropertyChanged("IsActive") + End Sub + + Private m_IsNotAssembly As Boolean = False + Public Property IsNotAssembly As Boolean + Get + Return m_IsNotAssembly + End Get + Set(value As Boolean) + m_IsNotAssembly = value + End Set + End Property + +#End Region ' Nuove proprietà delle parti + + Private m_SwingTypeList As List(Of String) = New List(Of String) + Public Property SwingTypeList As List(Of String) + Get + Return m_SwingTypeList + End Get + Set(value As List(Of String)) + m_SwingTypeList = value + End Set End Property Private m_Measure As String @@ -135,13 +178,21 @@ Public Class Door Else MessageBox.Show(EgtMsg(50148), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Asterisk) End If - m_IsModifyDoor = True - SetTitle() + ' 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() SetVarSize() UpdateToolTip() NotifyPropertyChanged("Height") + Map.refAssemblyManagerVM.SelectedAssembly.IsModify = True End Set End Property + Public Sub SetHeight(sHeight As String) + m_Height = sHeight + NotifyPropertyChanged("Height") + Map.refAssemblyManagerVM.SelectedAssembly.IsModify = True + End Sub Private m_Width As String = String.Empty Public Property Width As String @@ -155,12 +206,19 @@ Public Class Door Else MessageBox.Show(EgtMsg(50148), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Asterisk) End If - m_IsModifyDoor = True - SetTitle() + ' ricalcola la dimensione larghezza dei Jamb FT e FB + Map.refAssemblyPageVM.CurrAssembly.SetTopWidth() + Map.refAssemblyPageVM.CurrAssembly.UpDateAllCompo() SetVarSize() UpdateToolTip() + Map.refAssemblyManagerVM.SelectedAssembly.IsModify = True End Set End Property + Public Sub SetWidth(sWidth As String) + m_Width = sWidth + NotifyPropertyChanged("Width") + Map.refAssemblyManagerVM.SelectedAssembly.IsModify = True + End Sub Private m_Thickness As String Public Property Thickness As String @@ -174,12 +232,15 @@ Public Class Door Else MessageBox.Show(EgtMsg(50148), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Asterisk) End If - m_IsModifyDoor = True - SetTitle() SetVarSize() UpdateToolTip() + Map.refAssemblyManagerVM.SelectedAssembly.IsModify = True End Set End Property + Public Sub SetThickness(sThickness As String) + m_Thickness = sThickness + NotifyPropertyChanged("Thickness") + End Sub Private m_Weight As String Public Property Weight As String @@ -197,8 +258,7 @@ Public Class Door Else MessageBox.Show(EgtMsg(50148), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Asterisk) End If - m_IsModifyDoor = True - SetTitle() + Map.refAssemblyManagerVM.SelectedAssembly.IsModify = True End Set End Property @@ -219,8 +279,6 @@ Public Class Door Set(value As Visibility) If m_IsCheckedWeight <> value Then m_IsCheckedWeight = value - m_IsModifyDoor = True - SetTitle() End If NotifyPropertyChanged("VisibilityWeight") End Set @@ -232,24 +290,24 @@ Public Class Door Return m_Swing End Get Set(value As String) - m_Swing = value - 'If SetChange <> 0 Then - ' SetChange += 1 - 'End If - m_IsModifyDoor = True - SetTitle() + m_Swing = value + Map.refAssemblyManagerVM.SelectedAssembly.IsModify = True + Map.refAssemblyPageVM.CurrAssembly.UpdateSwing(m_Swing) + Map.refAssemblyPageVM.CurrAssembly.TopRabbetJamb() End Set End Property + Public Sub SetSwing(sSwing As String) + m_Swing = sSwing + NotifyPropertyChanged("Swing") + End Sub - Private m_NewDoor As Boolean = True - Public Property NewDoor As Boolean + Private m_NewPart As Boolean = True + Public Property NewPart As Boolean Get - Return m_NewDoor + Return m_NewPart End Get Set(value As Boolean) - m_NewDoor = value - If m_NewDoor Then m_IsModifyDoor = True - SetTitle() + m_NewPart = value End Set End Property @@ -265,67 +323,68 @@ Public Class Door End Get Set(value As ObservableCollection(Of EdgeType)) m_EdgeTypeList = value - + Map.refAssemblyPageVM.CurrAssembly.NotifyPropertyChanged("EdgeTypeList") + Map.refAssemblyManagerVM.SelectedAssembly.IsModify = True End Set End Property - Private m_LockEdgeType As EdgeType + 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.SelectedAssembly.IsModify = True End If Return m_LockEdgeType End Get Set(value As EdgeType) m_LockEdgeType = value - m_IsModifyDoor = True - SetTitle() + Map.refAssemblyManagerVM.SelectedAssembly.IsModify = True End Set End Property - Private m_HingeEdgeType As EdgeType + 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.SelectedAssembly.IsModify = True End If Return m_HingeEdgeType End Get Set(value As EdgeType) m_HingeEdgeType = value - m_IsModifyDoor = True - SetTitle() + Map.refAssemblyManagerVM.SelectedAssembly.IsModify = True End Set End Property - Private m_TopType As EdgeType + 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.SelectedAssembly.IsModify = True End If Return m_TopType End Get Set(value As EdgeType) m_TopType = value - m_IsModifyDoor = True - SetTitle() + Map.refAssemblyManagerVM.SelectedAssembly.IsModify = True End Set End Property - Private m_BottomType As EdgeType + 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.SelectedAssembly.IsModify = True End If Return m_BottomType End Get Set(value As EdgeType) m_BottomType = value - m_IsModifyDoor = True - SetTitle() + Map.refAssemblyManagerVM.SelectedAssembly.IsModify = True End Set End Property @@ -340,8 +399,7 @@ Public Class Door End Get Set(value As Boolean) m_TopMachining = value - m_IsModifyDoor = True - SetTitle() + Map.refAssemblyManagerVM.SelectedAssembly.IsModify = True End Set End Property @@ -352,8 +410,7 @@ Public Class Door End Get Set(value As Boolean) m_LockEdgeMachining = value - m_IsModifyDoor = True - SetTitle() + Map.refAssemblyManagerVM.SelectedAssembly.IsModify = True End Set End Property @@ -364,8 +421,7 @@ Public Class Door End Get Set(value As Boolean) m_HingeEdgeMachining = value - m_IsModifyDoor = True - SetTitle() + Map.refAssemblyManagerVM.SelectedAssembly.IsModify = True End Set End Property @@ -376,8 +432,9 @@ Public Class Door End Get Set(value As Boolean) m_BottomMachining = value - m_IsModifyDoor = True - SetTitle() + 'm_IsModifyDoor = True + 'SetTitle() + Map.refAssemblyManagerVM.SelectedAssembly.IsModify = True End Set End Property @@ -397,11 +454,9 @@ Public Class Door Else MessageBox.Show(EgtMsg(50148), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Asterisk) End If - 'If SetChange <> 0 Then - ' SetChange += 1 - 'End If - m_IsModifyDoor = True - SetTitle() + 'm_IsModifyDoor = True + 'SetTitle() + Map.refAssemblyManagerVM.SelectedAssembly.IsModify = True End Set End Property @@ -417,11 +472,9 @@ Public Class Door Else MessageBox.Show(EgtMsg(50148), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Asterisk) End If - 'If SetChange <> 0 Then - ' SetChange += 1 - 'End If - m_IsModifyDoor = True - SetTitle() + 'm_IsModifyDoor = True + 'SetTitle() + Map.refAssemblyManagerVM.SelectedAssembly.IsModify = True End Set End Property @@ -437,8 +490,9 @@ Public Class Door Else MessageBox.Show(EgtMsg(50148), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Asterisk) End If - m_IsModifyDoor = True - SetTitle() + 'm_IsModifyDoor = True + 'SetTitle() + Map.refAssemblyManagerVM.SelectedAssembly.IsModify = True End Set End Property @@ -454,11 +508,9 @@ Public Class Door Else MessageBox.Show(EgtMsg(50148), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Asterisk) End If - 'If SetChange <> 0 Then - ' SetChange += 1 - 'End If - m_IsModifyDoor = True - SetTitle() + 'm_IsModifyDoor = True + 'SetTitle() + Map.refAssemblyManagerVM.SelectedAssembly.IsModify = True End Set End Property @@ -490,12 +542,11 @@ Public Class Door End Get Set(value As ObservableCollection(Of Compo)) m_CompoList = value - SetTitle() End Set End Property 'Gestione ComboBox e TextBox di ogni compo della pulsantiera letta da Compo.ini - Friend Function AddNewCompo(CurrCompoType As CompoType) As Integer + Friend Function AddNewCompo(CurrCompoType As CompoType) As Compo ' creo la stringa che contiene la lista degli errori Dim ErrorList As String = String.Empty ' creo il nuovo compo @@ -512,7 +563,6 @@ Public Class Door NewCompo.TemplateDDFName = DDFName NewCompo.TemplateName = Name NewCompo.TemplateItemList = TemplateList - If Not SetItemTemplate(NewCompo.CompoType.DDFName) = String.Empty Then NewCompo.SetTemplateSelItem(SetItemTemplate(NewCompo.CompoType.DDFName)) Else @@ -547,6 +597,204 @@ Public Class Door End If End If ' raggruppo tutte le componenti che hanno lo stesso nome vicine + If Not IsNothing(NewCompo) Then + '----------------------------------------------------------------------------------------------------------------------------------------------- + ' questa parte qui viene ignorata se l'oggetto chiamente è un Frame o una Porta Inattiva + If Not IsNothing(Me.m_TypePart) AndAlso Not Me.m_TypePart.Contains("F") Then + ' il nome del file associato alla componente + Dim FrameCompoFile As String = String.Empty + Dim FrameCompoFileConfig As String = String.Empty + If Not IsNothing(Map.refAssemblyPageVM.CurrAssembly.LeftJamb) Then + ' definisco un riferimento ad una variabile che sarà usata nel jamb + Dim CompoTypeJamb As CompoType + ' costruisco un riferimnto in locale dell'assemblato + Dim CurrAssembly As Assembly = Map.refAssemblyPageVM.CurrAssembly + ' inserisco il nome della componente nella funzione che gestirà l'associazione dei parametri + If Not File.Exists(NewCompo.CompoType.Path & "\" & "Matching.lua") Then + EgtOutLog("SetUp error: SetUp configuration file (" & NewCompo.CompoType.Path & "\" & "Matching.lua)" & " doesn't exist ") + 'MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 7), EgtMsg(MSG_SETUPERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error) + 'Return False + Else + ' carico Lua che contiene le funzioni per ottenere le posizioni valide dell'utensile selezionato, + ' e testa e uscita dell'utensile attrezzato + EgtLuaExecFile(NewCompo.CompoType.Path & "\" & "Matching.lua") + EgtLuaSetGlobIntVar("STU.DoorNumber", CInt(Map.refAssemblyPageVM.CurrAssembly.DoorNumber)) + EgtLuaSetGlobStringVar("STU.CompoPath", NewCompo.CompoType.Path) + EgtLuaSetGlobStringVar("STU.Template", NewCompo.TemplateSelItem) + EgtLuaCallFunction("STU.Matching") + EgtLuaGetGlobStringVar("STU.OutTemplate", FrameCompoFile) + End If + If Not String.IsNullOrEmpty(FrameCompoFile) Then + + '------------------------------------------------------------------------------------------------------------------------------------------ + If Not SearchFileConfig(FrameCompoFile, FrameCompoFileConfig) Then + MessageBox.Show("Compo does not exist", "Error", MessageBoxButton.OK, MessageBoxImage.Error) + Else + ' dato il direttorio dove si trova la componente devo ora cercare il file Config.ini per la lettura dei parametri della componente + Dim FrameCompoNameDDF As String = String.Empty + Dim FrameCompoName As String = String.Empty + Dim Side As String = String.Empty + Dim CurrCompoPath As String = FrameCompoFileConfig + If File.Exists(CurrCompoPath) Then + GetPrivateProfileCompoName(ConstCompo.S_COMPO, ConstCompo.K_NAME, FrameCompoNameDDF, FrameCompoName, CurrCompoPath) + GetPrivateProfileJambSide("PositionSide", "Side", Side, CurrCompoPath) + If String.IsNullOrEmpty(Side) Then Side = CurrCompoType.JambSide + Dim FrameCompoDirectory As String + FrameCompoDirectory = FrameCompoFileConfig.Remove(FrameCompoFileConfig.LastIndexOf("\")) + CompoTypeJamb = New CompoType(FrameCompoName, FrameCompoNameDDF, FrameCompoDirectory, Side) + Else + ' se non trovo nulla nel direttorio indicato carico il direttorio della componente corrente + CompoTypeJamb = New CompoType(CurrCompoType.Name, CurrCompoType.DDFName, CurrCompoType.Path, CurrCompoType.JambSide) + End If + '------------------------------------------------------------------------------------------------------------------------------------------ + Select Case CurrAssembly.DoorNumber + Case "1" + ' questo select case serve per gestire la posizione degli hardware sui Jamb + Select Case CurrCompoType.JambSide + Case "Hinge" + If CurrAssembly.LeftJamb.Swing.Contains("L") Then + NewCompo.refJambCompo = CurrAssembly.LeftJamb.AddRefCompo(CompoTypeJamb) + NewCompo.refJambCompo.SetTemplateSelItem(FrameCompoFile) + NewCompo.refJambCompo.IsReadOnly = True + Else + NewCompo.refJambCompo = CurrAssembly.RightJamb.AddRefCompo(CompoTypeJamb) + NewCompo.refJambCompo.SetTemplateSelItem(FrameCompoFile) + NewCompo.refJambCompo.IsReadOnly = True + End If + Case "Lock" + If CurrAssembly.LeftJamb.Swing.Contains("L") Then + NewCompo.refJambCompo = CurrAssembly.RightJamb.AddRefCompo(CompoTypeJamb) + NewCompo.refJambCompo.SetTemplateSelItem(FrameCompoFile) + NewCompo.refJambCompo.IsReadOnly = True + Else + NewCompo.refJambCompo = CurrAssembly.LeftJamb.AddRefCompo(CompoTypeJamb) + NewCompo.refJambCompo.SetTemplateSelItem(FrameCompoFile) + NewCompo.refJambCompo.IsReadOnly = True + End If + End Select + Case "2" + Select Case CurrCompoType.JambSide + Case "Hinge" + If Me.TypePart = "DO_1" Then + NewCompo.refJambCompo = CurrAssembly.LeftJamb.AddRefCompo(CompoTypeJamb) + NewCompo.refJambCompo.SetTemplateSelItem(FrameCompoFile) + NewCompo.refJambCompo.IsReadOnly = True + Else + NewCompo.refJambCompo = CurrAssembly.RightJamb.AddRefCompo(CompoTypeJamb) + NewCompo.refJambCompo.SetTemplateSelItem(FrameCompoFile) + NewCompo.refJambCompo.IsReadOnly = True + End If + Case "Lock" + ' significa che le componenrti stanno solo sulle porte + If Me.TypePart = "DO_1" And Not Me.Swing.Contains("I") Then + NewCompo.refJambCompo = CurrAssembly.GetArrayPartDoor(1).Door.AddRefCompo(CurrCompoType) + NewCompo.refJambCompo.SetTemplateSelItem(FrameCompoFile) + NewCompo.refJambCompo.IsReadOnly = True + ElseIf Me.TypePart = "DO_2" And Not Me.Swing.Contains("I") Then + NewCompo.refJambCompo = CurrAssembly.GetArrayPartDoor(0).Door.AddRefCompo(CurrCompoType) + NewCompo.refJambCompo.SetTemplateSelItem(FrameCompoFile) + NewCompo.refJambCompo.IsReadOnly = True + End If + Case "Top" + NewCompo.refJambCompo = CurrAssembly.TopJamb.AddRefCompo(CompoTypeJamb) + NewCompo.refJambCompo.SetTemplateSelItem(FrameCompoFile) + NewCompo.refJambCompo.IsReadOnly = True + Case "Bottom" + NewCompo.refJambCompo = CurrAssembly.BottomJamb.AddRefCompo(CompoTypeJamb) + NewCompo.refJambCompo.SetTemplateSelItem(FrameCompoFile) + NewCompo.refJambCompo.IsReadOnly = True + Case "Top" + NewCompo.refJambCompo = CurrAssembly.TopJamb.AddRefCompo(CompoTypeJamb) + NewCompo.refJambCompo.SetTemplateSelItem(FrameCompoFile) + NewCompo.refJambCompo.IsReadOnly = True + Case "Bottom" + NewCompo.refJambCompo = CurrAssembly.BottomJamb.AddRefCompo(CompoTypeJamb) + NewCompo.refJambCompo.SetTemplateSelItem(FrameCompoFile) + NewCompo.refJambCompo.IsReadOnly = True + End Select + End Select + End If + End If + End If + End If + '----------------------------------------------------------------------------------------------------------------------------------------------- + ' se trova già una componente allora l'inserimento avvien nel ciclo for + Dim bInsert = False + Dim CompoIndex = 0 + For CompoIndex = 0 To m_CompoList.Count - 1 + ' inserisco la nuova componente + If NewCompo.CompoType.DDFName = m_CompoList(CompoIndex).CompoType.DDFName Then + ' cerco l'ultima componente con lo stesso nome + Dim Lastindex As Integer = 0 + While CompoIndex + Lastindex < m_CompoList.Count AndAlso NewCompo.CompoType.DDFName = m_CompoList(CompoIndex + Lastindex).CompoType.DDFName + Lastindex += 1 + End While + CompoList.Insert(CompoIndex + Lastindex, NewCompo) + bInsert = True + Exit For + End If + Next + If Not bInsert Then + CompoList.Add(NewCompo) + End If + End If + 'm_IsModifyDoor = True + 'SetTitle() + Map.refAssemblyManagerVM.SelectedAssembly.IsModify = True + Return NewCompo + End Function + + 'Gestione ComboBox e TextBox di ogni compo della pulsantiera letta da Compo.ini + Public Function AddRefCompo(CurrCompoType As CompoType) As Compo + ' creo la stringa che contiene la lista degli errori + Dim ErrorList As String = String.Empty + ' creo il nuovo compo + Dim NewCompo As New Compo(CurrCompoType, Me) + ' Leggo il file ini del componente per vedere se c'è il template: se c'è + If EgtUILib.GetPrivateProfileInt(S_TEMPLATE, K_ISACTIVE, 1, CurrCompoType.Path & "\" & CONFIGINI_FILE_NAME) <> 0 Then + ' leggo nomi + Dim Name As String = String.Empty + Dim DDFName As String = String.Empty + IniFile.GetPrivateProfileCompoName(S_TEMPLATE, K_NAME, DDFName, Name, CurrCompoType.Path & "\" & CONFIGINI_FILE_NAME) + Dim TemplateList As New List(Of String) + IniFile.OpenDirectory(CurrCompoType.Path, TemplateList) + ' aggiungo il template come parametro + NewCompo.TemplateDDFName = DDFName + NewCompo.TemplateName = Name + NewCompo.TemplateItemList = TemplateList + If Not SetItemTemplate(NewCompo.CompoType.DDFName) = String.Empty Then + NewCompo.SetTemplateSelItem(SetItemTemplate(NewCompo.CompoType.DDFName)) + Else + ' se esiste un lista di template + If NewCompo.TemplateItemList.Count > 0 Then + Dim SelItemindex As Integer = 0 + ' cerco il primo elemento della lista che abbia estensione lua + While Path.HasExtension(NewCompo.TemplateItemList(SelItemindex)) And SelItemindex < NewCompo.TemplateItemList.Count - 1 + SelItemindex += 1 + End While + ' inizializzo la combobox template + NewCompo.SetTemplateSelItem(NewCompo.TemplateItemList(SelItemindex)) + + End If + End If + ' se non c'è il template + Else + ' nascondo il template + NewCompo.TemplateVisibility = Visibility.Collapsed + ' leggo il nome del compo dal file config.ini + Dim sTemplateName As String = String.Empty + EgtUILib.GetPrivateProfileString(S_TEMPLATE, K_COMPO, "", sTemplateName, CurrCompoType.Path & "\" & CONFIGINI_FILE_NAME) + If String.IsNullOrWhiteSpace(sTemplateName) Then + ErrorList &= String.Format(EgtMsg(50122), K_COMPO, NewCompo.TemplateName) + NewCompo = Nothing + ElseIf Not File.Exists(CurrCompoType.Path & "\" & sTemplateName & ".lua") Then + ErrorList &= String.Format(EgtMsg(50122), K_COMPO, NewCompo.TemplateName) + NewCompo = Nothing + Else + NewCompo.TemplateSelItem = sTemplateName + End If + End If + ' raggruppo tutte le componenti che hanno lo stesso nome vicine If Not IsNothing(NewCompo) Then ' se trova già una componente allora l'inserimento avvien nel ciclo for Dim bInsert = False @@ -568,9 +816,10 @@ Public Class Door CompoList.Add(NewCompo) End If End If - m_IsModifyDoor = True - SetTitle() - Return CompoList.Count - 1 + 'm_IsModifyDoor = True + 'SetTitle() + Map.refAssemblyManagerVM.SelectedAssembly.IsModify = True + Return NewCompo End Function ' ricerco la stessa componente all'interno della lista di comopnenti, se non trovo nulla restituisco una stringa vuota @@ -586,9 +835,32 @@ Public Class Door End Function Friend Sub RemoveCompo(CompoToRemove As Compo) + If Not IsNothing(CompoToRemove.refJambCompo) Then + If Map.refAssemblyPageVM.CurrAssembly.LeftJamb.CompoList.IndexOf(CompoToRemove.refJambCompo) > -1 Then + Map.refAssemblyPageVM.CurrAssembly.LeftJamb.RemoveCompo(CompoToRemove.refJambCompo) + ElseIf Map.refAssemblyPageVM.CurrAssembly.RightJamb.CompoList.IndexOf(CompoToRemove.refJambCompo) > -1 Then + Map.refAssemblyPageVM.CurrAssembly.RightJamb.RemoveCompo(CompoToRemove.refJambCompo) + ElseIf Map.refAssemblyPageVM.CurrAssembly.TopJamb.CompoList.IndexOf(CompoToRemove.refJambCompo) > -1 Then + Map.refAssemblyPageVM.CurrAssembly.TopJamb.RemoveCompo(CompoToRemove.refJambCompo) + ElseIf Map.refAssemblyPageVM.CurrAssembly.BottomJamb.CompoList.IndexOf(CompoToRemove.refJambCompo) > -1 Then + Map.refAssemblyPageVM.CurrAssembly.BottomJamb.RemoveCompo(CompoToRemove.refJambCompo) + ElseIf Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(1).Door.CompoList.IndexOf(CompoToRemove.refJambCompo) > -1 Then + Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(1).Door.RemoveCompo(CompoToRemove.refJambCompo) + ElseIf Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(0).Door.CompoList.IndexOf(CompoToRemove.refJambCompo) > -1 Then + Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(0).Door.RemoveCompo(CompoToRemove.refJambCompo) + End If + 'ElseIf Not IsNothing(CompoToRemove.refCompoDoor) Then + ' If Me.TypePart = "DO_1" Then + ' If Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(1).Door.CompoList.IndexOf(CompoToRemove.refCompoDoor) > -1 Then + ' Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(1).Door.RemoveCompo(CompoToRemove.refCompoDoor) + ' End If + ' ElseIf Me.TypePart = "DO_2" Then + ' If Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(0).Door.CompoList.IndexOf(CompoToRemove.refCompoDoor) > -1 Then + ' Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(0).Door.RemoveCompo(CompoToRemove.refCompoDoor) + ' End If + ' End If + End If CompoList.Remove(CompoToRemove) - m_IsModifyDoor = True - SetTitle() End Sub ' aggiorna il ToolTip delle TextBox @@ -606,34 +878,235 @@ Public Class Door #Region "LETTURA DDF" ' Genero una nuova porta da usare nella lettura di un DDF Private FileContent As String() - Shared Sub ReadDDF(sPathDDF As String, ByRef ReadDoor As Door) - If Not Directory.Exists(IniFile.m_CompoDir) Then - EgtOutLog("CompoDir not found : " & IniFile.m_CompoDir) - MessageBox.Show("CompoDir not found : " & IniFile.m_CompoDir, "ERROR!", MessageBoxButton.OK, MessageBoxImage.Error) - End - Return - End If - ReadDoor.m_IsModifyDoor = False - 'm_Door = ReadDoor - ' restituisce un problema nella lettura di un valore della compo + 'Shared Sub ReadDDF(sPathDDF As String, ByRef ReadDoor As Part) + ' If Not Directory.Exists(IniFile.m_CompoDir) Then + ' EgtOutLog("CompoDir not found : " & IniFile.m_CompoDir) + ' MessageBox.Show("CompoDir not found : " & IniFile.m_CompoDir, "ERROR!", MessageBoxButton.OK, MessageBoxImage.Error) + ' End + ' Return + ' End If + ' ReadDoor.m_IsModifyDoor = False + ' 'm_Door = ReadDoor + ' ' restituisce un problema nella lettura di un valore della compo + ' Dim InvalidValue As String = String.Empty + ' ' controllo se esite il file DDF + ' If Not File.Exists(sPathDDF) Then Return + ' ReadDoor.FileContent = File.ReadAllLines(sPathDDF) + ' ' se il file esiste ma è vuoto + ' If ReadDoor.FileContent.Count = 0 Then + ' MessageBox.Show(EgtMsg(50107), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) + ' End If + ' Dim bSecure As Boolean = False + ' ' leggo riga per riga + ' For LineIndex As Integer = 0 To ReadDoor.FileContent.Count - 1 + + ' ' pulisco dai commenti + ' ' FileContent(LineIndex) = FindComments(FileContent(LineIndex)) + + ' ' Leggo le unità di misura + ' If LineIndex < ReadDoor.FileContent.Count - 1 Then + ' If SearchKey(ReadDoor.FileContent(LineIndex), K_MEASURES) Then + ' LineIndex = ReadDoor.GetMeasure(LineIndex) + ' ' se manca una parola chiave nel DDF + ' If LineIndex = -1 Then + ' ' carico il messaggio di errore + ' InvalidValue += String.Format(EgtMsg(50102), K_MEASURES + vbCrLf) + ' ' assegno una porta vuota ed esco dal ciclo + ' ReadDoor = Nothing + ' ' interrompo la lettura del file + ' Exit For + ' End If + ' End If + ' Else + ' Exit For + ' End If + ' ' Leggo il codice + ' If LineIndex < ReadDoor.FileContent.Count - 1 Then + ' If SearchKey(ReadDoor.FileContent(LineIndex), K_CODE) Then + ' LineIndex = ReadDoor.GetCode(LineIndex) + ' ' se manca una parola chiave nel DDF + ' If LineIndex = -1 Then + ' ' carico il messaggio di errore + ' InvalidValue += String.Format(EgtMsg(50102), K_CODE + vbCrLf) + ' ' assegno una porta vuota ed esco dal ciclo + ' ReadDoor = Nothing + ' ' interrompo la lettura del file + ' Exit For + ' End If + ' End If + ' Else + ' Exit For + ' End If + ' ' Leggo il ordine + ' If LineIndex < ReadDoor.FileContent.Count - 1 Then + ' If SearchKey(ReadDoor.FileContent(LineIndex), S_ORDER) Then + ' LineIndex = ReadDoor.GetOrder(LineIndex + 1) + ' ' se manca una parola chiave nel DDF + ' If LineIndex = -1 Then + ' ' carico il messaggio di errore + ' InvalidValue += String.Format(EgtMsg(50102), S_ORDER + vbCrLf) + + ' ' assegno una porta vuota ed esco dal ciclo + ' ReadDoor = Nothing + ' ' interrompo la lettura del file + ' Exit For + ' End If + ' End If + ' Else + ' Exit For + ' End If + ' ' Leggo la data + ' If LineIndex < ReadDoor.FileContent.Count - 1 Then + ' If SearchKey(ReadDoor.FileContent(LineIndex), K_DATE) Then + ' LineIndex = ReadDoor.GetDate(LineIndex) + ' ' se manca una parola chiave nel DDF + ' If LineIndex = -1 Then + ' ' carico il messaggio di errore + ' InvalidValue += String.Format(EgtMsg(50102), K_DATE + vbCrLf) + ' ' assegno una porta vuota ed esco dal ciclo + ' ReadDoor = Nothing + ' ' interrompo la lettura del file + ' Exit For + ' End If + ' End If + ' Else + ' Exit For + ' End If + ' ' size + ' If LineIndex < ReadDoor.FileContent.Count - 1 Then + ' If SearchKey(ReadDoor.FileContent(LineIndex), K_SIZE) Then + ' LineIndex = ReadDoor.GetSize(LineIndex + 1) + ' ' se manca una parola chiave nel DDF + ' If LineIndex = -1 Then + ' ' carico il messaggio di errore + ' InvalidValue += String.Format(EgtMsg(50102), K_SIZE + vbCrLf) + ' ' assegno una porta vuota ed esco dal ciclo + ' ReadDoor = Nothing + ' ' interrompo la lettura del file + ' Exit For + ' End If + ' End If + ' Else + ' Exit For + ' End If + + ' ' leggo il peso della porta + ' If LineIndex < ReadDoor.FileContent.Count - 1 Then + ' If SearchKey(ReadDoor.FileContent(LineIndex), K_WEIGHT) Then + ' LineIndex = ReadDoor.GetWeight(LineIndex) + ' If LineIndex = -1 Then + ' InvalidValue += String.Format(EgtMsg(50102), K_WEIGHT + vbCrLf) + ' ' assegno una porta vuota ed esco dal ciclo + ' ReadDoor = Nothing + ' Exit For + ' End If + ' End If + ' Else + ' Exit For + ' End If + + ' ' swing + ' If LineIndex < ReadDoor.FileContent.Count - 1 Then + ' If SearchKey(ReadDoor.FileContent(LineIndex), K_SWING) Then + ' LineIndex = ReadDoor.GetSwing(LineIndex) + ' If LineIndex = -1 Then + ' InvalidValue += String.Format(EgtMsg(50102), K_SWING + vbCrLf) + ' ' assegno una porta vuota ed esco dal ciclo + ' ReadDoor = Nothing + ' Exit For + ' End If + ' End If + ' Else + ' Exit For + ' End If + ' ' secure + ' If LineIndex < ReadDoor.FileContent.Count - 1 Then + ' If SearchKey(ReadDoor.FileContent(LineIndex), K_SECURE) Then + ' bSecure = True + ' LineIndex += 1 + ' End If + ' End If + ' ' profiles + ' If LineIndex < ReadDoor.FileContent.Count - 1 Then + ' If SearchKey(ReadDoor.FileContent(LineIndex), K_PROFILES) Then + ' LineIndex = ReadDoor.GetProfiles(LineIndex + 1, "") + ' If LineIndex = -1 Then + ' InvalidValue += String.Format(EgtMsg(50102), K_PROFILES + vbCrLf) + ' ' assegno una porta vuota ed esco dal ciclo + ' ReadDoor = Nothing + ' Exit For + ' End If + ' End If + ' Else + ' Exit For + ' End If + + ' ' Compo + ' ' siccome dopo ogni lettura restituisco la riga successiva: controllo che veramente esiste nel file + ' If LineIndex < ReadDoor.FileContent.Count - 1 Then + ' ' se trovo un nome seguito dai due punti + ' If Not String.IsNullOrWhiteSpace(ReadDoor.SearchName(ReadDoor.FileContent(LineIndex))) Then + ' ' carivo la stringa letta come nome DDF + ' Dim CompoNameDDF = ReadDoor.SearchName(ReadDoor.FileContent(LineIndex)) + ' ' passo la riga successiva e il nome DDF alla funzione che controlla se esiste la compo e restituisce la riga successiva + ' LineIndex = ReadDoor.GetNewCompo(LineIndex + 1, CompoNameDDF, InvalidValue) + ' ' se restituisco una riga scommentata ma non interpretabile + ' ElseIf Not String.IsNullOrWhiteSpace(Utility.FindComments(ReadDoor.FileContent(LineIndex))) Then + ' If Not String.IsNullOrEmpty(InvalidValue) Then InvalidValue &= Environment.NewLine + ' InvalidValue &= String.Format(EgtMsg(50130), LineIndex) + ' End If + ' Else + ' Exit For + ' End If + ' Next + + ' ' quando finisce la lettura di tutte le righe esci dal ciclo + ' If Not String.IsNullOrWhiteSpace(InvalidValue) Then + ' MessageBox.Show(InvalidValue, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) + ' Else + ' If Not bSecure Then + ' DdfFile.WriteDDFPart(ReadDoor, sPathDDF, True, True) + ' End If + ' If String.IsNullOrEmpty(ReadDoor.m_Weight) Then + ' If m_IsCheckedWeight = Visibility.Visible Then + ' ' se il valore è acceso ma non è presente nel ddf chiedo se spegnere + ' If MessageBox.Show(EgtMsg(50149), EgtMsg(50110), MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes) = MessageBoxResult.Yes Then + ' ' decido di spegnere + ' OptionsVM.IsCheckedWeight = False + ' Else + ' ' decido di accendere + ' OptionsVM.IsCheckedWeight = True + ' ReadDoor.m_Weight = OptionModule.m_Weight + ' ReadDoor.VisibilityWeight = Visibility.Visible + ' End If + ' End If + ' End If + ' End If + 'End Sub + + Shared Sub ReadDDFPartDoor(ArrayFile() As String, ByRef LineIndex As Integer, ByRef ReadDoor As Part) Dim InvalidValue As String = String.Empty ' controllo se esite il file DDF - If Not File.Exists(sPathDDF) Then Return - ReadDoor.FileContent = File.ReadAllLines(sPathDDF) + ReadDoor.FileContent = ArrayFile ' se il file esiste ma è vuoto If ReadDoor.FileContent.Count = 0 Then MessageBox.Show(EgtMsg(50107), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) End If Dim bSecure As Boolean = False ' leggo riga per riga - For LineIndex As Integer = 0 To ReadDoor.FileContent.Count - 1 - - ' pulisco dai commenti - ' FileContent(LineIndex) = FindComments(FileContent(LineIndex)) - + While LineIndex < ReadDoor.FileContent.Count - 1 OrElse Not Search3Score(ReadDoor.FileContent(LineIndex)) Or Not Search3Dots(ReadDoor.FileContent(LineIndex)) + ' leggo il produce + If LineIndex < ReadDoor.FileContent.Count - 1 Then + If SearchKey(ReadDoor.FileContent(LineIndex), "produce") Then + LineIndex = ReadDoor.GetProduce(LineIndex) + ' se manca una parola chiave nel DDF + End If + Else + Exit While + End If ' Leggo le unità di misura If LineIndex < ReadDoor.FileContent.Count - 1 Then - If ReadDoor.SearchKey(ReadDoor.FileContent(LineIndex), K_MEASURES) Then + If SearchKey(ReadDoor.FileContent(LineIndex), K_MEASURES) Then LineIndex = ReadDoor.GetMeasure(LineIndex) ' se manca una parola chiave nel DDF If LineIndex = -1 Then @@ -642,15 +1115,15 @@ Public Class Door ' assegno una porta vuota ed esco dal ciclo ReadDoor = Nothing ' interrompo la lettura del file - Exit For + Exit While End If End If Else - Exit For + Exit While End If ' Leggo il codice If LineIndex < ReadDoor.FileContent.Count - 1 Then - If ReadDoor.SearchKey(ReadDoor.FileContent(LineIndex), K_CODE) Then + If SearchKey(ReadDoor.FileContent(LineIndex), K_CODE) Then LineIndex = ReadDoor.GetCode(LineIndex) ' se manca una parola chiave nel DDF If LineIndex = -1 Then @@ -659,15 +1132,15 @@ Public Class Door ' assegno una porta vuota ed esco dal ciclo ReadDoor = Nothing ' interrompo la lettura del file - Exit For + Exit While End If End If Else - Exit For + Exit While End If ' Leggo il ordine If LineIndex < ReadDoor.FileContent.Count - 1 Then - If ReadDoor.SearchKey(ReadDoor.FileContent(LineIndex), S_ORDER) Then + If SearchKey(ReadDoor.FileContent(LineIndex), S_ORDER) Then LineIndex = ReadDoor.GetOrder(LineIndex + 1) ' se manca una parola chiave nel DDF If LineIndex = -1 Then @@ -677,15 +1150,15 @@ Public Class Door ' assegno una porta vuota ed esco dal ciclo ReadDoor = Nothing ' interrompo la lettura del file - Exit For + Exit While End If End If Else - Exit For + Exit While End If ' Leggo la data If LineIndex < ReadDoor.FileContent.Count - 1 Then - If ReadDoor.SearchKey(ReadDoor.FileContent(LineIndex), K_DATE) Then + If SearchKey(ReadDoor.FileContent(LineIndex), K_DATE) Then LineIndex = ReadDoor.GetDate(LineIndex) ' se manca una parola chiave nel DDF If LineIndex = -1 Then @@ -694,15 +1167,27 @@ Public Class Door ' assegno una porta vuota ed esco dal ciclo ReadDoor = Nothing ' interrompo la lettura del file - Exit For + Exit While End If End If Else - Exit For + Exit While + End If + ' piece (Non necessario, quinidi se viene trovato salta alla riga successiva) + If LineIndex < ReadDoor.FileContent.Count - 1 Then + If SearchKey(ReadDoor.FileContent(LineIndex), "piece") Then + LineIndex = ReadDoor.GetPiece(LineIndex) + LineIndex += 1 + End If + End If + If LineIndex < ReadDoor.FileContent.Count - 1 Then + If SearchKey(ReadDoor.FileContent(LineIndex), "position") Then + LineIndex = ReadDoor.GetPoint(LineIndex + 1) + End If End If ' size If LineIndex < ReadDoor.FileContent.Count - 1 Then - If ReadDoor.SearchKey(ReadDoor.FileContent(LineIndex), K_SIZE) Then + If SearchKey(ReadDoor.FileContent(LineIndex), K_SIZE) Then LineIndex = ReadDoor.GetSize(LineIndex + 1) ' se manca una parola chiave nel DDF If LineIndex = -1 Then @@ -711,64 +1196,63 @@ Public Class Door ' assegno una porta vuota ed esco dal ciclo ReadDoor = Nothing ' interrompo la lettura del file - Exit For + Exit While End If End If Else - Exit For + Exit While End If ' leggo il peso della porta If LineIndex < ReadDoor.FileContent.Count - 1 Then - If ReadDoor.SearchKey(ReadDoor.FileContent(LineIndex), K_WEIGHT) Then + If SearchKey(ReadDoor.FileContent(LineIndex), K_WEIGHT) Then LineIndex = ReadDoor.GetWeight(LineIndex) If LineIndex = -1 Then InvalidValue += String.Format(EgtMsg(50102), K_WEIGHT + vbCrLf) ' assegno una porta vuota ed esco dal ciclo ReadDoor = Nothing - Exit For + Exit While End If End If Else - Exit For + Exit While End If ' swing If LineIndex < ReadDoor.FileContent.Count - 1 Then - If ReadDoor.SearchKey(ReadDoor.FileContent(LineIndex), K_SWING) Then + If SearchKey(ReadDoor.FileContent(LineIndex), K_SWING) Then LineIndex = ReadDoor.GetSwing(LineIndex) If LineIndex = -1 Then InvalidValue += String.Format(EgtMsg(50102), K_SWING + vbCrLf) ' assegno una porta vuota ed esco dal ciclo ReadDoor = Nothing - Exit For + Exit While End If End If Else - Exit For + Exit While End If ' secure If LineIndex < ReadDoor.FileContent.Count - 1 Then - If ReadDoor.SearchKey(ReadDoor.FileContent(LineIndex), K_SECURE) Then + If SearchKey(ReadDoor.FileContent(LineIndex), K_SECURE) Then bSecure = True LineIndex += 1 End If End If ' profiles If LineIndex < ReadDoor.FileContent.Count - 1 Then - If ReadDoor.SearchKey(ReadDoor.FileContent(LineIndex), K_PROFILES) Then - LineIndex = ReadDoor.GetProfiles(LineIndex + 1) + If SearchKey(ReadDoor.FileContent(LineIndex), K_PROFILES) Then + LineIndex = ReadDoor.GetProfiles(LineIndex + 1, ReadDoor.TypePart) If LineIndex = -1 Then InvalidValue += String.Format(EgtMsg(50102), K_PROFILES + vbCrLf) ' assegno una porta vuota ed esco dal ciclo ReadDoor = Nothing - Exit For + Exit While End If End If Else - Exit For + Exit While End If - ' Compo ' siccome dopo ogni lettura restituisco la riga successiva: controllo che veramente esiste nel file If LineIndex < ReadDoor.FileContent.Count - 1 Then @@ -779,31 +1263,47 @@ Public Class Door ' passo la riga successiva e il nome DDF alla funzione che controlla se esiste la compo e restituisce la riga successiva LineIndex = ReadDoor.GetNewCompo(LineIndex + 1, CompoNameDDF, InvalidValue) ' se restituisco una riga scommentata ma non interpretabile - ElseIf Not String.IsNullOrWhiteSpace(ReadDoor.FindComments(ReadDoor.FileContent(LineIndex))) Then + ElseIf Not String.IsNullOrWhiteSpace(Utility.FindComments(ReadDoor.FileContent(LineIndex))) Then + ' interrompi la lettura quando arrivia ad altri trattini o a ai tre punti + If Search3Score(ReadDoor.FileContent(LineIndex)) Then + Exit While + End If + If Search3Dots(ReadDoor.FileContent(LineIndex)) Then + Exit While + End If If Not String.IsNullOrEmpty(InvalidValue) Then InvalidValue &= Environment.NewLine InvalidValue &= String.Format(EgtMsg(50130), LineIndex) End If Else - Exit For + Exit While End If - Next - + ' interrompi la lettura quando arrivia ad altri trattini o a ai tre punti + If LineIndex > ReadDoor.FileContent.Count - 1 OrElse Search3Score(ReadDoor.FileContent(LineIndex)) Then + Exit While + End If + If LineIndex > ReadDoor.FileContent.Count - 1 OrElse Search3Dots(ReadDoor.FileContent(LineIndex)) Then + Exit While + End If + LineIndex += 1 + End While ' quando finisce la lettura di tutte le righe esci dal ciclo + ' se la stringa dei messaggi contiene delle informazioni allora stampa If Not String.IsNullOrWhiteSpace(InvalidValue) Then MessageBox.Show(InvalidValue, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) Else - If Not bSecure Then - DdfFile.WriteDDF(ReadDoor, sPathDDF, True) - End If + '' se non è stata trovata nessun Secure allora aggiorno subito il file + 'If Not bSecure Then + ' DdfFile.WriteDDF(ReadDoor, sPathDDF, True) + 'End If If String.IsNullOrEmpty(ReadDoor.m_Weight) Then If m_IsCheckedWeight = Visibility.Visible Then ' se il valore è acceso ma non è presente nel ddf chiedo se spegnere If MessageBox.Show(EgtMsg(50149), EgtMsg(50110), MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes) = MessageBoxResult.Yes Then ' decido di spegnere - OptionsViewModel.IsCheckedWeight = False + OptionsVM.IsCheckedWeight = False Else ' decido di accendere - OptionsViewModel.IsCheckedWeight = True + OptionsVM.IsCheckedWeight = True ReadDoor.m_Weight = OptionModule.m_Weight ReadDoor.VisibilityWeight = Visibility.Visible End If @@ -812,26 +1312,9 @@ Public Class Door End If End Sub - ' restituice la riga scommentata - Public Function FindComments(sLine As String) As String - ' se non trovo un commento nella riga - If String.IsNullOrWhiteSpace(SearchComments(sLine)) Then - If sLine = "#" Then - ' se trovo solo il simbolo di commento senza un commento allora restituisco una riga vuota - Return String.Empty - Else - ' restituisco la riga stessa - Return sLine - End If - Else - ' altrimenti restituisci la riga che precede il commento - Dim x As String = SearchStringBeforeComments(sLine) - Return SearchStringBeforeComments(sLine) - End If - End Function - ' restituisce il valore della stringa che precede i due punti Friend Function SearchName(sLine As String) As String + 'Dim x As String = Regex.Match(FindComments(sLine), "\s*(.*?\b)\s*:.*").Groups(1).Value Return Regex.Match(FindComments(sLine), "\s*(.*?\b)\s*:.*").Groups(1).Value End Function @@ -851,20 +1334,22 @@ Public Class Door Return Regex.Match(FindComments(sLine), "\s*-*\s*(.*?\b)\s*:.*$").Groups(1).Value End Function - ' restituisce la stringa dopo i due punti - Friend Function SearchKeyValue(sLine As String, sKey As String) As String - Dim x = Regex.Match(FindComments(sLine), "\s*-*\s*" & sKey & "\s*:\s*(.*?\b)\s*$").Groups(1).Value - Return Regex.Match(FindComments(sLine), "\s*-*\s*" & sKey & "\s*:\s*(.*?\b)\s*$").Groups(1).Value - End Function - - ' cerca il nome che precede i due punti - Friend Function SearchKey(sLine As String, sKey As String) As Boolean - Dim x = FindComments(sLine) - If Not Regex.Match(FindComments(sLine), "\s*(" & sKey & ")\s*:.*$").Groups(1).Value = sKey Then Return False - Return True - End Function - #Region "Carica il General della porta" + ' Leggo il frame + Public Function GetProduce(Index As Integer) As Integer + Dim sProduce As String = SearchKeyValue(FileContent(Index), "produce") + ' se il valore restituito è nullo o vuoto + If String.IsNullOrWhiteSpace(sProduce) Then + ' assegno la riga successiva + m_IsActive = True + Index += 1 + Else + m_IsActive = CBool(sProduce) + Index += 1 + End If + ' restituisco la riga successiva all'ultimo valore letto + Return Index + End Function ' Leggo l'unità di misura Public Function GetMeasure(Index As Integer) As Integer @@ -972,6 +1457,52 @@ Public Class Door Return Index End Function + ' Leggo il piece + Public Function GetPiece(Index As Integer) As Integer + Dim sType As String = SearchKeyValue(FileContent(Index), "piece") + ' se il valore restituito è nullo o vuoto + If String.IsNullOrWhiteSpace(sType) Then + ' assegno la riga successiva + Index += 1 + Else + m_TypePart = sType + Index += 1 + End If + ' restituisco la riga successiva all'ultimo valore letto + Return Index + End Function + + Public Function GetPoint(Index As Integer) As Integer + Dim X As String = SearchKeyValue(FileContent(Index), "x") + ' se il valore restituito è nullo o vuoto + If String.IsNullOrWhiteSpace(X) Then + ' se non c'è la parola chiave allora esci + If SearchKey(FileContent(Index), "x") Then + Index += 1 + End If + Else + Index += 1 + End If + Dim Y As String = SearchKeyValue(FileContent(Index), "y") + If String.IsNullOrWhiteSpace(Y) Then + If SearchKey(FileContent(Index), "y") Then + Index += 1 + End If + Else + Index += 1 + End If + Dim Z As String = SearchKeyValue(FileContent(Index), "z") + If String.IsNullOrWhiteSpace(Z) Then + If SearchKey(FileContent(Index), "z") Then + Index += 1 + End If + Else + Index += 1 + End If + ' restituisco la riga successiva all'ultimo valore letto + Return Index + End Function + ' Leggo il codice Public Function GetDate(Index As Integer) As Integer Dim sDate As String = SearchKeyValue(FileContent(Index), K_DATE) @@ -1038,10 +1569,10 @@ Public Class Door ' se il valore è acceso ma non è presente nel ddf chiedo se spegnere If MessageBox.Show(EgtMsg(50149), EgtMsg(50110), MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes) = MessageBoxResult.Yes Then ' decido di spegnere - OptionsViewModel.IsCheckedWeight = False + OptionsVM.IsCheckedWeight = False Else ' decido di accendere - OptionsViewModel.IsCheckedWeight = True + OptionsVM.IsCheckedWeight = True m_Weight = OptionModule.m_Weight ' questo richiamo serve per avvisare che il ddf sta cambiando forma VisibilityWeight = Visibility.Visible @@ -1053,11 +1584,11 @@ Public Class Door If m_IsCheckedWeight = Visibility.Collapsed Then If MessageBox.Show(EgtMsg(50150), EgtMsg(50110), MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes) = MessageBoxResult.Yes Then ' decido di accendere - OptionsViewModel.IsCheckedWeight = True + OptionsVM.IsCheckedWeight = True m_Weight = OptionModule.m_Weight Else ' decido di spegnere - OptionsViewModel.IsCheckedWeight = False + OptionsVM.IsCheckedWeight = False ' questo richiamo serve ad avvisare che sta avvenendo un cambiamento nel ddf VisibilityWeight = Visibility.Collapsed End If @@ -1073,7 +1604,7 @@ Public Class Door If MessageBox.Show(EgtMsg(50150), EgtMsg(50110), MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes) = MessageBoxResult.Yes Then ' decido di accendere m_IsCheckedWeight = Visibility.Visible - OptionsViewModel.IsCheckedWeight = True + OptionsVM.IsCheckedWeight = True m_Weight = Weight Else ' decido di spegnere @@ -1109,7 +1640,7 @@ Public Class Door End Function ' carico valori profiles - Public Function GetProfiles(Index As Integer) As Integer + Public Function GetProfiles(Index As Integer, TypePart As String) As Integer ' Creo una stringa per scrivere gli errori Dim bError As Boolean = False ' Lock @@ -1145,9 +1676,9 @@ Public Class Door m_LockEdgeMachining = Utility.ConvertOnOffToBoolean(LockEdgeMachining) Index += 1 End If - Dim LockEdgeOverMaterial As String = SearchKeyValue(FileContent(Index), K_OVERMATERAL) + Dim LockEdgeOverMaterial As String = SearchKeyValue(FileContent(Index), K_OVERMATERIAL) If String.IsNullOrWhiteSpace(LockEdgeOverMaterial) Then - If Not SearchKey(FileContent(Index), K_OVERMATERAL) Then Return -1 + If Not SearchKey(FileContent(Index), K_OVERMATERIAL) Then Return -1 Index += 1 Else m_LockEdgeOverMaterial = LockEdgeOverMaterial @@ -1180,9 +1711,9 @@ Public Class Door m_HingeEdgeMachining = ConvertOnOffToBoolean(HingeEdgeMachining) Index += 1 End If - Dim HingeEdgeOverMaterial As String = SearchKeyValue(FileContent(Index), K_OVERMATERAL) + Dim HingeEdgeOverMaterial As String = SearchKeyValue(FileContent(Index), K_OVERMATERIAL) If String.IsNullOrWhiteSpace(HingeEdgeOverMaterial) Then - If Not SearchKey(FileContent(Index), K_OVERMATERAL) Then Return -1 + If Not SearchKey(FileContent(Index), K_OVERMATERIAL) Then Return -1 Index += 1 Else m_HingeEdgeOverMaterial = HingeEdgeOverMaterial @@ -1211,9 +1742,9 @@ Public Class Door m_TopMachining = ConvertOnOffToBoolean(TopMachining) Index += 1 End If - Dim TopOverMaterial As String = SearchKeyValue(FileContent(Index), K_OVERMATERAL) + Dim TopOverMaterial As String = SearchKeyValue(FileContent(Index), K_OVERMATERIAL) If String.IsNullOrWhiteSpace(TopOverMaterial) Then - If Not SearchKey(FileContent(Index), K_OVERMATERAL) Then Return -1 + If Not SearchKey(FileContent(Index), K_OVERMATERIAL) Then Return -1 Index += 1 Else m_TopOverMaterial = TopOverMaterial @@ -1244,9 +1775,9 @@ Public Class Door Index += 1 End If - Dim BottomOverMaterial As String = SearchKeyValue(FileContent(Index), K_OVERMATERAL) + Dim BottomOverMaterial As String = SearchKeyValue(FileContent(Index), K_OVERMATERIAL) If String.IsNullOrWhiteSpace(BottomOverMaterial) Then - If Not SearchKey(FileContent(Index), K_OVERMATERAL) Then Return -1 + If Not SearchKey(FileContent(Index), K_OVERMATERIAL) Then Return -1 Index += 1 Else m_BottomOverMaterial = BottomOverMaterial @@ -1257,18 +1788,20 @@ Public Class Door End Function #End Region ' Carica il General della porta - + ' questa variabile è stata definita condovisa per permettere di essere inizializzata alla prima lettura del DDF + Public Shared FirstReadingEdge As Boolean = False ' 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 Door.m_EdgeTypeList(Index).Name = Edge And Door.m_EdgeTypeList(Index).IsActive = Visibility.Collapsed Then + 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 bFound And Not FirstReadingEdge Then Dim CautionBevel As String = String.Format(EgtMsg(50151), Edge) - MessageBox.Show(CautionBevel, EgtMsg(50151), MessageBoxButton.OK, MessageBoxImage.Asterisk) + MessageBox.Show(CautionBevel, EgtMsg(50115), MessageBoxButton.OK, MessageBoxImage.Asterisk) + FirstReadingEdge = True Return False Else Return True @@ -1292,13 +1825,13 @@ Public Class Door End If End If - For CompoListIndex = 0 To CompoPanelViewModel.CompoTypeList.Count() - 1 + For CompoListIndex = 0 To CompoPanelVM.CompoTypeList.Count() - 1 ' eseguo il confronto con il nome delle componenti che è stato acricato nel file Default.ini - If CompoPanelViewModel.CompoTypeList(CompoListIndex).DDFName = CompoNameDDF Then + If CompoPanelVM.CompoTypeList(CompoListIndex).DDFName = CompoNameDDF Then ' se il nome esiste bDDFName = True ' passo alla lettura delle righe successive (quindi a quella passata nella funzione) - While Index < FileContent.Count AndAlso Not String.IsNullOrWhiteSpace(FindComments(FileContent(Index))) + While Index < FileContent.Count - 1 AndAlso Not Search3Score(FileContent(Index)) AndAlso Not Search3Dots(FileContent(Index)) AndAlso Not String.IsNullOrWhiteSpace(FindComments(FileContent(Index))) ' cerco il nome ' controllo che la stringa abbia i due punti: se non ha i due punti If String.IsNullOrWhiteSpace(SearchName(FileContent(Index))) Then @@ -1310,9 +1843,9 @@ Public Class Door ' se ha il trattino Else ' creo la nuova componente - Dim m_CurrCompo = New Compo(CompoPanelViewModel.CompoTypeList(CompoListIndex), Me) + Dim m_CurrCompo = New Compo(CompoPanelVM.CompoTypeList(CompoListIndex), Me) ' Leggo il file ini del componente per vedere se c'è il template: se c'è - Dim CurrCompoTypePath As String = CompoPanelViewModel.CompoTypeList(CompoListIndex).Path + Dim CurrCompoTypePath As String = CompoPanelVM.CompoTypeList(CompoListIndex).Path If EgtUILib.GetPrivateProfileInt(S_TEMPLATE, K_ISACTIVE, 1, CurrCompoTypePath & "\" & CONFIGINI_FILE_NAME) <> 0 Then ' leggo nomi Dim Name As String = String.Empty @@ -1321,7 +1854,7 @@ Public Class Door ' creo la lista dei templati della compnente Dim TemplateList As New List(Of String) ' che carico con i nome delle directory contenute nella directory principale (quella che contiene il file Config.ini) - IniFile.OpenDirectory(CompoPanelViewModel.CompoTypeList(CompoListIndex).Path, TemplateList) + IniFile.OpenDirectory(CompoPanelVM.CompoTypeList(CompoListIndex).Path, TemplateList) ' aggiungo il template come parametro (è un parametro particolare, quindi esiste separatamente) m_CurrCompo.TemplateDDFName = DDFName m_CurrCompo.TemplateName = Name @@ -1337,7 +1870,7 @@ Public Class Door ' elimina la compo che stai creando m_CurrCompo = Nothing If Not String.IsNullOrEmpty(InvalidValue) Then InvalidValue &= Environment.NewLine - InvalidValue &= String.Format("Template non found in line {0}", Index - 1) + InvalidValue &= String.Format("Template not found in line {0} ", Index - 1) ' ed esci dal ciclo while Exit While End If @@ -1383,7 +1916,20 @@ Public Class Door End If End If m_CompoList.Add(m_CurrCompo) + '------------------------------------------------------------------------------------------------------------------------------------------------------ + ' qui leggo se esite un dato di tipo "##IdCodeComponent : 12 + If Index < FileContent.Count - 1 AndAlso SearchName(FileContent(Index)) = "IdCodeComponent" Then + Dim IdCode As String = String.Empty + IdCode = SearchKeyValue(Regex.Match(FileContent(Index), "\s*##\s*(.*?\b)\s*$").Groups(1).Value, "IdCodeComponent") + If Not String.IsNullOrEmpty(IdCode) Then + ' ho trovato il riferimento + m_CurrCompo.IdCode = IdCode + End If + Index += 1 + End If + '------------------------------------------------------------------------------------------------------------------------------------------------------ End If + ' se la stringa non ha i due punti End While Exit For @@ -1396,7 +1942,6 @@ Public Class Door InvalidValue &= String.Format(Environment.NewLine & EgtMsg(50133), CompoNameDDF) Index -= 1 End If - Return Index End Function @@ -1519,7 +2064,7 @@ Public Class Door Else ' significa che la TextBoxOnOff è stata disattivata DirectCast(CurrCompoParam, TextBoxOnOffParam).IsActive = False - IndexLine = IndexLine - 1 + 'IndexLine = IndexLine - 1 Exit For End If End If @@ -1545,23 +2090,31 @@ Public Class Door InvalidValue &= String.Format(Environment.NewLine & EgtMsg(50140)) End If End If + If Search3Score(FileContent(IndexLine + IndexParam)) Then + Exit For + End If + If Search3Dots(FileContent(IndexLine + IndexParam)) Then + Exit For + End If Next ' terminata la lettura dei parametri IndexLine += IndexParam End Sub - Public Function SkipWhiteSpace(Array() As String, ByRef Index As Integer, LastIndex As Integer) As Integer - Array(Index) = FindComments(Array(Index)) - While String.IsNullOrWhiteSpace(Array(Index)) And Index < LastIndex - Index += 1 - Array(Index) = FindComments(Array(Index)) - End While - Return Index - End Function + '' salto gli spazi vuoti finoa alla prima riga piena + 'Public Function SkipWhiteSpace(Array() As String, ByRef Index As Integer, LastIndex As Integer) As Integer + ' Array(Index) = FindComments(Array(Index)) + ' While String.IsNullOrWhiteSpace(Array(Index)) And Index < LastIndex + ' Index += 1 + ' Array(Index) = FindComments(Array(Index)) + ' End While + ' Return Index + 'End Function #End Region ' Lettura ddf + ' Genero una nuova porta da usare nella lettura di un DDF Sub New() - CompoParam.m_rfSetTitle = AddressOf SetTitle + 'CompoParam.m_rfSetTitle = AddressOf SetTitle End Sub Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged diff --git a/DoorParameters/DoorParametersView.xaml b/DoorParameters/PartPageV.xaml similarity index 67% rename from DoorParameters/DoorParametersView.xaml rename to DoorParameters/PartPageV.xaml index a7e74fe..8845f7e 100644 --- a/DoorParameters/DoorParametersView.xaml +++ b/DoorParameters/PartPageV.xaml @@ -1,15 +1,25 @@ - + xmlns:local="clr-namespace:EgtDOORCreator" + xmlns:EgtDOORCreator="clr-namespace:EgtDOORCreator"> + - + + + + + + + + + @@ -20,10 +30,10 @@ - - + Converter={StaticResource DoorVisibilityConverter}}"> + @@ -52,41 +62,48 @@ Style="{StaticResource DoorParamsTxBl}" Margin="2,2,0,2" Grid.Row="0"/> - + - + Text="{Binding CurrPart.Height, UpdateSourceTrigger=PropertyChanged}" + Margin="0.4,2,39.6,3.2" VerticalAlignment="Stretch" Height="Auto" + IsReadOnly="{Binding IsRaedOnly}"/> + Text="{Binding CurrPart.Thickness, UpdateSourceTrigger=PropertyChanged}" + Margin="0.4,2,39.6,3.2" VerticalAlignment="Stretch" Height="Auto" + IsReadOnly="{Binding IsRaedOnly}"/> + ItemsSource="{Binding CurrPart.SwingTypeList}" + SelectedItem="{Binding CurrPart.Swing}" + Style="{StaticResource DoorParamsCmBx}" Height="Auto" + IsEnabled="{Binding IsRaedOnly, Converter={StaticResource TrueToFalse}}"/> + Margin="2,0,0,2" Visibility="{Binding CurrPart.VisibilityWeight}"/> + Visibility="{Binding CurrPart.VisibilityWeight}" + IsReadOnly="{Binding IsRaedOnly}"/> @@ -96,20 +113,22 @@ Style="{StaticResource DoorParamsTxBl}" Margin="20,2,0,2"/> + Margin="0.4,2,70,4" + IsEnabled="{Binding IsRaedOnly, Converter={StaticResource TrueToFalse}}"/> + Margin="0.4,2,70,4" + IsEnabled="{Binding IsRaedOnly, Converter={StaticResource TrueToFalse}}"> + + + + diff --git a/Guide/GuideView.xaml b/Guide/GuideV.xaml similarity index 84% rename from Guide/GuideView.xaml rename to Guide/GuideV.xaml index 8cbfcf0..4885f88 100644 --- a/Guide/GuideView.xaml +++ b/Guide/GuideV.xaml @@ -1,4 +1,4 @@ - + CloseCommand="{Binding CloseOptionsCommand,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}" + Height="800" Width="1500"> diff --git a/Guide/GuideV.xaml.vb b/Guide/GuideV.xaml.vb new file mode 100644 index 0000000..d41692e --- /dev/null +++ b/Guide/GuideV.xaml.vb @@ -0,0 +1,16 @@ +Public Class GuideV + + Private m_GuideVM As GuideVM + Public Shared m_Language As String + + Sub New(Owner As Window, GuideVM As GuideVM) + MyBase.New(Owner) + ' This call is required by the designer. + InitializeComponent() + ' Add any initialization after the InitializeComponent() call. + Me.DataContext = GuideVM + m_GuideVM = GuideVM + DoorBrowser.Navigate(New Uri(IniFile.m_sHelpDir & "\EnglishTsetJava\" & m_Language & "\" & GuideVM.m_AddressGuide & ".html")) + End Sub + +End Class diff --git a/Guide/GuideView.xaml.vb b/Guide/GuideView.xaml.vb deleted file mode 100644 index 3124173..0000000 --- a/Guide/GuideView.xaml.vb +++ /dev/null @@ -1,16 +0,0 @@ -Public Class GuideView - - Private m_GuideViewModel As GuideViewModel - Public Shared m_Language As String - - Sub New(Owner As Window, GuideViewModel As GuideViewModel) - MyBase.New(Owner) - ' This call is required by the designer. - InitializeComponent() - ' Add any initialization after the InitializeComponent() call. - Me.DataContext = GuideViewModel - m_GuideViewModel = GuideViewModel - DoorBrowser.Navigate(New Uri(IniFile.m_sHelpDir & "\EnglishTsetJava\" & m_Language & "\" & GuideViewModel.m_AddressGuide & ".html")) - End Sub - -End Class diff --git a/Guide/GuideViewModel.vb b/Guide/GuideViewModel.vb index 1db80ce..1c49acd 100644 --- a/Guide/GuideViewModel.vb +++ b/Guide/GuideViewModel.vb @@ -3,7 +3,7 @@ Imports System.ComponentModel Imports System.Windows.Forms Imports EgtUILib -Public Class GuideViewModel +Public Class GuideVM ' se non è stata selezionato ancora nulla allora faccio partire il menu principale Public Shared m_AddressGuide As String = "Test" diff --git a/IniFile.vb b/IniFile.vb index 87c7d52..14fc24f 100644 --- a/IniFile.vb +++ b/IniFile.vb @@ -203,4 +203,13 @@ Friend Module IniFile Return False End Function + Public Function GetPrivateProfileJambSide(IpAppName As String, IpKeyName As String, ByRef Side As String, CompoIniPath As String) As Boolean + Dim sVal As String = String.Empty + ' Carico il valore della stringa nel parametro sVal + EgtUILib.GetPrivateProfileString(IpAppName, IpKeyName, "", sVal, CompoIniPath) + Dim sItems() As String = sVal.Split("/"c) + Side = sVal + Return True + End Function + End Module diff --git a/Launcher/LauncherModule.vb b/Launcher/LauncherModule.vb index d8575a3..a5b46b3 100644 --- a/Launcher/LauncherModule.vb +++ b/Launcher/LauncherModule.vb @@ -3,7 +3,7 @@ Imports EgtUILib Module LauncherModule ' riferimento - Private m_rfMainWindowViewModel As MainWindowViewModel + Private m_rfMainWindowVM As MainWindowVM Friend m_LstProject As String Friend Sub InitLauncherModule() diff --git a/Launcher/LauncherView.xaml b/Launcher/LauncherV.xaml similarity index 95% rename from Launcher/LauncherView.xaml rename to Launcher/LauncherV.xaml index b874c1e..2670538 100644 --- a/Launcher/LauncherView.xaml +++ b/Launcher/LauncherV.xaml @@ -1,4 +1,4 @@ - - + - - + + - - - - - - + + + + diff --git a/MainWindow/MainWindowV.xaml.vb b/MainWindow/MainWindowV.xaml.vb new file mode 100644 index 0000000..68110f4 --- /dev/null +++ b/MainWindow/MainWindowV.xaml.vb @@ -0,0 +1,20 @@ +Imports EgtWPFLib5 + +Class MainWindowV + + Public Sub Me_ContentRendered() Handles Me.ContentRendered + ' se è assente la chiave di protezione non mostro la finestra Launcher + If Map.refSceneManagerVM.bProtectKey Then + Map.refMainWindowVM.SetLauncher() + End If + End Sub + + Private Sub EgtCustomWindow_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded + Dim rfMainWindowVM As MainWindowVM = DirectCast(Me.DataContext, MainWindowVM) + ' Posizione e dimensioni del Form + Dim WinPos As New WinPos + GetPrivateProfileWinPos(S_GENERAL, K_WINPLACE, WinPos.nFlag, WinPos.nLeft, WinPos.nTop, WinPos.nWidth, WinPos.nHeight) + rfMainWindowVM.WinPosToWindow(Me, WinPos) + End Sub + +End Class diff --git a/MainWindow/MainWindowViewModel.vb b/MainWindow/MainWindowVM.vb similarity index 59% rename from MainWindow/MainWindowViewModel.vb rename to MainWindow/MainWindowVM.vb index bab9dfa..b261d57 100644 --- a/MainWindow/MainWindowViewModel.vb +++ b/MainWindow/MainWindowVM.vb @@ -3,11 +3,10 @@ Imports System.ComponentModel Imports System.IO Imports EgtWPFLib5 -Public Class MainWindowViewModel +Public Class MainWindowVM Implements INotifyPropertyChanged ' Modello del MainWindow (classe vera e propria) Private m_MainWindowModel As New MainWindowModel - Friend m_rfSceneManagerViewModel As SceneManagerViewModel Private m_ProjectNameMsg As String Public Property ProjectNameMsg As String @@ -20,82 +19,67 @@ Public Class MainWindowViewModel End Set End Property - Private m_CompoPanel As CompoPanelView - Public ReadOnly Property CompoPanel As CompoPanelView - Get - If IsNothing(m_CompoPanel) Then - m_CompoPanel = New CompoPanelView - m_CompoPanel.DataContext = New CompoPanelViewModel(Me) - End If - Return m_CompoPanel - End Get - End Property - - Private m_Launcher As LauncherView - Public ReadOnly Property Launcher As LauncherView + Private m_Launcher As LauncherV + Public ReadOnly Property Launcher As LauncherV Get If IsNothing(m_Launcher) Then - m_Launcher = New LauncherView - m_Launcher.DataContext = New LauncherViewModel(Me) + m_Launcher = New LauncherV + m_Launcher.DataContext = New LauncherVM(Me) End If Return m_Launcher End Get End Property - Private m_ProjectManagerViewModel As ProjectManagerViewModel - Public ReadOnly Property ProjectManagerViewModel As ProjectManagerViewModel + Enum ListPageEnum As Integer + nNothingSelected + nAssemblyPage + nDDFPage + End Enum + + Private m_SelectedPage As ListPageEnum + Public Property SelectedPage As ListPageEnum Get - If IsNothing(m_ProjectManagerViewModel) Then - m_ProjectManagerViewModel = New ProjectManagerViewModel(Me) - End If - Return m_ProjectManagerViewModel + Return m_SelectedPage End Get + Set(value As ListPageEnum) + m_SelectedPage = value + NotifyPropertyChanged("PageControl") + End Set End Property - Private m_DoorManager As DoorManagerView - Public ReadOnly Property DoorManager As DoorManagerView + Private m_PartPage As PartPageV + Private m_AssemblyPage As AssemblyPageV + Public ReadOnly Property PageControl As ContentControl Get - If IsNothing(m_DoorManager) Then - m_DoorManager = New DoorManagerView(New DoorManagerViewModel(Me)) - End If - Return m_DoorManager + If m_SelectedPage = ListPageEnum.nDDFPage Then + Return m_PartPage + ElseIf m_SelectedPage = ListPageEnum.nAssemblyPage Then + Return m_AssemblyPage + Else + Return Nothing + End If End Get End Property - Private m_DoorParameters As DoorParametersView - Public ReadOnly Property DoorParameters As DoorParametersView - Get - If IsNothing(m_DoorParameters) Then - m_DoorParameters = New DoorParametersView - m_DoorParameters.DataContext = New DoorParametersViewModel(Me) - End If - Return m_DoorParameters - End Get - End Property - - Private m_SceneManager As SceneManagerView - Public ReadOnly Property SceneManager As SceneManagerView - Get - If IsNothing(m_SceneManager) Then - m_SceneManager = New SceneManagerView - m_SceneManager.DataContext = New SceneManagerViewModel(Me) - End If - Return m_SceneManager - End Get - - End Property - Private m_AboutBox As Window Private bFirstAboutBox As Boolean = True Public ReadOnly Property AboutBox As Window Get If bFirstAboutBox Then - m_AboutBox = New AboutBoxView() + m_AboutBox = New AboutBoxV() End If - Return New AboutBoxView + Return New AboutBoxV End Get End Property + Sub New() + Map.SetRefMainWindowVM(Me) + m_AssemblyPage = New AssemblyPageV + m_AssemblyPage.DataContext = New AssemblyPageVM + m_PartPage = New PartPageV + m_PartPage.DataContext = New PartPageVM + End Sub + ' MainWindow Closing Event Private m_cmdClose As ICommand @@ -103,11 +87,11 @@ Public Class MainWindowViewModel Select Case OptionModule.m_OptionLauncherList.IndexOf(OptionModule.m_SelectedOptionLauncher) Case 0 ' apre la finestra - Dim Launcher As New LauncherView + Dim Launcher As New LauncherV Launcher.Height = 200 Launcher.Width = 250 LauncherModule.InitLauncherModule() - Launcher.DataContext = New LauncherViewModel(Me) + Launcher.DataContext = New LauncherVM(Me) Launcher.Owner = Application.Current.MainWindow Launcher.ShowDialog() Case 1 @@ -116,7 +100,7 @@ Public Class MainWindowViewModel Exit Select Else ' apro l'ultimo progetto - Me.ProjectManagerViewModel.OpenLastProject() + Map.refProjectManagerVM.OpenLastProject() End If ' non fa assolutamente nulla End Select @@ -208,27 +192,28 @@ Public Class MainWindowViewModel ' Application.Msn.NotifyColleagues(Application.SAVECURRENTMACHINE) ' aggiorno file DDF grafico (CurrDoor.ddf) - If Not IsNothing(DirectCast(Me.DoorParameters.DataContext, DoorParametersViewModel).CurrDoor) Then - DdfFile.WriteDDF(DirectCast(Me.DoorParameters.DataContext, DoorParametersViewModel).CurrDoor, IniFile.m_sTempDir & "\" & TEMP_FILE, True) - Dim SelDoor As String = DirectCast(Me.DoorManager.DataContext, DoorManagerViewModel).SelectedDoor - ''If Not DdfFile.ComparisonFileDDF(IniFile.m_sTempDir & "\CurrDoor.ddf", SelDoor) Then - If Not DdfFile.SetModify(Me) Then - ' se la risposta è di non salavre non faccio nulla - Dim QuestionSave As String = String.Format(EgtMsg(50152), Path.GetFileNameWithoutExtension(SelDoor)) - Dim Result As MessageBoxResult - Result = MessageBox.Show(QuestionSave, EgtMsg(50110), MessageBoxButton.YesNoCancel, MessageBoxImage.Warning) - If Result = MessageBoxResult.Cancel Then - Return - ElseIf (Result = MessageBoxResult.Yes) Then - ' altrimenti sovrascrivo il DDF - DdfFile.WriteDDF(DirectCast(Me.DoorParameters.DataContext, DoorParametersViewModel).CurrDoor, SelDoor, True) - ElseIf (Result = MessageBoxResult.No AndAlso DirectCast(Me.DoorParameters.DataContext, DoorParametersViewModel).CurrDoor.NewDoor = True) Then - DirectCast(Me.DoorManager.DataContext, DoorManagerViewModel).RemoveDoor() - End If - End If + If Not IsNothing(Map.refAssemblyPageVM.CurrAssembly) Then + 'DdfFile.WriteDDF(Map.refPartPageVM.CurrPart, IniFile.m_sTempDir & "\" & TEMP_FILE, True) + 'Dim SelDoor As String = Map.refAssemblyManagerVM.SelectedAssembly.Name + ' ''If Not DdfFile.ComparisonFileDDF(IniFile.m_sTempDir & "\CurrDoor.ddf", SelDoor) Then + 'If Not DdfFile.SetModify(Me) Then + '' se la risposta è di non salavre non faccio nulla + 'Dim QuestionSave As String = String.Format(EgtMsg(50152), Path.GetFileNameWithoutExtension(SelDoor)) + 'Dim Result As MessageBoxResult + 'Result = MessageBox.Show(QuestionSave, EgtMsg(50110), MessageBoxButton.YesNoCancel, MessageBoxImage.Warning) + 'If Result = MessageBoxResult.Cancel Then + ' Return + 'ElseIf (Result = MessageBoxResult.Yes) Then + ' ' altrimenti sovrascrivo il DDF + ' DdfFile.WriteDDF(Map.refPartPageVM.CurrPart, SelDoor, True) + 'ElseIf (Result = MessageBoxResult.No AndAlso Map.refPartPageVM.CurrPart.NewPart = True) Then + ' Map.refAssemblyManagerVM.RemoveAssembly() + 'End If + 'End If ' scrivo il nome dell'ultimo file aperto - If Not IsNothing(Me.ProjectManagerViewModel.m_CurrProject) Then - IniFile.WritePrivateProfileString(S_LAUNCHERWINDOW, K_LASTPROJECT, Me.ProjectManagerViewModel.m_CurrProject.Name) + If Not Map.refAssemblyManagerVM.SaveCurrentAssembly() Then Return + If Not IsNothing(Map.refProjectManagerVM.m_CurrProject) Then + IniFile.WritePrivateProfileString(S_LAUNCHERWINDOW, K_LASTPROJECT, Map.refProjectManagerVM.m_CurrProject.Name) End If End If diff --git a/Map.vb b/Map.vb new file mode 100644 index 0000000..1a004b5 --- /dev/null +++ b/Map.vb @@ -0,0 +1,174 @@ +Module Map + + Private m_refMainWindowVM As MainWindowVM + Private m_refStatusBarVM As StatusBarVM + Private m_refProjectManagerVM As ProjectManagerVM + Private m_refCompoPanelVM As CompoPanelVM + Private m_refAssemblyManagerVM As AssemblyManagerVM + Private m_refPartPageVM As PartPageVM + Private m_refSceneManagerVM As SceneManagerVM + + Private m_refInstrumentPanelVM As InstrumentPanelVM + Private m_refPopUpViewPanelVM As PopUpViewPanelVM + Private m_refRefreshPanelVM As RefreshPanelVM + Private m_refShowPanelVM As ShowPanelVM + + Private m_refAssemblyPageVM As AssemblyPageVM + +#Region "Get" + + Public ReadOnly Property refMainWindowVM As MainWindowVM + Get + Return m_refMainWindowVM + End Get + End Property + + Public ReadOnly Property refStatusBarVM As StatusBarVM + Get + Return m_refStatusBarVM + End Get + End Property + + Public ReadOnly Property refProjectManagerVM As ProjectManagerVM + Get + Return m_refProjectManagerVM + End Get + End Property + + Public ReadOnly Property refCompoPanelVM As CompoPanelVM + Get + Return m_refCompoPanelVM + End Get + End Property + + Public ReadOnly Property refAssemblyManagerVM As AssemblyManagerVM + Get + Return m_refAssemblyManagerVM + End Get + End Property + + Public ReadOnly Property refPartPageVM As PartPageVM + Get + Return m_refPartPageVM + End Get + End Property + + Public ReadOnly Property refSceneManagerVM As SceneManagerVM + Get + Return m_refSceneManagerVM + End Get + End Property + + Public ReadOnly Property refInstrumentPanelVM As InstrumentPanelVM + Get + Return m_refInstrumentPanelVM + End Get + End Property + + Public ReadOnly Property refPopUpViewPanelVM As PopUpViewPanelVM + Get + Return m_refPopUpViewPanelVM + End Get + End Property + + Public ReadOnly Property refRefreshPanelVM As RefreshPanelVM + Get + Return m_refRefreshPanelVM + End Get + End Property + + Public ReadOnly Property refShowPanelVM As ShowPanelVM + Get + Return m_refShowPanelVM + End Get + End Property + + Public ReadOnly Property refAssemblyPageVM As AssemblyPageVM + Get + Return m_refAssemblyPageVM + End Get + End Property + +#End Region ' Get + +#Region "Set" + + Friend Function SetRefMainWindowVM(MainWindowVM As MainWindowVM) As Boolean + m_refMainWindowVM = MainWindowVM + Return Not IsNothing(m_refMainWindowVM) + End Function + + Friend Function SetRefStatusBarVM(StatusBarVM As StatusBarVM) As Boolean + m_refStatusBarVM = StatusBarVM + Return Not IsNothing(m_refStatusBarVM) + End Function + + Friend Function SetRefProjectManagerVM(ProjectManagerVM As ProjectManagerVM) As Boolean + m_refProjectManagerVM = ProjectManagerVM + Return Not IsNothing(m_refProjectManagerVM) + End Function + + Friend Function SetRefCompoPanelVM(CompoPanelVM As CompoPanelVM) As Boolean + m_refCompoPanelVM = CompoPanelVM + Return Not IsNothing(m_refCompoPanelVM) + End Function + + Friend Function SetRefDoorManagerVM(DoorManagerVM As AssemblyManagerVM) As Boolean + m_refAssemblyManagerVM = DoorManagerVM + Return Not IsNothing(m_refAssemblyManagerVM) + End Function + + Friend Function SetRefDoorParametersVM(DoorParametersVM As PartPageVM) As Boolean + m_refPartPageVM = DoorParametersVM + Return Not IsNothing(m_refPartPageVM) + End Function + + Friend Function SetRefSceneManagerVM(SceneManagerVM As SceneManagerVM) As Boolean + m_refSceneManagerVM = SceneManagerVM + Return Not IsNothing(m_refSceneManagerVM) + End Function + + Friend Function SetRefInstrumentPanelVM(InstrumentPanelVM As InstrumentPanelVM) As Boolean + m_refInstrumentPanelVM = InstrumentPanelVM + Return Not IsNothing(m_refInstrumentPanelVM) + End Function + + Friend Function SetRefPopUpViewPanelVM(PopUpViewPanelVM As PopUpViewPanelVM) As Boolean + m_refPopUpViewPanelVM = PopUpViewPanelVM + Return Not IsNothing(m_refPopUpViewPanelVM) + End Function + + Friend Function SetRefRefreshPanelVM(RefreshPanelVM As RefreshPanelVM) As Boolean + m_refRefreshPanelVM = RefreshPanelVM + Return Not IsNothing(m_refRefreshPanelVM) + End Function + + Friend Function SetRefShowPanelVM(ShowPanelVM As ShowPanelVM) As Boolean + m_refShowPanelVM = ShowPanelVM + Return Not IsNothing(m_refShowPanelVM) + End Function + + Friend Function SetRefJambPageVM(JambPageVM As AssemblyPageVM) As Boolean + m_refAssemblyPageVM = JambPageVM + Return Not IsNothing(m_refAssemblyPageVM) + End Function + +#End Region ' Set + +#Region "Init" + + Friend Function BeginInit(MainWindowVM As MainWindowVM) As Boolean + m_refMainWindowVM = MainWindowVM + Return Not IsNothing(m_refMainWindowVM) + End Function + Friend Function EndInit() As Boolean + ' Verifico se tutti i pezzi necessari sono stati caricati + Return Not IsNothing(m_refMainWindowVM) AndAlso Not IsNothing(m_refStatusBarVM) AndAlso + Not IsNothing(m_refProjectManagerVM) AndAlso Not IsNothing(m_refCompoPanelVM) AndAlso + Not IsNothing(m_refAssemblyManagerVM) AndAlso Not IsNothing(m_refPartPageVM) AndAlso + Not IsNothing(m_refSceneManagerVM) + + End Function + +#End Region ' Init +End Module diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index c7da865..73486fb 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 4eac6a4..3779a23 100644 --- a/OptionsWindow/OptionModule.vb +++ b/OptionsWindow/OptionModule.vb @@ -47,6 +47,44 @@ Friend Module OptionModule Friend m_TopOverMaterial As String Friend m_BottomOverMaterial As String + Friend m_SwingTypeListSinlgeDoor As New List(Of String) + Friend m_SwingTypeListLeftDoor As New List(Of String) + Friend m_SwingTypeListRightDoor As New List(Of String) + + Friend m_ThicknessJamb As String + Friend m_WidthJamb As String + Friend m_LightUp As String + Friend m_LightLock As String + Friend m_LightHinge As String + Friend m_LightBottom As String + Friend m_ThicknessHead As String + Friend m_OverlapLock As String + Friend m_OverlapHinge As String + Friend m_Exterior As Boolean + Friend m_OverlapTop As String + Friend m_DeltaThickness As String + Friend m_DoorsListNumber As New List(Of String) + Friend m_DoorsNumber As String + + Friend m_TopJambChk As Boolean + Friend m_LeftJambChk As Boolean + Friend m_BottomJambChk As Boolean + Friend m_RightJambChk As Boolean + + Friend m_LockEdgeTypeAssembly As New EdgeType("", Visibility.Visible) + Friend m_HingeEdgeTypeAssembly As New EdgeType("", Visibility.Visible) + Friend m_TopTypeAssembly As New EdgeType("", Visibility.Visible) + Friend m_BottomTypeAssembly As New EdgeType("", Visibility.Visible) + + Friend m_LockEdgeMachiningAssembly As Boolean + Friend m_HingeEdgeMachiningAssembly As Boolean + Friend m_TopMachiningAssembly As Boolean + Friend m_BottomMachiningAssembly As Boolean + Friend m_LockEdgeOverMaterialAssembly As String + Friend m_HingeEdgeOverMaterialAssembly As String + Friend m_TopOverMaterialAssembly As String + Friend m_BottomOverMaterialAssembly As String + Friend m_CompoPaneOrder As List(Of String) = New List(Of String) ' inizializzazione lettura variabili ad inizio programma @@ -71,7 +109,7 @@ Friend Module OptionModule Dim sMsgFilePath As String = sMsgDir & "\EgalTechEng.txt" For Each Language In OptionModule.m_LanguageList If Language.Name = sMsgName Then - GuideView.m_Language = sMsgName + GuideV.m_Language = sMsgName OptionModule.m_SelectedLanguage = Language sMsgFilePath = sMsgDir & "\" & Language.FilePath End If @@ -152,49 +190,47 @@ Friend Module OptionModule Dim Swing As String = String.Empty DefaultGetPrivateProfileString(S_SIZE, K_SWING_INI, "RH", Swing) m_Swing = Swing + LoadSwingList() Dim Weight As String = String.Empty DefaultGetPrivateProfileString(S_SIZE, K_WEIGHT_INI, "25", Weight) m_Weight = Weight Dim WeightVisibility As Visibility = Visibility.Collapsed DefaultGetPrivateProfilesVisibility(S_SIZE, K_WEIGHTISCHECKED_INI, WeightVisibility) - Door.IsCheckedWeight = WeightVisibility + Part.IsCheckedWeight = WeightVisibility ' carico il valori associati al tipo di spigolo Dim EdgeTypeList As New ObservableCollection(Of String) DefaultGetPrivateProfileObservableCollection(S_EDGE, K_EDGETYPE_LIST_INI, EdgeTypeList) - 'For Index = 0 To EdgeTypeList.Count - 1 - ' Door.m_EdgeTypeList.Add(New EdgeType(EdgeTypeList(Index), True)) - 'Next m_StaticEdgeTypeList = EdgeTypeList - OptionsViewModel.CreateEdgeTypeList() + OptionsVM.CreateEdgeTypeList() ' carico i valori associati agli spigoli Dim LockEdgeType As String = String.Empty DefaultGetPrivateProfileString(S_EDGE, K_LOCKEDGE, "", LockEdgeType) - For Index = 0 To OptionsViewModel.EdgeTypeList.Count - 1 - If OptionsViewModel.EdgeTypeList(Index).Name = LockEdgeType Then - m_LockEdgeType = OptionsViewModel.EdgeTypeList(Index) + For Index = 0 To OptionsVM.EdgeTypeList.Count - 1 + If OptionsVM.EdgeTypeList(Index).Name = LockEdgeType Then + m_LockEdgeType = OptionsVM.EdgeTypeList(Index) End If Next Dim HingeEdgeType As String = String.Empty DefaultGetPrivateProfileString(S_EDGE, K_HINGEDGE_INI, "SQ", HingeEdgeType) - For Index = 0 To OptionsViewModel.EdgeTypeList.Count - 1 - If OptionsViewModel.EdgeTypeList(Index).Name = HingeEdgeType Then - m_HingeEdgeType = OptionsViewModel.EdgeTypeList(Index) + For Index = 0 To OptionsVM.EdgeTypeList.Count - 1 + If OptionsVM.EdgeTypeList(Index).Name = HingeEdgeType Then + m_HingeEdgeType = OptionsVM.EdgeTypeList(Index) End If Next Dim TopType As String = String.Empty DefaultGetPrivateProfileString(S_EDGE, K_TOPEDGE_INI, "SQ", TopType) - For Index = 0 To OptionsViewModel.EdgeTypeList.Count - 1 - If OptionsViewModel.EdgeTypeList(Index).Name = TopType Then - m_TopType = OptionsViewModel.EdgeTypeList(Index) + For Index = 0 To OptionsVM.EdgeTypeList.Count - 1 + If OptionsVM.EdgeTypeList(Index).Name = TopType Then + m_TopType = OptionsVM.EdgeTypeList(Index) End If Next Dim BottomType As String = String.Empty DefaultGetPrivateProfileString(S_EDGE, K_BOTTOMEDGE_INI, "SQ", BottomType) - For Index = 0 To OptionsViewModel.EdgeTypeList.Count - 1 - If OptionsViewModel.EdgeTypeList(Index).Name = BottomType Then - m_BottomType = OptionsViewModel.EdgeTypeList(Index) + For Index = 0 To OptionsVM.EdgeTypeList.Count - 1 + If OptionsVM.EdgeTypeList(Index).Name = BottomType Then + m_BottomType = OptionsVM.EdgeTypeList(Index) End If Next @@ -228,6 +264,118 @@ Friend Module OptionModule DefaultGetPrivateProfileList(S_COMPOORDER, K_COMPOORDER_INI, DdfFile.CompoListOrder) ' carico l'ordinamento dei bottoni DefaultGetPrivateProfileList(S_COMPOORDER, K_COMPOORDER_INI, m_CompoPaneOrder) + '----------------------------------------------------------------------------------------------------------------- + 'i valori della pagina dell'assemblato + Dim ThicknessJamb As String = String.Empty + DefaultGetPrivateProfileString(S_SIZEJAMB, K_THICKNESS, "25", ThicknessJamb) + m_ThicknessJamb = ThicknessJamb + Dim WidthJamb As String = String.Empty + DefaultGetPrivateProfileString(S_SIZEJAMB, K_WIDTH, "25", WidthJamb) + m_WidthJamb = WidthJamb + + Dim LightUp As String = String.Empty + DefaultGetPrivateProfileString(S_LIGHT, K_LIGHTUP, "25", LightUp) + m_LightUp = LightUp + Dim LightLock As String = String.Empty + DefaultGetPrivateProfileString(S_LIGHT, K_LIGHTLOCK, "25", LightLock) + m_LightLock = LightLock + Dim LightHinge As String = String.Empty + DefaultGetPrivateProfileString(S_LIGHT, K_LIGHTHINGE, "25", LightHinge) + m_LightHinge = LightHinge + Dim LightBottom As String = String.Empty + DefaultGetPrivateProfileString(S_LIGHT, K_LIGHTBOTTOM, "25", LightBottom) + m_LightBottom = LightBottom + DefaultGetPrivateProfileList(S_DOORSNUMBER, K_DOORSLISTNUMBER, m_DoorsListNumber) + Dim DoorsNumber As String = String.Empty + DefaultGetPrivateProfileString(S_DOORSNUMBER, K_DOORSELECTEDTNUMBER, "0", DoorsNumber) + m_DoorsNumber = DoorsNumber + Dim ThicknessHead As String = String.Empty + DefaultGetPrivateProfileString(S_OVERLAP, K_THICKNESSHEAD, "0", ThicknessHead) + m_ThicknessHead = ThicknessHead + Dim OverlapHinge As String = String.Empty + DefaultGetPrivateProfileString(S_OVERLAP, K_OVERLAPHINGE, "0", OverlapHinge) + m_OverlapHinge = OverlapHinge + Dim OverlapLock As String = String.Empty + DefaultGetPrivateProfileString(S_OVERLAP, K_OVERLAPLOCK, "0", OverlapLock) + m_OverlapLock = OverlapLock + Dim Exterior As Boolean = False + DefaultGetPrivateProfilesMachining(S_OVERLAP, K_EXTERIOR, Exterior) + m_Exterior = Exterior + Dim OverlapTop As String = String.Empty + DefaultGetPrivateProfileString(S_OVERLAP, K_OVERLAPTOP, "0", OverlapTop) + m_OverlapTop = OverlapTop + Dim DeltaT As String = String.Empty + DefaultGetPrivateProfileString(S_OVERLAP, K_DELTAT, "0", DeltaT) + m_DeltaThickness = DeltaT + + Dim TopChk As Boolean = False + DefaultGetPrivateProfilesMachining(S_PART, K_TOPJAMB, TopChk) + m_TopJambChk = TopChk + Dim LeftChk As Boolean = False + DefaultGetPrivateProfilesMachining(S_PART, K_LEFTJAMB, LeftChk) + m_LeftJambChk = LeftChk + Dim BottomChk As Boolean = False + DefaultGetPrivateProfilesMachining(S_PART, K_BOTTOMJAMB, BottomChk) + m_BottomJambChk = BottomChk + Dim RightChk As Boolean = False + DefaultGetPrivateProfilesMachining(S_PART, K_RIGHTJAMB, RightChk) + 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) + 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) + 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) + 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) + End If + Next + + ' Carico i valori booleani associati alla lavorazione + Dim LockEdgeMachiningAss As Boolean = False + DefaultGetPrivateProfilesMachining(S_MACHININGASSEMBLY, K_LOCKEDGEISCHECKED_INI, LockEdgeMachiningAss) + m_LockEdgeMachiningAssembly = LockEdgeMachiningAss + Dim HingeEdgeMachiningAss As Boolean = False + DefaultGetPrivateProfilesMachining(S_MACHININGASSEMBLY, K_HINGEDGEEISCHECKED_INI, HingeEdgeMachiningAss) + m_HingeEdgeMachiningAssembly = HingeEdgeMachiningAss + Dim TopMachiningAss As Boolean = False + DefaultGetPrivateProfilesMachining(S_MACHININGASSEMBLY, K_TOPISCHECKED_INI, TopMachiningAss) + m_TopMachiningAssembly = TopMachiningAss + Dim BottomMachiningAss As Boolean = False + DefaultGetPrivateProfilesMachining(S_MACHININGASSEMBLY, K_BOTTOMISCHECKED_INI, BottomMachiningAss) + m_BottomMachiningAssembly = BottomMachiningAss + ' carico i valori di overmaterial + Dim LockEdgeOverMaterialAss As String = String.Empty + DefaultGetPrivateProfileString(S_OVERMATERIALASSEMBLY, K_LOCKEDGEOVERMATERIAL_INI, "", LockEdgeOverMaterialAss) + m_LockEdgeOverMaterialAssembly = LockEdgeOverMaterialAss + Dim HingeEdgeOverMaterialAss As String = String.Empty + DefaultGetPrivateProfileString(S_OVERMATERIALASSEMBLY, K_HINGEDGEOVERMATERIAL_INI, "", HingeEdgeOverMaterialAss) + m_HingeEdgeOverMaterialAssembly = HingeEdgeOverMaterialAss + Dim TopOverMaterialAss As String = String.Empty + DefaultGetPrivateProfileString(S_OVERMATERIALASSEMBLY, K_TOPOVERMATERIAL_INI, "", TopOverMaterialAss) + m_TopOverMaterialAssembly = TopOverMaterialAss + Dim BottomOverMaterialAss As String = String.Empty + DefaultGetPrivateProfileString(S_OVERMATERIALASSEMBLY, K_BOTTOMOVERMATERIAL_INI, "", BottomOverMaterialAss) + m_BottomOverMaterialAssembly = BottomOverMaterialAss m_OptionLauncherList.Add(EgtMsg(50206)) m_OptionLauncherList.Add(EgtMsg(50207)) @@ -246,6 +394,18 @@ Friend Module OptionModule End If End Sub + Private Sub LoadSwingList() + For Index As Integer = 0 To 3 + m_SwingTypeListSinlgeDoor.Add(m_SwingTypeList(Index)) + Next + For Index As Integer = 4 To 7 + m_SwingTypeListLeftDoor.Add(m_SwingTypeList(Index)) + Next + For Index As Integer = 8 To 11 + m_SwingTypeListRightDoor.Add(m_SwingTypeList(Index)) + Next + End Sub + End Module ' Classe che identifica una lingua del programma con nome e path del file dei messaggi diff --git a/OptionsWindow/OptionsV.xaml b/OptionsWindow/OptionsV.xaml new file mode 100644 index 0000000..75761f0 --- /dev/null +++ b/OptionsWindow/OptionsV.xaml @@ -0,0 +1,661 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +