Imports System.Collections.ObjectModel Imports System.ComponentModel Imports EgtUILib Imports EgtWPFLib5 Public Class OptionsVM Implements INotifyPropertyChanged ' serve per definire l'indirizzo per la guida (senza aggiungere l'estenzione!) Dim m_Chapter As String Public ReadOnly Property LanguageList As ObservableCollection(Of Language) Get Return OptionModule.m_LanguageList End Get End Property Public Property SelectedLanguage As Language Get Return OptionModule.m_SelectedLanguage End Get Set(value As Language) If value IsNot OptionModule.m_SelectedLanguage Then OptionModule.m_SelectedLanguage = value WriteMainPrivateProfileString(S_GENERAL, K_MESSAGES, m_SelectedLanguage.Name) End If End Set End Property Public ReadOnly Property MeasureUnitList As List(Of String) Get Return OptionModule.m_MeasureUnitList End Get End Property Public Property SelectedMeasureUnit As String Get Return OptionModule.m_SelectedMeasureUnit End Get Set(value As String) If value IsNot OptionModule.m_SelectedMeasureUnit Then OptionModule.m_bIsMmUnit = (value = OptionModule.m_MeasureUnitList(0)) EgtSetUiUnits(OptionModule.m_bIsMmUnit) WriteMainPrivateProfileString(S_SCENE, K_MMUNITS, If(OptionModule.m_bIsMmUnit, "1", "0")) OptionModule.m_SelectedMeasureUnit = value End If End Set End Property Public ReadOnly Property OptionLauncher As List(Of String) Get Return OptionModule.m_OptionLauncherList End Get End Property Public Property SelectedOptionLauncher As String Get Return OptionModule.m_SelectedOptionLauncher End Get Set(value As String) If value IsNot OptionModule.m_SelectedOptionLauncher Then OptionModule.m_SelectedOptionLauncher = Trim(value) Select Case OptionModule.m_SelectedOptionLauncher Case EgtMsg(50206) ' Open Window WriteMainPrivateProfileString(S_LAUNCHERWINDOW, K_LAUNCHER, CStr(0)) Case EgtMsg(50207) 'Last Project WriteMainPrivateProfileString(S_LAUNCHERWINDOW, K_LAUNCHER, CStr(1)) Case EgtMsg(50208) 'Empty WriteMainPrivateProfileString(S_LAUNCHERWINDOW, K_LAUNCHER, CStr(2)) End Select End If End Set End Property Public ReadOnly Property DispositionIsEnable As Boolean Get Return OptionModule.DispositionBoolean End Get End Property ' Carico i parametri associati al Bevel Up Public Property BevelUpIsChecked As Boolean Get If OptionModule.m_bBevelUp = Visibility.Visible Then Return True Else Return False End If End Get Set(value As Boolean) ' se sto accendendo o spegmemdo un bevel If QuestionSetBevel(CheckBevel(OptionModule.m_bBevelUp, value), ConstGen.BEVEL_UP) Then If value Then OptionModule.m_bBevelUp = Visibility.Visible Else OptionModule.m_bBevelUp = Visibility.Collapsed End If If value Then DefaultWritePrivateProfileString(S_EDGE, K_BEVELU_INI, "1") Else DefaultWritePrivateProfileString(S_EDGE, K_BEVELU_INI, "0") End If RefreshEdgeTypeList() Else Return End If End Set End Property ' Carico i parametri associati al Bevel Down Public Property BevelDownIsChecked As Boolean Get If OptionModule.m_bBevelDown = Visibility.Visible Then Return True Else Return False End If End Get Set(value As Boolean) If QuestionSetBevel(CheckBevel(OptionModule.m_bBevelDown, value), ConstGen.BEVEL_DOWN) Then If value Then OptionModule.m_bBevelDown = Visibility.Visible Else OptionModule.m_bBevelDown = Visibility.Collapsed End If If value Then DefaultWritePrivateProfileString(S_EDGE, K_BEVELD_INI, "1") Else DefaultWritePrivateProfileString(S_EDGE, K_BEVELD_INI, "0") End If RefreshEdgeTypeList() Else Return End If End Set End Property ' Carico i valori di Default della porta Public Property WidthValue As String Get Return OptionModule.m_Width End Get Set(value As String) OptionModule.m_Width = value DefaultWritePrivateProfileString(S_SIZE, K_WIDTH_INI, OptionModule.m_Width) End Set End Property Public Property HeightValue As String Get Return OptionModule.m_Height End Get Set(value As String) OptionModule.m_Height = value DefaultWritePrivateProfileString(S_SIZE, K_HEIGHT_INI, OptionModule.m_Height) End Set End Property Public Property ThicknessValue As String Get Return OptionModule.m_Thickness End Get Set(value As String) OptionModule.m_Thickness = value DefaultWritePrivateProfileString(S_SIZE, K_THICKNESS_INI, OptionModule.m_Thickness) End Set End Property Public Property WeightValue As String Get Return OptionModule.m_Weight End Get Set(value As String) OptionModule.m_Weight = value DefaultWritePrivateProfileString(S_SIZE, K_WEIGHT_INI, OptionModule.m_Weight) End Set End Property Public Shared Property IsCheckedWeight As Boolean Get If Part.IsCheckedWeight = Visibility.Visible Then Return True Else Return False End If End Get Set(value As Boolean) If value Then Part.IsCheckedWeight = Visibility.Visible DefaultWritePrivateProfileString(S_SIZE, K_WEIGHTISCHECKED_INI, "1") Else If Part.IsCheckedWeight = Visibility.Visible Then If MessageBox.Show(EgtMsg(50153), EgtMsg(50110), MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) = MessageBoxResult.Yes Then Part.IsCheckedWeight = Visibility.Collapsed DefaultWritePrivateProfileString(S_SIZE, K_WEIGHTISCHECKED_INI, "0") Else Return End If End If End If If Not IsNothing(Map.refAssemblyManagerVM.CurrProject) AndAlso Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) Then Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True End If End Set End Property Public Shared Sub SetIsCheckedWeight(IsChecked As Boolean) If IsChecked Then Part.IsCheckedWeight = Visibility.Visible DefaultWritePrivateProfileString(S_SIZE, K_WEIGHTISCHECKED_INI, "1") Else Part.IsCheckedWeight = Visibility.Collapsed DefaultWritePrivateProfileString(S_SIZE, K_WEIGHTISCHECKED_INI, "0") End If End Sub Public ReadOnly Property SwingTypeList As List(Of String) Get Return OptionModule.m_SwingTypeList End Get End Property Public Property SwingValue As String Get Return OptionModule.m_Swing End Get Set(value As String) OptionModule.m_Swing = value DefaultWritePrivateProfileString(S_SIZE, K_SWING_INI, OptionModule.m_Swing) End Set End Property Public Shared ReadOnly Property LockEdgeTypeList As ObservableCollection(Of EdgeType) Get Return Part.m_LockEdgeTypeList End Get End Property Public Shared ReadOnly Property HingeEdgeTypeList As ObservableCollection(Of EdgeType) Get Return Part.m_HingeEdgeTypeList End Get End Property Public Shared ReadOnly Property TopEdgeTypeList As ObservableCollection(Of EdgeType) Get Return Part.m_TopEdgeTypeList End Get End Property Public Shared ReadOnly Property BottomEdgeTypeList As ObservableCollection(Of EdgeType) Get Return Part.m_BottomEdgeTypeList End Get End Property Public Shared ReadOnly Property FrameEdgeTypeList As ObservableCollection(Of EdgeType) Get Return Assembly.m_FrameEdgeTypeList End Get End Property Public Property LockEdgeType As EdgeType Get If m_LockEdgeType.IsActive = Visibility.Collapsed Then m_LockEdgeType = LockEdgeTypeList(0) End If Return m_LockEdgeType End Get Set(value As EdgeType) OptionModule.m_LockEdgeType = value DefaultWritePrivateProfileString(S_EDGE, K_LOCKEDGE_INI, OptionModule.m_LockEdgeType.Name) End Set End Property Public Property HingeEdgeType As EdgeType Get If m_HingeEdgeType.IsActive = Visibility.Collapsed Then m_HingeEdgeType = HingeEdgeTypeList(0) End If Return m_HingeEdgeType End Get Set(value As EdgeType) m_HingeEdgeType = value DefaultWritePrivateProfileString(S_EDGE, K_HINGEDGE_INI, OptionModule.m_HingeEdgeType.Name) End Set End Property Public Property TopType As EdgeType Get If m_TopType.IsActive = Visibility.Collapsed Then m_TopType = TopEdgeTypeList(0) Else Try m_TopType = TopEdgeTypeList.First(Function(x) x.Name = m_TopType.Name) Catch ex As Exception m_TopType = TopEdgeTypeList(0) End Try End If Return m_TopType End Get Set(value As EdgeType) OptionModule.m_TopType = value DefaultWritePrivateProfileString(S_EDGE, K_TOPEDGE_INI, OptionModule.m_TopType.Name) End Set End Property Public Property BottomType As EdgeType Get If m_BottomType.IsActive = Visibility.Collapsed Then m_BottomType = BottomEdgeTypeList(0) Else Try m_BottomType = BottomEdgeTypeList.First(Function(x) x.Name = m_BottomType.Name) Catch ex As Exception m_BottomType = BottomEdgeTypeList(0) End Try End If Return m_BottomType End Get Set(value As EdgeType) OptionModule.m_BottomType = value DefaultWritePrivateProfileString(S_EDGE, K_BOTTOMEDGE_INI, OptionModule.m_BottomType.Name) End Set End Property ' is Checked Public Property LockEdgeIsChecked As Boolean Get Return OptionModule.m_LockEdgeMachining End Get Set(value As Boolean) OptionModule.m_LockEdgeMachining = value If value Then DefaultWritePrivateProfileString(S_MACHINING, K_LOCKEDGEISCHECKED_INI, "1") Else DefaultWritePrivateProfileString(S_MACHINING, K_LOCKEDGEISCHECKED_INI, "0") End If End Set End Property Public Property HingeEdgeIsChecked As Boolean Get Return OptionModule.m_HingeEdgeMachining End Get Set(value As Boolean) OptionModule.m_HingeEdgeMachining = value If value Then DefaultWritePrivateProfileString(S_MACHINING, K_HINGEDGEEISCHECKED_INI, "1") Else DefaultWritePrivateProfileString(S_MACHINING, K_HINGEDGEEISCHECKED_INI, "0") End If End Set End Property Public Property TopIsChecked As Boolean Get Return OptionModule.m_TopMachining End Get Set(value As Boolean) OptionModule.m_TopMachining = value If value Then DefaultWritePrivateProfileString(S_MACHINING, K_TOPISCHECKED_INI, "1") Else DefaultWritePrivateProfileString(S_MACHINING, K_TOPISCHECKED_INI, "0") End If End Set End Property Public Property BottomIsChecked As Boolean Get Return OptionModule.m_BottomMachining End Get Set(value As Boolean) OptionModule.m_BottomMachining = value If value Then DefaultWritePrivateProfileString(S_MACHINING, K_BOTTOMISCHECKED_INI, "1") Else DefaultWritePrivateProfileString(S_MACHINING, K_BOTTOMISCHECKED_INI, "0") End If End Set End Property ' OverMaterial Public Property LockEdgeOverMaterialValue As String Get Return OptionModule.m_LockEdgeOverMaterial End Get Set(value As String) OptionModule.m_LockEdgeOverMaterial = value DefaultWritePrivateProfileString(S_OVERMATERIAL, K_LOCKEDGEOVERMATERIAL_INI, OptionModule.m_LockEdgeOverMaterial) End Set End Property Public Property HingeEdgeOverMaterialValue As String Get Return OptionModule.m_HingeEdgeOverMaterial End Get Set(value As String) OptionModule.m_HingeEdgeOverMaterial = value DefaultWritePrivateProfileString(S_OVERMATERIAL, K_HINGEDGEOVERMATERIAL_INI, OptionModule.m_HingeEdgeOverMaterial) End Set End Property Public Property TopOverMaterialValue As String Get Return OptionModule.m_TopOverMaterial End Get Set(value As String) OptionModule.m_TopOverMaterial = value DefaultWritePrivateProfileString(S_OVERMATERIAL, K_TOPOVERMATERIAL_INI, OptionModule.m_TopOverMaterial) End Set End Property Public Property BottomOverMaterialValue As String Get Return OptionModule.m_BottomOverMaterial End Get Set(value As String) OptionModule.m_BottomOverMaterial = value DefaultWritePrivateProfileString(S_OVERMATERIAL, K_BOTTOMOVERMATERIAL_INI, OptionModule.m_BottomOverMaterial) End Set End Property Public Property MyProjectDir As String Get Return IniFile.m_MyProjectDir End Get Set(value As String) If value IsNot IniFile.m_MyProjectDir Then IniFile.m_MyProjectDir = value WriteMainPrivateProfileString(S_DOORS, K_MYPROJECTDIR, value) End If NotifyPropertyChanged("MyProjectDir") End Set End Property Public Property MachinDir As String Get Return IniFile.m_MachinProject End Get Set(value As String) If value IsNot IniFile.m_MachinProject Then IniFile.m_MachinProject = value WriteMainPrivateProfileString(S_DOORS, K_MACHINDIR, value) End If NotifyPropertyChanged("MachinDir") End Set End Property '---------------------------------------------------------------------------------------------------------------------------------------------------- Public ReadOnly Property EnableAssembly As Boolean Get Return (OptionModule.m_ConfigurationSoftware = ConfigType.Assembly) End Get End Property Public Property LightUp As String Get Return OptionModule.m_LightUp End Get Set(value As String) OptionModule.m_LightUp = value DefaultWritePrivateProfileString(S_LIGHT, K_LIGHTUP, OptionModule.m_LightUp) End Set End Property Public Property LightBottom As String Get Return OptionModule.m_LightBottom End Get Set(value As String) OptionModule.m_LightBottom = value ' modifico le dimensioni dei Jambs DefaultWritePrivateProfileString(S_LIGHT, K_LIGHTBOTTOM, OptionModule.m_LightBottom) End Set End Property Public Property LightHinge As String Get Return OptionModule.m_LightHinge End Get Set(value As String) OptionModule.m_LightHinge = value DefaultWritePrivateProfileString(S_LIGHT, K_LIGHTHINGE, OptionModule.m_LightHinge) End Set End Property Public Property LightLock As String Get Return OptionModule.m_LightLock End Get Set(value As String) OptionModule.m_LightLock = value DefaultWritePrivateProfileString(S_LIGHT, K_LIGHTLOCK, OptionModule.m_LightLock) End Set End Property ' spessore del jamb della testa Public Property ThicknessHead As String Get Return OptionModule.m_ThicknessHead End Get Set(value As String) OptionModule.m_ThicknessHead = value DefaultWritePrivateProfileString(S_OVERLAP, K_THICKNESSHEAD, OptionModule.m_ThicknessHead) End Set End Property Public Property OverlapHinge As String Get Return OptionModule.m_OverlapHinge End Get Set(value As String) OptionModule.m_OverlapHinge = value DefaultWritePrivateProfileString(S_OVERLAP, K_OVERLAPHINGE, OptionModule.m_OverlapHinge) End Set End Property Public Property OverlapLock As String Get Return OptionModule.m_OverlapLock End Get Set(value As String) OptionModule.m_OverlapLock = value DefaultWritePrivateProfileString(S_OVERLAP, K_OVERLAPLOCK, OptionModule.m_OverlapLock) End Set End Property Public Property OverlapTop As String Get Return OptionModule.m_OverlapTop End Get Set(value As String) OptionModule.m_OverlapTop = value DefaultWritePrivateProfileString(S_OVERLAP, K_OVERLAPTOP, OptionModule.m_OverlapTop) End Set End Property Public Property DeltaThickness As String Get Return OptionModule.m_DeltaThickness End Get Set(value As String) OptionModule.m_DeltaThickness = value DefaultWritePrivateProfileString(S_OVERLAP, K_DELTAT, OptionModule.m_DeltaThickness) End Set End Property Public Property Exterior As Boolean Get Return OptionModule.m_Exterior End Get Set(value As Boolean) OptionModule.m_Exterior = value If OptionModule.m_Exterior Then DefaultWritePrivateProfileString(S_OVERLAP, K_EXTERIOR, "1") Else DefaultWritePrivateProfileString(S_OVERLAP, K_EXTERIOR, "0") End If End Set End Property Public Property TotalDimension As Boolean Get If OptionModule.m_TotalDimension Then DefaultWritePrivateProfileString(S_TOTALDIMENSION, K_STATIC, "1") Else DefaultWritePrivateProfileString(S_TOTALDIMENSION, K_STATIC, "0") End If Return OptionModule.m_TotalDimension End Get Set(value As Boolean) OptionModule.m_TotalDimension = value NotifyPropertyChanged("TotalDimension") ' aggiorno la grafica If Not IsNothing(Map.refAssemblyPageVM) AndAlso Not IsNothing(Map.refAssemblyPageVM.CurrAssembly) Then Map.refAssemblyPageVM.CurrAssembly.Dimension = OptionModule.m_TotalDimension End If End Set End Property Public Property TotalHeight As String Get 'If Not IsNothing(Map.refAssemblyPageVM) AndAlso Not IsNothing(Map.refAssemblyPageVM.CurrAssembly) Then ' If Not IsNothing(Map.refAssemblyManagerVM.ReserchPartDoor("FL_")) Then ' OptionModule.m_TotalHeight = Map.refAssemblyManagerVM.ReserchPartDoor("FL_").Door.Height ' Else ' TotalDimension = False ' End If 'End If DefaultWritePrivateProfileString(S_TOTALDIMENSION, K_TOTALHEIGHT, OptionModule.m_TotalHeight) Return OptionModule.m_TotalHeight End Get Set(value As String) OptionModule.m_TotalHeight = value NotifyPropertyChanged("TotalHeight") 'If Not IsNothing(Map.refAssemblyPageVM) AndAlso Not IsNothing(Map.refAssemblyPageVM.CurrAssembly) Then ' Map.refAssemblyPageVM.CurrAssembly.SetDimension("Height") ' Map.refSceneManagerVM.RefreshBtn() 'End If End Set End Property Public Property TotalWidth As String Get 'If Not IsNothing(Map.refAssemblyPageVM) AndAlso Not IsNothing(Map.refAssemblyPageVM.CurrAssembly) Then ' Dim DO_1 As PartDoor = Map.refAssemblyManagerVM.ReserchPartDoor("DO_1") ' Dim DO_2 As PartDoor = Map.refAssemblyManagerVM.ReserchPartDoor("DO_2") ' Dim LL As String = Map.refAssemblyPageVM.CurrAssembly.LightLock ' Dim LH As String = Map.refAssemblyPageVM.CurrAssembly.LightHinge ' Dim JW As String = Map.refAssemblyPageVM.CurrAssembly.Width ' If Not IsNothing(DO_1) Then ' Dim nDO_1Width As Double = 0 ' Dim nDO_2Width As Double = 0 ' StringToDouble(DO_1.Door.Width, nDO_1Width) ' Dim nJW As Double = 0 ' StringToDouble(JW, nJW) ' Dim nLL As Double = 0 ' StringToDouble(LL, nLL) ' Dim nLH As Double = 0 ' StringToDouble(LH, nLH) ' If Not IsNothing(DO_2) Then ' StringToDouble(DO_2.Door.Width, nDO_2Width) ' OptionModule.m_TotalWidth = DoubleToString(nDO_1Width + nDO_2Width + nLL + nLH * 2 + 2 * nJW, 4) ' Else ' OptionModule.m_TotalWidth = DoubleToString(nDO_1Width + nLL + nLH + 2 * nJW, 4) ' End If ' Else ' TotalDimension = False ' End If 'End If DefaultWritePrivateProfileString(S_TOTALDIMENSION, K_TOTALWIDTH, OptionModule.m_TotalWidth) Return OptionModule.m_TotalWidth End Get Set(value As String) OptionModule.m_TotalWidth = value NotifyPropertyChanged("TotalWidth") End Set End Property Public Property ThicknessJamb As String Get Return OptionModule.m_ThicknessJamb End Get Set(value As String) OptionModule.m_ThicknessJamb = value DefaultWritePrivateProfileString(S_SIZEJAMB, K_THICKNESS, OptionModule.m_ThicknessJamb) End Set End Property Public Property WidthJamb As String Get Return OptionModule.m_WidthJamb End Get Set(value As String) OptionModule.m_WidthJamb = value DefaultWritePrivateProfileString(S_SIZEJAMB, K_WIDTH, OptionModule.m_WidthJamb) End Set End Property Public ReadOnly Property DoorListNumber As List(Of String) Get Return OptionModule.m_DoorsListNumber End Get End Property Public Property DoorNumber As String Get Return OptionModule.m_DoorsNumber End Get Set(value As String) End Set End Property Public Property LockEdgeTypeAssembly As EdgeType Get If m_LockEdgeTypeAssembly.IsActive = Visibility.Collapsed Then OptionModule.m_LockEdgeTypeAssembly = FrameEdgeTypeList(0) End If Return OptionModule.m_LockEdgeTypeAssembly End Get Set(value As EdgeType) OptionModule.m_LockEdgeTypeAssembly = value DefaultWritePrivateProfileString(S_EDGEASSEMBLY, K_LOCKEDGE, OptionModule.m_LockEdgeTypeAssembly.Name) End Set End Property Public Property HingeEdgeTypeAssembly As EdgeType Get If m_HingeEdgeTypeAssembly.IsActive = Visibility.Collapsed Then OptionModule.m_HingeEdgeTypeAssembly = FrameEdgeTypeList(0) End If Return OptionModule.m_HingeEdgeTypeAssembly End Get Set(value As EdgeType) OptionModule.m_HingeEdgeTypeAssembly = value DefaultWritePrivateProfileString(S_EDGEASSEMBLY, K_HINGEDGE_INI, OptionModule.m_HingeEdgeTypeAssembly.Name) End Set End Property Public Property TopTypeAssembly As EdgeType Get If m_TopTypeAssembly.IsActive = Visibility.Collapsed Then OptionModule.m_TopTypeAssembly = FrameEdgeTypeList(0) End If Return OptionModule.m_TopTypeAssembly End Get Set(value As EdgeType) OptionModule.m_TopTypeAssembly = value DefaultWritePrivateProfileString(S_EDGEASSEMBLY, K_TOPEDGE_INI, OptionModule.m_TopTypeAssembly.Name) End Set End Property Public Property BottomTypeAssembly As EdgeType Get If m_BottomTypeAssembly.IsActive = Visibility.Collapsed Then OptionModule.m_BottomTypeAssembly = FrameEdgeTypeList(0) End If Return OptionModule.m_BottomTypeAssembly End Get Set(value As EdgeType) OptionModule.m_BottomTypeAssembly = value DefaultWritePrivateProfileString(S_EDGEASSEMBLY, K_BOTTOMEDGE_INI, OptionModule.m_BottomTypeAssembly.Name) End Set End Property #Region "Machining Assembly" Public Property LockEdgeMachiningAssembly As Boolean Get Return OptionModule.m_LockEdgeMachiningAssembly End Get Set(value As Boolean) OptionModule.m_LockEdgeMachiningAssembly = value If value Then DefaultWritePrivateProfileString(S_MACHININGASSEMBLY, K_LOCKEDGEISCHECKED_INI, "1") Else DefaultWritePrivateProfileString(S_MACHININGASSEMBLY, K_LOCKEDGEISCHECKED_INI, "0") End If End Set End Property Public Property LockEdgeOverMaterialAssembly As String Get Return OptionModule.m_LockEdgeOverMaterialAssembly End Get Set(value As String) OptionModule.m_LockEdgeOverMaterialAssembly = value DefaultWritePrivateProfileString(S_OVERMATERIALASSEMBLY, K_LOCKEDGEOVERMATERIAL_INI, OptionModule.m_LockEdgeOverMaterialAssembly) End Set End Property Public Property HingeEdgeMachiningAssembly As Boolean Get Return OptionModule.m_HingeEdgeMachiningAssembly End Get Set(value As Boolean) OptionModule.m_HingeEdgeMachiningAssembly = value If value Then DefaultWritePrivateProfileString(S_MACHININGASSEMBLY, K_HINGEDGEEISCHECKED_INI, "1") Else DefaultWritePrivateProfileString(S_MACHININGASSEMBLY, K_HINGEDGEEISCHECKED_INI, "0") End If End Set End Property Public Property HingeEdgeOverMaterialAssembly As String Get Return OptionModule.m_HingeEdgeOverMaterialAssembly End Get Set(value As String) OptionModule.m_HingeEdgeOverMaterialAssembly = value DefaultWritePrivateProfileString(S_OVERMATERIALASSEMBLY, K_HINGEDGEOVERMATERIAL_INI, OptionModule.m_HingeEdgeOverMaterialAssembly) End Set End Property Public Property TopMachiningAssembly As Boolean Get Return OptionModule.m_TopMachiningAssembly End Get Set(value As Boolean) OptionModule.m_TopMachiningAssembly = value If value Then DefaultWritePrivateProfileString(S_MACHININGASSEMBLY, K_TOPISCHECKED_INI, "1") Else DefaultWritePrivateProfileString(S_MACHININGASSEMBLY, K_TOPISCHECKED_INI, "0") End If End Set End Property Public Property TopOverMaterialAssembly As String Get Return OptionModule.m_TopOverMaterialAssembly End Get Set(value As String) OptionModule.m_TopOverMaterialAssembly = value DefaultWritePrivateProfileString(S_OVERMATERIALASSEMBLY, K_TOPOVERMATERIAL_INI, OptionModule.m_TopOverMaterialAssembly) End Set End Property Public Property BottomMachiningAssembly As Boolean Get Return OptionModule.m_BottomMachiningAssembly End Get Set(value As Boolean) OptionModule.m_BottomMachiningAssembly = value If value Then DefaultWritePrivateProfileString(S_MACHININGASSEMBLY, K_BOTTOMISCHECKED_INI, "1") Else DefaultWritePrivateProfileString(S_MACHININGASSEMBLY, K_BOTTOMISCHECKED_INI, "0") End If End Set End Property Public Property BottomOverMaterialAssembly As String Get Return OptionModule.m_BottomOverMaterialAssembly End Get Set(value As String) OptionModule.m_BottomOverMaterialAssembly = value DefaultWritePrivateProfileString(S_OVERMATERIALASSEMBLY, K_BOTTOMOVERMATERIAL_INI, OptionModule.m_BottomOverMaterialAssembly) End Set End Property #End Region ' Machining Assembly '------------------------------------------------------------------------------------------------------------------------------------------------------- ' Definizione comandi Private m_cmdCloseOptions As ICommand Private m_cmdBrowse As ICommand Private m_F1GuideCmd As ICommand #Region "Messages" Public ReadOnly Property Title As String Get Return EgtMsg(MSG_MAINWINDOW + 209) End Get End Property Public ReadOnly Property StartUpMsg As String Get Return EgtMsg(MSG_MAINWINDOW + 210) End Get End Property Public ReadOnly Property CurrentLanguageMsg As String Get Return EgtMsg(MSG_OPTIONPAGE + 1) End Get End Property Public ReadOnly Property LanguageAdvertMsg As String Get Return EgtMsg(MSG_OPTIONPAGE + 2) End Get End Property Public ReadOnly Property MeasureUnit As String Get Return EgtMsg(50211) End Get End Property Public ReadOnly Property DirectoryMsg As String Get Return EgtMsg(50212) End Get End Property Public ReadOnly Property MachinDirectoryMsg As String Get ' Directory Machine Return EgtMsg(50306) End Get End Property Public ReadOnly Property General As String Get Return EgtMsg(MSG_MAINWINDOW + 201) End Get End Property Public ReadOnly Property OptionStart As String Get Return EgtMsg(50213) End Get End Property Public ReadOnly Property CurrentUnitMeasure As String Get Return EgtMsg(50200) End Get End Property Public ReadOnly Property CurrentDirectiry As String Get Return EgtMsg(50214) End Get End Property Public ReadOnly Property CurrentMachinDirectiry As String Get 'Machine Return EgtMsg(50307) End Get End Property Public ReadOnly Property DoorMsg As String Get 'Door Return EgtMsg(50308) End Get End Property Public ReadOnly Property WidthMsg As String Get Return EgtMsg(MSG_MAINWINDOW + 1) End Get End Property Public ReadOnly Property EdgeMsg As String Get Return EgtMsg(50215) End Get End Property Public ReadOnly Property OverMaterialMsg As String Get Return EgtMsg(50216) End Get End Property Public ReadOnly Property HeightMsg As String Get Return EgtMsg(MSG_MAINWINDOW + 2) End Get End Property Public ReadOnly Property ThicknessMsg As String Get Return EgtMsg(MSG_MAINWINDOW + 3) End Get End Property Public ReadOnly Property SwingMsg As String Get Return EgtMsg(MSG_MAINWINDOW + 4) End Get End Property Public ReadOnly Property LockEdgeMsg As String Get Return EgtMsg(MSG_MAINWINDOW + 5) End Get End Property Public ReadOnly Property HingeEdgeMsg As String Get Return EgtMsg(MSG_MAINWINDOW + 6) End Get End Property Public ReadOnly Property TopMsg As String Get Return EgtMsg(MSG_MAINWINDOW + 7) End Get End Property Public ReadOnly Property WeightMsg As String Get Return EgtMsg(MSG_MAINWINDOW + 47) End Get End Property Public ReadOnly Property BottomMsg As String Get Return EgtMsg(MSG_MAINWINDOW + 8) End Get End Property ' Machinig Public ReadOnly Property LockEdgeOverMaterial As String Get Return EgtMsg(MSG_MAINWINDOW + 202) End Get End Property Public ReadOnly Property HingeEdgeOverMaterial As String Get Return EgtMsg(MSG_MAINWINDOW + 203) End Get End Property Public ReadOnly Property TopOverMaterial As String Get Return EgtMsg(MSG_MAINWINDOW + 204) End Get End Property Public ReadOnly Property BottomOverMaterial As String Get Return EgtMsg(MSG_MAINWINDOW + 205) End Get End Property Public ReadOnly Property MsgBrowse As String Get Return EgtMsg(50217) End Get End Property Public ReadOnly Property MsgClose As String Get Return EgtMsg(50218) End Get End Property Public ReadOnly Property MachMsg As String Get Return "Mach." End Get End Property ' BevelMsg Public ReadOnly Property BevelMsg As String Get Return EgtMsg(50219) End Get End Property Public ReadOnly Property BevelUpMsg As String Get Return EgtMsg(50220) End Get End Property Public ReadOnly Property BevelDownMsg As String Get Return EgtMsg(50221) End Get End Property Public ReadOnly Property MachinePositionMsg As String Get Return EgtMsg(50222) End Get End Property Public ReadOnly Property DispConfiguration As String Get Dim Msg As String = String.Empty If OptionModule.m_sDisposition = ConstGen.BEVEL_UP Then 'Wide Side Down (BU) Msg = EgtMsg(50309) m_BevelConfiguration = Visibility.Visible m_BySwingConfiguration = Visibility.Collapsed ElseIf OptionModule.m_sDisposition = ConstGen.BEVEL_DOWN Then 'Wide Side Up (BD) Msg = EgtMsg(50310) m_BevelConfiguration = Visibility.Visible m_BySwingConfiguration = Visibility.Collapsed Else m_BevelConfiguration = Visibility.Collapsed m_BySwingConfiguration = Visibility.Visible End If Return Msg End Get End Property Private m_BevelConfiguration As Visibility Public ReadOnly Property BevelConfiguration As Visibility Get Return m_BevelConfiguration End Get End Property Private m_BySwingConfiguration As Visibility Public ReadOnly Property BySwingConfiguration As Visibility Get Return m_BySwingConfiguration End Get End Property '--------------------------------------------------------------------------------------------------------------------------------------------------------------- 'tab2 Public ReadOnly Property AssemblyMsg As String Get Return "Assembly" End Get End Property Public ReadOnly Property LightUpMsg As String Get Return "Light Up" End Get End Property Public ReadOnly Property LightLockMsg As String Get Return "Light Lock" End Get End Property Public ReadOnly Property LightBottomMsg As String Get Return "Light Bottom" End Get End Property Public ReadOnly Property LightHingeMsg As String Get Return "Light Hinge" End Get End Property Public ReadOnly Property ThicknessHeadMsg As String Get Return "Thickness Head" End Get End Property Public ReadOnly Property OverlapHingeMsg As String Get Return "Overlap Hinge" End Get End Property Public ReadOnly Property OverlapLockMsg As String Get Return "Overlap Lock" End Get End Property Public ReadOnly Property OverlapTopMsg As String Get Return "Overlap Top" End Get End Property Public ReadOnly Property DeltaTMsg As String Get Return "Delta T" End Get End Property Public ReadOnly Property ExteriorMsg As String Get Return "Exterior" End Get End Property Public ReadOnly Property DoorNumberMsg As String Get Return "Number Doors" End Get End Property Public ReadOnly Property JambsAndDoorsMsg As String Get Return "Jambs and Doors" End Get End Property Public ReadOnly Property TotalDimesionMsg As String Get Return "Total Dimension" End Get End Property Public ReadOnly Property TotalHeightMsg As String Get Return "Height" End Get End Property Public ReadOnly Property TotalWidthMsg As String Get Return "Width" End Get End Property #End Region ' Controllo di eliminare un bevel dalla lista: 1 se accendo un bevel, 2 se spengo un bevel, -1 tutti i casi che non sono questi Private Function CheckBevel(VisibilityBevel As Visibility, bValue As Boolean) As Integer Dim bAnser As Integer Dim bBevel As Boolean ' converto il parametro di visibilità in un booleano If VisibilityBevel = Visibility.Visible Then bBevel = True Else bBevel = False End If If bBevel And Not bValue Then ' significa che sta togliendo dalla lista bAnser = 1 ElseIf Not bBevel And bValue Then ' sto aggiungendo un bevel alla lista bAnser = 2 Else ' non accade nulla bAnser = -1 End If Return bAnser End Function ' chiedo se vuole continuare: vero se cambia li lista Private Function QuestionSetBevel(bCheckBevel As Integer, sBevel As String) As Boolean If Not IsNothing(Map.refPartPageVM.CurrPart) Or IsNothing(Map.refAssemblyPageVM.CurrAssembly) Then ' se la porta esiste If bCheckBevel = 1 Then ' controllo se sto eliminando da uno degli elementi della lista: se si chiedo di continuare If Map.refPartPageVM.CurrPart.DispositionItem.Name = sBevel Then ' Se blocco tutto non accade nulla -- It is the bevel of the current door. Do You want to proced? If MessageBox.Show(EgtMsg(50154), EgtMsg(50115), MessageBoxButton.YesNo, MessageBoxImage.Asterisk, MessageBoxResult.No) = MessageBoxResult.No Then Return False Else ' se decido di continuare Return True End If Else ' se non sono presenti elementi nella lista procedo nella eliminazione Return True End If ' se sto attivando un bevel nella lista ElseIf bCheckBevel = 2 Then Return True Else ' per tutti gli altri casi (-1) non accade nulla Return False End If Else Return True End If End Function ' aggiorno la visibilità dei bevel Up e Down Public Sub RefreshEdgeTypeList() '--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ' aggiorno la lista delle disposizioni For IndexBeveDisp As Integer = 0 To Part.m_DispositionList.Count - 1 If Part.m_DispositionList(IndexBeveDisp).Name = ConstGen.BEVEL_UP Then Part.m_DispositionList(IndexBeveDisp).IsActive = OptionModule.m_bBevelUp ElseIf Part.m_DispositionList(IndexBeveDisp).Name = ConstGen.BEVEL_DOWN Then Part.m_DispositionList(IndexBeveDisp).IsActive = OptionModule.m_bBevelDown End If Next ' aggiorno la lista Map.refPartPageVM.CurrPart.NotifyPropertyChanged("DispositionList") ' verifico che l'elemento selezionato nella option page non sia stato disattivato If Not IsNothing(Map.refPartPageVM.CurrPart) Then If Map.refPartPageVM.CurrPart.DispositionItem.IsActive = Visibility.Collapsed Then Map.refPartPageVM.CurrPart.DispositionItem = Part.m_DispositionList(2) End If End Sub ' creo le liste dei bevel e delle siposizioni Public Shared Sub CreateEdgeTypeList() '---------------------------------------------------------------------------------------------------------- ' carico la lista dei bevel da mostrare sugli spigoli Lock, Hinge LockHingeEdge(Part.m_LockEdgeTypeList) LockHingeEdge(Part.m_HingeEdgeTypeList) '---------------------------------------------------------------------------------------------------------- ' caricare gli spigoli top e bottom TopBottomEdge(Part.m_TopEdgeTypeList) TopBottomEdge(Part.m_BottomEdgeTypeList) '---------------------------------------------------------------------------------------------------------- ' caricare gli spigoli dei frame TopBottomEdge(Assembly.m_FrameEdgeTypeList) '---------------------------------------------------------------------------------------------------------- ' carico la lista che contiene la disposizione in macchina Part.m_DispositionList.Add(New EdgeType(ConstGen.BEVEL_UP, OptionModule.m_bBevelUp)) Part.m_DispositionList.Add(New EdgeType(ConstGen.BEVEL_DOWN, OptionModule.m_bBevelDown)) Part.m_DispositionList.Add(New EdgeType(ConstGen.BEVEL_BYSWING, Visibility.Visible)) ' assegno il valore della disposizione letto dal file Config.ini If IsNothing(OptionModule.m_Disposition) Then OptionModule.m_Disposition = Part.m_DispositionList(2) ElseIf OptionModule.m_Disposition.Name <> ConstGen.BEVEL_UP AndAlso OptionModule.m_Disposition.Name <> ConstGen.BEVEL_DOWN Then OptionModule.m_Disposition = Part.m_DispositionList(2) End If End Sub ' carica la lista con tutte le lavorazioni legate agli spigoli Lock e Hinge Public Shared Sub LockHingeEdge(ByVal EdgeList As ObservableCollection(Of EdgeType)) For Index = 0 To m_StaticEdgeTypeList.Count - 1 If m_StaticEdgeTypeList(Index) = ConstGen.BEVEL_UP OrElse m_StaticEdgeTypeList(Index) = ConstGen.BEVEL_DOWN OrElse m_StaticEdgeTypeList(Index) = ConstGen.BEVEL_GRAPHIC OrElse m_StaticEdgeTypeList(Index) = ConstGen.BEVEL_SQUARED Then Else EdgeList.Add(New EdgeType(m_StaticEdgeTypeList(Index), Visibility.Visible)) End If Next EdgeList.Insert(0, New EdgeType(ConstGen.BEVEL_SQUARED, Visibility.Visible)) EdgeList.Insert(0, New EdgeType(ConstGen.BEVEL_GRAPHIC, Visibility.Visible)) End Sub ' carica la lista con tutte le lavorazioni legate agli spigoli Top e Bottom e Frame Public Shared Sub TopBottomEdge(ByVal EdgeList As ObservableCollection(Of EdgeType)) Try ' controllo che nella configurazione sia presente il Bevel BV EdgeList.Add(EdgeList.First(Function(x) x.Name = ConstGen.BEVEL_SQUARED)) Catch ex As Exception EdgeList.Add(New EdgeType(ConstGen.BEVEL_SQUARED, Visibility.Visible)) End Try Try ' controllo che nella configurazione sia presente il Bevel BV EdgeList.Add(EdgeList.First(Function(x) x.Name = ConstGen.BEVEL_GRAPHIC)) Catch ex As Exception EdgeList.Add(New EdgeType(ConstGen.BEVEL_GRAPHIC, Visibility.Visible)) End Try End Sub Sub New() Map.SetRefOptionsVM(Me) End Sub #Region "COMMANDS" #Region "CloseOptionsCommand" ''' ''' Returns a command that remove the current selected machining. ''' Public ReadOnly Property CloseOptionsCommand() As ICommand Get If m_cmdCloseOptions Is Nothing Then m_cmdCloseOptions = New Command(AddressOf CloseOptions) End If Return m_cmdCloseOptions End Get End Property ''' ''' Manage the MachiningDb closing. This method is invoked by the CloseMachiningDbCommand. ''' Public Sub CloseOptions() ' Chiusura finestra For Each Window In Application.Current.Windows If TypeOf Window Is OptionsV Then Dim OptionsWindow As OptionsV = DirectCast(Window, OptionsV) ' se eseguo una modifica prima di avere una porta...controllo bene!! If Not IsNothing(Map.refPartPageVM.CurrPart) Then Map.refPartPageVM.CurrPart.VisibilityWeight = Part.IsCheckedWeight Map.refPartPageVM.CurrPart.NotifyPropertyChanged("Weight") Map.refPartPageVM.CurrPart.NotifyPropertyChanged("VisibilityWeight") End If OptionsWindow.Close() End If Next End Sub #End Region ' CloseOptionsCommand Public ReadOnly Property BrowseCommand() As ICommand Get If m_cmdBrowse Is Nothing Then m_cmdBrowse = New Command(AddressOf Browse) End If Return m_cmdBrowse End Get End Property Public Sub Browse(param As Object) Dim SelectButton As String = (CStr(param)) Select Case SelectButton Case "MyProject" Dim FolderBrowserDialog As New System.Windows.Forms.FolderBrowserDialog FolderBrowserDialog.SelectedPath = IniFile.m_MyProjectDir ' mostriamo la finestra di dialogo aperta fino alla directory MyProjects If FolderBrowserDialog.ShowDialog <> Forms.DialogResult.OK Then ' se la risposta è diversa da OK esce Return End If MyProjectDir = FolderBrowserDialog.SelectedPath Case "MachinDir" Dim FolderBrowserDialog As New System.Windows.Forms.FolderBrowserDialog FolderBrowserDialog.SelectedPath = IniFile.m_MachinProject ' mostriamo la finestra di dialogo aperta fino alla directory MyProjects If FolderBrowserDialog.ShowDialog <> Forms.DialogResult.OK Then ' se la risposta è diversa da OK esce Return End If MachinDir = FolderBrowserDialog.SelectedPath End Select End Sub Public ReadOnly Property OptionGuideCmd As ICommand Get If m_F1GuideCmd Is Nothing Then m_F1GuideCmd = New Command(AddressOf F1Guide) End If Return m_F1GuideCmd End Get End Property Public Sub F1Guide() Dim rfGuideVM As New GuideVM End Sub #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 Public Class EdgeType Implements INotifyPropertyChanged Private m_Name As String Public Property Name As String Get Return m_Name End Get Set(value As String) m_Name = value End Set End Property Private m_IsActive As Visibility Public Property IsActive As Visibility Get Return m_IsActive End Get Set(value As Visibility) m_IsActive = value NotifyPropertyChanged("IsActive") End Set End Property Private m_BevelDDF As String Public Property BevelDDF As String Get Return m_BevelDDF End Get Set(value As String) m_BevelDDF = value End Set End Property Sub New(sName As String, bIsActive As Visibility) m_Name = sName m_IsActive = bIsActive End Sub Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged Public Sub NotifyPropertyChanged(propName As String) RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName)) End Sub End Class