Files
EgtDOORCreator/DoorParameters/PartPageVM.vb
2023-01-18 12:54:54 +01:00

468 lines
13 KiB
VB.net

Imports System.ComponentModel
Imports System.Collections.ObjectModel
Imports EgtUILib
'Imports System.Text.RegularExpressions
Public Class PartPageVM
Implements INotifyPropertyChanged
Friend bSetChange As Boolean = False
Private m_CurrPart As Part
Public Property CurrPart As Part
Get
Return m_CurrPart
End Get
Set(value As Part)
m_CurrPart = value
If Not IsNothing(m_CurrPart) Then
Map.refAssemblyPageVM.CurrAssembly.SetVarAssembly()
End If
NotifyPropertyChanged("CurrPart")
End Set
End Property
' il bottone accanto al General della porta corrente
Private m_OrderButtonVisibility As Visibility = Visibility.Visible
Public ReadOnly Property OrderButtonVisibility As Visibility
Get
SetOrderButtonVisibility()
Return m_OrderButtonVisibility
End Get
End Property
Public Sub SetOrderButtonVisibility()
If OptionModule.m_ConfigurationSoftware = ConfigType.Door Then
m_OrderButtonVisibility = Visibility.Visible
Else
m_OrderButtonVisibility = Visibility.Collapsed
End If
End Sub
Public ReadOnly Property VisibilityTopShape As Visibility
Get
' se l'oggetto visualizzato esiste ed è un frame
If Not IsNothing(m_CurrPart) AndAlso m_CurrPart.TypePart.Contains("F") Then
Return Visibility.Collapsed
End If
Return OptionModule.m_DisableArch
End Get
End Property
Public ReadOnly Property AllignGropBox As Visibility
Get
If Not IsNothing(m_CurrPart) AndAlso m_CurrPart.TypePart.Contains("F") Then
Return Visibility.Collapsed
End If
If OptionModule.m_DisableArch = Visibility.Visible Then
Return Visibility.Hidden
Else
Return Visibility.Collapsed
End If
End Get
End Property
Public ReadOnly Property DispositionVisibility As Visibility
Get
Return OptionModule.DispositionVisibility()
End Get
End Property
Private m_CompoPanelPart As CompoPanelV
Public ReadOnly Property CompoPanelControl As ContentControl
Get
Return m_CompoPanelPart
End Get
End Property
#Region "DISPOSITION SCREEN"
Public ReadOnly Property WidthColumn1 As String
Get
If OptionModule.m_nDispostionScreen = 0 Or OptionModule.m_nDispostionScreen = 1 Then
Return "1*"
Else
Return "5*"
End If
End Get
End Property
Public ReadOnly Property WidthColumn2 As String
Get
If OptionModule.m_nDispostionScreen = 0 Or OptionModule.m_nDispostionScreen = 1 Then
Return "5*"
Else
Return "1*"
End If
End Get
End Property
Public ReadOnly Property GridGeneralDiposition As String
Get
If OptionModule.m_nDispostionScreen = 0 Or OptionModule.m_nDispostionScreen = 1 Then
Return "1"
Else
Return "0"
End If
End Get
End Property
Public ReadOnly Property CompoPanelDiposition As String
Get
If OptionModule.m_nDispostionScreen = 0 Or OptionModule.m_nDispostionScreen = 1 Then
Return "0"
Else
Return "1"
End If
End Get
End Property
#End Region ' Disposition Screen
#Region "CONSTUCTOR"
Sub New()
Map.SetRefDoorParametersVM(Me)
If IsNothing(Map.refCompoPanelVM) Then Map.SetRefCompoPanelVM(New CompoPanelVM("PartPage"))
If IsNothing(m_CompoPanelPart) Then m_CompoPanelPart = New CompoPanelV
m_CompoPanelPart.DataContext = Map.refCompoPanelVM
m_IsReadOnly = OptionModule.ReadOnlyDDF
End Sub
Sub PrepareEvent()
If Not IsNothing(Map.refInstrumentPanelVM) Then
AddHandler Map.refInstrumentPanelVM.EnableCurrentPage, AddressOf Me.SetStatusPage
End If
End Sub
#End Region
#Region "Messages"
'General'
Public ReadOnly Property MachMsg As String
Get
' 50711 = Mach.
Return EgtMsg(50711)
End Get
End Property
Public ReadOnly Property ResizeMsg As String
Get
'50311=Resize
Return EgtMsg(50311)
End Get
End Property
Public ReadOnly Property EdgeMsg As String
Get
Return EgtMsg(50044)
End Get
End Property
Public ReadOnly Property OverMaterialMsg As String
Get
Return EgtMsg(50045)
End Get
End Property
Public ReadOnly Property GeneralMsg As String
Get
Return EgtMsg(50040)
End Get
End Property
Public ReadOnly Property WidthMsg As String
Get
Return EgtMsg(50001)
End Get
End Property
Public ReadOnly Property HeightMsg As String
Get
Return EgtMsg(50002)
End Get
End Property
Public ReadOnly Property ThicknessMsg As String
Get
Return EgtMsg(50003)
End Get
End Property
Public ReadOnly Property SwingMsg As String
Get
Return EgtMsg(50004)
End Get
End Property
'Profiles'
Public ReadOnly Property LockedgeMsg As String
Get
Return EgtMsg(50005)
End Get
End Property
Public ReadOnly Property HingeedgeMsg As String
Get
Return EgtMsg(50006)
End Get
End Property
Public ReadOnly Property TopMsg As String
Get
Return EgtMsg(50007)
End Get
End Property
Public ReadOnly Property BottomMsg As String
Get
Return EgtMsg(50008)
End Get
End Property
Public ReadOnly Property DispositionMsg As String
Get
' Disposition
Return EgtMsg(50069)
End Get
End Property
Public ReadOnly Property DeleteBtnMsg As String
Get
Return EgtMsg(50126)
End Get
End Property
Public ReadOnly Property WeightMsg As String
Get
Return EgtMsg(50047)
End Get
End Property
Public ReadOnly Property InvertBevelMsg As String
Get
Return EgtMsg(50071)
End Get
End Property
Public ReadOnly Property OrderMsg As String
Get
' Order
Return EgtMsg(50068)
End Get
End Property
Public ReadOnly Property RadiusMsg As String
Get
' 50704 = Radius
Return EgtMsg(50704)
End Get
End Property
Public ReadOnly Property AngleMsg As String
Get
' 50705 = Angle
Return EgtMsg(50705)
End Get
End Property
Public ReadOnly Property PosxMsg As String
Get
' 50706 = Pos_x
Return EgtMsg(50706)
End Get
End Property
Public ReadOnly Property TopArcMsg As String
Get
' 50707 = Top Arc
Return EgtMsg(50707)
End Get
End Property
Public ReadOnly Property TopAngleMsg As String
Get
' 50708 = Top Angle
Return EgtMsg(50708)
End Get
End Property
Public ReadOnly Property PropertyMsg As String
Get
' 50709 = Properties
Return EgtMsg(50709)
End Get
End Property
Public ReadOnly Property MaterialMsg As String
Get
' 50710 = Material
Return EgtMsg(50710)
End Get
End Property
Public ReadOnly Property CutMsg As String
Get
Return "Cut"
End Get
End Property
Public ReadOnly Property PosCutMsg As String
Get
Return "Pos."
End Get
End Property
Public ReadOnly Property OrientationMsg As String
Get
Return "Dir."
End Get
End Property
Public ReadOnly Property DeleteCompoToolTip As String
Get
Return EgtMsg(50142)
End Get
End Property
Public ReadOnly Property ReloadCompoRefToolTip As String
Get
Return EgtMsg(50423)
End Get
End Property
Public ReadOnly Property GoToHardwareToolTip As String
Get
' Hardware
Return EgtMsg(50413)
End Get
End Property
#End Region
Private m_IsResize As Boolean
Public Property IsResize As Boolean
Get
Return m_IsResize
End Get
Set(value As Boolean)
m_IsResize = value
NotifyPropertyChanged("IsResize")
End Set
End Property
Sub SetStatusPage()
NotifyPropertyChanged("EnablePageDoor")
End Sub
Public ReadOnly Property EnablePageDoor As Boolean
Get
Map.refProjectManagerVM.NotifyPropertyChanged("EnableProjectManager")
Map.refAssemblyManagerVM.NotifyPropertyChanged("EnableAssebmlyManager")
If Not IsNothing(Map.refInstrumentPanelVM) Then
Return Map.refInstrumentPanelVM.EnablePage
Else
Return True
End If
End Get
End Property
Private m_IsReadOnly As Boolean
Public Property IsRaedOnly As Boolean
Get
Return m_IsReadOnly
End Get
Set(value As Boolean)
m_IsReadOnly = value
NotifyPropertyChanged("IsRaedOnly")
NotifyPropertyChanged("DisableHeight")
NotifyPropertyChanged("DisableWidth")
End Set
End Property
' vero se la porta è Inactive, Falso il contrario
Private m_IsInactive As Boolean = False
Public Property IsInactive As Boolean
Get
Return m_IsInactive
End Get
Set(value As Boolean)
m_IsInactive = value
NotifyPropertyChanged("IsInactive")
End Set
End Property
Public ReadOnly Property DisableHeight As Boolean
Get
If Not IsNothing(Map.refAssemblyPageVM.CurrAssembly) AndAlso Map.refPartPageVM.CurrPart.TypePart.Contains("DO_") Then
Return Map.refAssemblyPageVM.CurrAssembly.Dimension
Else
Return m_IsReadOnly
End If
End Get
End Property
Public ReadOnly Property DisableWidth As Boolean
Get
If Not IsNothing(Map.refAssemblyPageVM.CurrAssembly) AndAlso Map.refPartPageVM.CurrPart.TypePart.Contains("DO_") Then
Return Map.refAssemblyPageVM.CurrAssembly.Dimension
Else
Return m_IsReadOnly
End If
End Get
End Property
Private m_Image As String
Public Property Image As String
Get
Return m_Image
End Get
Set(value As String)
m_Image = value
End Set
End Property
' definizione comando
Private m_EnterRefreshCmd As ICommand
Private m_F1GuideCmd As ICommand
Private m_cmdOrderBtn As ICommand
#Region "COMMANDS"
Public ReadOnly Property RefreshCmd As ICommand
Get
If m_EnterRefreshCmd Is Nothing Then
m_EnterRefreshCmd = New Command(AddressOf EnterRefresh)
End If
Return m_EnterRefreshCmd
End Get
End Property
Public Sub EnterRefresh()
Map.refSceneManagerVM.RefreshBtn()
End Sub
' Comando Guida
Public ReadOnly Property GuideCmd 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
If String.IsNullOrEmpty(GuideVM.m_AddressGuide) Then
GuideVM.m_AddressGuide = GUIDE_FILE
End If
Map.refProjectManagerVM.Guide()
End Sub
Public ReadOnly Property OrderCmd As ICommand
Get
If m_cmdOrderBtn Is Nothing Then
m_cmdOrderBtn = New Command(AddressOf Map.refAssemblyPageVM.ShowOrder)
End If
Return m_cmdOrderBtn
End Get
End Property
#End Region ' Command
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 DoorVisibilityConverter
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 DoorList As ObservableCollection(Of String) = DirectCast(value, ObservableCollection(Of String))
Return If(DoorList.Count = 0, Visibility.Collapsed, Visibility.Visible)
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