Imports System.Windows Imports EgtUILib Imports EgtWPFLib5 Public Class SectionXMaterial Inherits VMBase Private Shared m_nType As MachineType Public Shared Sub SetType(nType As MachineType) m_nType = nType End Sub Protected m_Material As List(Of String) Public ReadOnly Property sMaterial As List(Of String) Get Return m_Material End Get End Property Protected m_MaterialForSameSection_List As New List(Of String) Public Property MaterialForSameSection_List As List(Of String) Get Return m_MaterialForSameSection_List End Get Set(value As List(Of String)) m_MaterialForSameSection_List = value End Set End Property Protected m_SelMaterialForSameSection As String Public Property SelMaterialForSameSection As String Get Return m_SelMaterialForSameSection End Get Set(value As String) m_SelMaterialForSameSection = value End Set End Property Protected m_dW As Double = 0 Public ReadOnly Property dW As Double Get Return m_dW End Get End Property Protected m_dH As Double = 0 Public ReadOnly Property dH As Double Get Return m_dH End Get End Property Protected m_dL As Double = 0 Public ReadOnly Property dL As Double Get Return m_dL End Get End Property Public ReadOnly Property sSectionXMaterial As String Get Dim sAlias As String = String.Empty For Each sMatItem In sMaterial sAlias &= sMatItem & ";" Next sAlias = sAlias.TrimEnd(";") If Me = Empty Then Return "" ElseIf m_nType = MachineType.BEAM Then Return LenToString(m_dW, 3) & " x " & LenToString(m_dH, 3) & " " & sAlias ElseIf m_nType = MachineType.WALL Then Return LenToString(m_dH, 3) & " " & sAlias Else Return "" End If End Get End Property Shared Operator =(ByVal S1 As SectionXMaterial, ByVal S2 As SectionXMaterial) As Boolean Return (S1.m_dH = S2.m_dH AndAlso S1.m_dW = S2.m_dW AndAlso S1.m_dL = S2.m_dL AndAlso S1.m_Material.Any(Function(x) S2.m_Material.Any(Function(y) y = x))) End Operator Shared Operator <>(ByVal S1 As SectionXMaterial, ByVal S2 As SectionXMaterial) As Boolean Return (S1.m_dH <> S2.m_dH OrElse S1.m_dW <> S2.m_dW OrElse S1.m_dL <> S2.m_dL) OrElse Not S1.m_Material.Any(Function(x) S2.m_Material.Any(Function(y) y = x)) End Operator Public Overrides Function Equals(ByVal obj As Object) As Boolean If TypeOf obj Is SectionXMaterial Then Return (m_dH = obj.dH AndAlso m_dW = obj.dW AndAlso m_dL = obj.dL AndAlso m_Material.Any(Function(x) DirectCast(obj.sMaterial, List(Of String)).Any(Function(y) y = x))) End If Return False End Function Sub New(dW As Double, dH As Double, dL As Double, sMaterial As String) If m_nType = MachineType.BEAM Then m_dW = dW m_dH = dH ElseIf m_nType = MachineType.WALL Then m_dH = dH Else m_dW = dW m_dH = dH m_dL = dL End If m_Material = New List(Of String) Dim sMaterialArray() As String = Split(sMaterial, ";") For Each sMatItem In sMaterialArray m_Material.Add(sMatItem) Next End Sub Public Shared Empty As New SectionXMaterial(-1, -1, -1, "") #Region "Import BTL <-> Warehouse" Private m_dNewW As Double Public Property dNewW As Double Get Return m_dNewW End Get Set(value As Double) m_dNewW = value End Set End Property Private m_dNewL As Double Public Property dNewL As Double Get Return m_dNewL End Get Set(value As Double) m_dNewL = value End Set End Property Private m_Alias_IsEnabled As Boolean Public Property Alias_IsEnabled As Boolean Get Return m_Alias_IsEnabled End Get Set(value As Boolean) m_Alias_IsEnabled = value End Set End Property Private m_Alias_IsChecked As Boolean Public Property Alias_IsChecked As Boolean Get Return m_Alias_IsChecked End Get Set(value As Boolean) m_Alias_IsChecked = value If value Then NewBeam_Visibility = Visibility.Collapsed NewWall_Visibility = Visibility.Collapsed Alias_Visibility = Visibility.Visible Else If m_nType = MachineType.BEAM Then NewBeam_Visibility = Visibility.Visible NewWall_Visibility = Visibility.Collapsed Else NewBeam_Visibility = Visibility.Collapsed NewWall_Visibility = Visibility.Visible End If Alias_Visibility = Visibility.Collapsed End If End Set End Property Private m_NewBeam_Visibility As Visibility Public Property NewBeam_Visibility As Visibility Get Return m_NewBeam_Visibility End Get Set(value As Visibility) If value <> m_NewBeam_Visibility Then m_NewBeam_Visibility = value NotifyPropertyChanged("NewBeam_Visibility") End If End Set End Property Private m_NewWall_Visibility As Visibility Public Property NewWall_Visibility As Visibility Get Return m_NewWall_Visibility End Get Set(value As Visibility) If value <> m_NewWall_Visibility Then m_NewWall_Visibility = value NotifyPropertyChanged("NewWall_Visibility") End If End Set End Property Private m_Alias_Visibility As Visibility Public Property Alias_Visibility As Visibility Get Return m_Alias_Visibility End Get Set(value As Visibility) If value <> m_Alias_Visibility Then m_Alias_Visibility = value NotifyPropertyChanged("Alias_Visibility") End If End Set End Property Public ReadOnly Property L_Msg As String Get Return EgtMsg(61604) End Get End Property Public ReadOnly Property W_Msg As String Get Return EgtMsg(61605) End Get End Property Public ReadOnly Property H_Msg As String Get Return EgtMsg(61606) End Get End Property #End Region ' Import BTL <-> Warehouse End Class