369 lines
10 KiB
VB.net
369 lines
10 KiB
VB.net
Imports EgtUILib
|
|
|
|
Public Class CompoManagerVM
|
|
Inherits VMBase
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
Private Const LUA_CMP_VARS As String = "CMP"
|
|
|
|
Private m_TopIsChecked As Boolean
|
|
Public Property TopIsChecked As Boolean
|
|
Get
|
|
Return m_TopIsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_TopIsChecked = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_Top_Visibility As Visibility
|
|
Public Property Top_Visibility As Visibility
|
|
Get
|
|
Return m_Top_Visibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_Top_Visibility = value
|
|
NotifyPropertyChanged("Top_Visibility")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_PartName As String
|
|
Public Property PartName As String
|
|
Get
|
|
Return m_PartName
|
|
End Get
|
|
Set(value As String)
|
|
m_PartName = value
|
|
NotifyPropertyChanged("PartName")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_PartName_Visibility As Visibility
|
|
Public Property PartName_Visibility As Visibility
|
|
Get
|
|
Return m_PartName_Visibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_PartName_Visibility = value
|
|
NotifyPropertyChanged("PartName_Visibility")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_PartNum As String
|
|
Public Property PartNum As String
|
|
Get
|
|
Return m_PartNum
|
|
End Get
|
|
Set(value As String)
|
|
m_PartNum = value
|
|
NotifyPropertyChanged("PartNum")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_PartNum_Visibility As Visibility
|
|
Public Property PartNum_Visibility As Visibility
|
|
Get
|
|
Return m_PartNum_Visibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_PartNum_Visibility = value
|
|
NotifyPropertyChanged("PartNum_Visibility")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_OkIsEnabled As Boolean
|
|
Public Property OkIsEnabled As Boolean
|
|
Get
|
|
Return m_OkIsEnabled
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_OkIsEnabled = value
|
|
NotifyPropertyChanged("OkIsEnabled")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_OkExit_Visibility As Visibility
|
|
Public Property OkExit_Visibility As Visibility
|
|
Get
|
|
Return m_OkExit_Visibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_OkExit_Visibility = value
|
|
NotifyPropertyChanged("OkExit_Visibility")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_TrfData_Visibility As Visibility
|
|
Public Property TrfData_Visibility As Visibility
|
|
Get
|
|
Return m_TrfData_Visibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_TrfData_Visibility = value
|
|
NotifyPropertyChanged("TrfData_Visibility")
|
|
End Set
|
|
End Property
|
|
|
|
' Trf Data
|
|
Private m_sTrfOrderCode As String = ""
|
|
Public ReadOnly Property sTrfOrderCode As String
|
|
Get
|
|
Return m_sTrfOrderCode
|
|
End Get
|
|
End Property
|
|
Private m_sTrfOrderDesc As String = ""
|
|
Public ReadOnly Property sTrfOrderDesc As String
|
|
Get
|
|
Return m_sTrfOrderDesc
|
|
End Get
|
|
End Property
|
|
Private m_sTrfPartCode As String = ""
|
|
Public ReadOnly Property sTrfPartCode As String
|
|
Get
|
|
Return m_sTrfPartCode
|
|
End Get
|
|
End Property
|
|
Private m_sTrfMatCode As String = ""
|
|
Public ReadOnly Property sTrfMatCode As String
|
|
Get
|
|
Return m_sTrfMatCode
|
|
End Get
|
|
End Property
|
|
Private m_sTrfSurfCode As String = ""
|
|
Public ReadOnly Property sTrfSurfCode As String
|
|
Get
|
|
Return m_sTrfSurfCode
|
|
End Get
|
|
End Property
|
|
Private m_dTrfThickness As Double = 0
|
|
Public ReadOnly Property dTrfThickness As Double
|
|
Get
|
|
Return m_dTrfThickness
|
|
End Get
|
|
End Property
|
|
|
|
Private m_CsvData_Visibility As Visibility
|
|
Public Property CsvData_Visibility As Visibility
|
|
Get
|
|
Return m_CsvData_Visibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_CsvData_Visibility = value
|
|
NotifyPropertyChanged("CsvData_Visibility")
|
|
End Set
|
|
End Property
|
|
|
|
' Csv Data
|
|
Private m_sCsvOrder As String = ""
|
|
Public ReadOnly Property sCsvOrder As String
|
|
Get
|
|
Return m_sCsvOrder
|
|
End Get
|
|
End Property
|
|
Private m_sCsvList As String = ""
|
|
Public ReadOnly Property sCsvList As String
|
|
Get
|
|
Return m_sCsvList
|
|
End Get
|
|
End Property
|
|
Private m_sCsvName As String = ""
|
|
Public ReadOnly Property sCsvName As String
|
|
Get
|
|
Return m_sCsvName
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Messages"
|
|
|
|
Public ReadOnly Property TopMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_DRAWPAGEUC + 4)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property PartNameMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_DRAWPAGEUC + 8)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property TrfDataMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_DRAWPAGEUC + 9)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property CsvDataMsg As String
|
|
Get
|
|
Return EgtMsg( 90398) 'Dati Csv
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property PartNumMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_DRAWPAGEUC + 1)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property OkMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_GENERIC + 1)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property ExitMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_GENERIC + 2)
|
|
End Get
|
|
End Property
|
|
|
|
#End Region ' Messages
|
|
|
|
' definizione comandi
|
|
Private m_cmdOk As ICommand
|
|
Private m_cmdTrfData As ICommand
|
|
Private m_cmdCsvData As ICommand
|
|
|
|
#End Region ' FIELDS & PROPERTIES
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New()
|
|
' Creo riferimento a questa classe in CompoWindowMap
|
|
CompoWindowMap.SetRefCompoManagerVM(Me)
|
|
End Sub
|
|
|
|
#End Region ' CONSTRUCTOR
|
|
|
|
#Region "METHODS"
|
|
|
|
Friend Sub InitCompoManager()
|
|
If IsNothing(CompoWindowMap.refCompoWindowVM.m_SelInternalCompo) Then
|
|
PartName_Visibility = Visibility.Visible
|
|
PartNum_Visibility = Visibility.Visible
|
|
OkExit_Visibility = Visibility.Visible
|
|
Top_Visibility = Visibility.Visible
|
|
Else
|
|
Top_Visibility = Visibility.Collapsed
|
|
PartName_Visibility = Visibility.Collapsed
|
|
PartNum_Visibility = Visibility.Collapsed
|
|
OkExit_Visibility = Visibility.Collapsed
|
|
End If
|
|
' assegno valori di default numero e nome pezzi
|
|
PartNum = 1.ToString
|
|
PartName = String.Empty
|
|
' Reset dati TRF
|
|
m_sTrfOrderCode = ""
|
|
m_sTrfOrderDesc = ""
|
|
m_sTrfPartCode = ""
|
|
m_sTrfMatCode = ""
|
|
m_sTrfSurfCode = ""
|
|
m_dTrfThickness = 0
|
|
' Reset dati Csv
|
|
m_sCsvOrder = ""
|
|
m_sCsvList = ""
|
|
m_sCsvName = ""
|
|
|
|
If CompoWindowMap.refCompoWindowVM.bTrfData Then
|
|
TrfData_Visibility = Windows.Visibility.Visible
|
|
CsvData_Visibility = Windows.Visibility.Collapsed
|
|
PartName_Visibility = Windows.Visibility.Collapsed
|
|
ElseIf CompoWindowMap.refCompoWindowVM.bCsvData Then
|
|
CsvData_Visibility = Windows.Visibility.Visible
|
|
TrfData_Visibility = Windows.Visibility.Collapsed
|
|
PartName_Visibility = Windows.Visibility.Collapsed
|
|
Else
|
|
PartName_Visibility = Windows.Visibility.Visible
|
|
TrfData_Visibility = Windows.Visibility.Collapsed
|
|
CsvData_Visibility = Windows.Visibility.Collapsed
|
|
End If
|
|
|
|
End Sub
|
|
|
|
#End Region ' METHODS
|
|
|
|
#Region "COMMANDS"
|
|
|
|
#Region "OkCommand"
|
|
|
|
Public ReadOnly Property OkCommand() As ICommand
|
|
Get
|
|
If m_cmdOk Is Nothing Then
|
|
m_cmdOk = New Command(AddressOf Ok)
|
|
End If
|
|
Return m_cmdOk
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub Ok(ByVal param As Object)
|
|
' se errore esco
|
|
If Not CompoWindowMap.refCompoWindowVM.m_bDrawOk Then
|
|
Return
|
|
End If
|
|
' Leggo numero di pezzi da inserire
|
|
Dim InsNbr As Integer
|
|
StringToInt(m_PartNum, InsNbr)
|
|
' Verifico se ci sono componenti interni
|
|
Dim bHasIntCompo As Boolean = False
|
|
EgtSetCurrentContext(CompoWindowMap.refCompoSceneHostV.CompoScene.GetCtx())
|
|
If EgtGetFirstNameInGroup(EgtGetFirstGroupInGroup(GDB_ID.ROOT), "InLoop") <> GDB_ID.NULL Then
|
|
bHasIntCompo = True
|
|
End If
|
|
' Passo al contesto principale
|
|
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
|
|
' Inserisco il componente nel DB geometrico principale
|
|
'CompoWindowMap.refCompoWindowVM.MakeInsert(InsNbr, m_PartName)
|
|
CompoWindowMap.refCompoWindowVM.MakeMultipleInsert(InsNbr, m_PartName)
|
|
' Aggiorno ambiente principale
|
|
EgtZoom(ZM.ALL)
|
|
' Elimino riferimento con delegato
|
|
CompoParamItem.m_refUpdateView = Nothing
|
|
' Chiudo la finestra Compo
|
|
CompoWindowMap.refCompoWindowVM.Close(True)
|
|
End Sub
|
|
|
|
#End Region ' OkCommand
|
|
|
|
#Region "TrfDataCommand"
|
|
|
|
Public ReadOnly Property TrfData_Command() As ICommand
|
|
Get
|
|
If m_cmdTrfData Is Nothing Then
|
|
m_cmdTrfData = New Command(AddressOf TrfData)
|
|
End If
|
|
Return m_cmdTrfData
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub TrfData(ByVal param As Object)
|
|
Dim DlgTrfDataVM As New CompoTrfDataWindowVM()
|
|
Dim DlgTrfDataV As New CompoTrfDataWindowV(Application.Current.MainWindow, DlgTrfDataVM)
|
|
DlgTrfDataVM.SetData(m_sTrfOrderCode, m_sTrfOrderDesc, m_sTrfPartCode, m_sTrfMatCode, m_sTrfSurfCode, m_dTrfThickness)
|
|
If DlgTrfDataV.ShowDialog() Then
|
|
DlgTrfDataVM.GetData(m_sTrfOrderCode, m_sTrfOrderDesc, m_sTrfPartCode, m_sTrfMatCode, m_sTrfSurfCode, m_dTrfThickness)
|
|
End If
|
|
End Sub
|
|
|
|
#End Region ' TrfDataCommand
|
|
|
|
#Region "CsvDataCommand"
|
|
|
|
Public ReadOnly Property CsvData_Command() As ICommand
|
|
Get
|
|
If m_cmdCsvData Is Nothing Then
|
|
m_cmdCsvData = New Command(AddressOf CsvData)
|
|
End If
|
|
Return m_cmdCsvData
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub CsvData(ByVal param As Object)
|
|
Dim DlgCsvDataVM As New CompoCsvDataWindowVM()
|
|
Dim DlgCsvDataV As New CompoCsvDataWindowV(Application.Current.MainWindow, DlgCsvDataVM)
|
|
DlgCsvDataVM.SetData(m_sCsvOrder, m_sCsvList, m_sCsvName)
|
|
If DlgCsvDataV.ShowDialog() Then
|
|
DlgCsvDataVM.GetData(m_sCsvOrder, m_sCsvList, m_sCsvName)
|
|
End If
|
|
End Sub
|
|
|
|
#End Region ' CsvDataCommand
|
|
|
|
#End Region ' COMMANDS
|
|
|
|
End Class
|