4c679fbd48
- Migliorato AboutBox. - Miglioramenti per compatibilità con nuova versione WPFLib5.
216 lines
6.0 KiB
VB.net
216 lines
6.0 KiB
VB.net
Imports EgtUILib
|
|
|
|
Public Class CompoManagerVM
|
|
Inherits VMBase
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
Private Const LUA_CMP_VARS As String = "CMP"
|
|
Friend Const LUA_CMP_WITHTOP As String = LUA_CMP_VARS & ".WithTop"
|
|
|
|
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
|
|
|
|
#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 "Nome"
|
|
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 "Ok"
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property ExitMsg As String
|
|
Get
|
|
Return "Exit"
|
|
End Get
|
|
End Property
|
|
|
|
#End Region ' Messages
|
|
|
|
' definizione comandi
|
|
Private m_cmdOk 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
|
|
' Verifico se il compo selezionato ha la segnalazione del Top abilitata
|
|
Dim bHasTop As Boolean = False
|
|
EgtLuaGetGlobBoolVar(LUA_CMP_WITHTOP, bHasTop)
|
|
Top_Visibility = If(bHasTop, Visibility.Visible, Visibility.Collapsed)
|
|
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
|
|
End Sub
|
|
|
|
#End Region ' METHODS
|
|
|
|
#Region "COMMANDS"
|
|
|
|
#Region "OkCommand"
|
|
|
|
' Returns a command that manage the MainWindow_Unloaded command
|
|
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
|
|
|
|
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
|
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
|
|
If bHasIntCompo Then
|
|
CompoWindowMap.refCompoWindowVM.MakeCompoInsert(InsNbr, m_PartName)
|
|
Else
|
|
CompoWindowMap.refCompoWindowVM.MakeInsert(InsNbr, m_PartName)
|
|
End If
|
|
' 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
|
|
|
|
#End Region ' COMMANDS
|
|
|
|
End Class
|