Files
EgtCAM5/SpecialPanel/SpecialPanelVM.vb
T
Renzo Lanza fe58578e65 EgtCAM5 :
- eliminati tutti gli Application.Msn.Register/NotifyColleagues e la classe Messenger. Ora tutto ciò che eseguivano è in funzioni/sub Friend chiamate tramite i riferimenti in Map.
2020-10-28 14:09:17 +00:00

97 lines
2.6 KiB
VB.net

Imports System.IO
Imports EgtUILib
Public Class SpecialPanelVM
Private m_ButtonList As New List(Of ButtonItem)
Public ReadOnly Property ButtonList As List(Of ButtonItem)
Get
Return m_ButtonList
End Get
End Property
Sub New()
' se attivo, inizializzo i bottoni leggendoli da file ini
If IniFile.IsActiveSpecialPanel Then
Dim BtnIndex As Integer = 1
Dim CurrBtn As ButtonItem = Nothing
While GetPrivateProfileButton(S_SPECIAL, K_BUTTON & BtnIndex, "", CurrBtn)
m_ButtonList.Add(CurrBtn)
BtnIndex += 1
End While
End If
End Sub
End Class
Public Class ButtonItem
Private m_sImagePath As String
Public ReadOnly Property ImagePath As String
Get
Return m_sImagePath
End Get
End Property
Private m_sLuaCmdPath As String
Private m_sToolTip As String
Public ReadOnly Property ToolTip As String
Get
Return m_sToolTip
End Get
End Property
' Definizione comandi
Private m_cmdLuaExec As ICommand
Sub New(sLuaCmdPath As String, sImagePath As String, sToolTip As String)
If File.Exists(sImagePath) Then
m_sImagePath = sImagePath
Else
m_sImagePath = IniFile.m_sResourcesRoot & "\" & sImagePath
End If
m_sLuaCmdPath = sLuaCmdPath
m_sToolTip = sToolTip
End Sub
#Region "COMMANDS"
#Region "LuaExecCommand"
''' <summary>
''' Returns a command that do New.
''' </summary>
Public ReadOnly Property LuaExecCommand As ICommand
Get
If m_cmdLuaExec Is Nothing Then
m_cmdLuaExec = New Command(AddressOf LuaExec)
End If
Return m_cmdLuaExec
End Get
End Property
''' <summary>
''' Execute the New. This method is invoked by the NewCommand.
''' </summary>
Public Sub LuaExec(ByVal param As Object)
If String.IsNullOrWhiteSpace(m_sLuaCmdPath) Then Return
' se trovo costante di apertura file lavorazioni travi
If m_sLuaCmdPath = BeamPanelVM.BEAM_MACHININGS Then
Beam.BeamMachDb()
Return
' se altrimenti per pareti
ElseIf m_sLuaCmdPath = WallPanelVM.WALL_MACHININGS Then
Wall.WallMachDb()
Return
End If
If Not File.Exists(m_sLuaCmdPath) Then Return
If Not Path.GetExtension(m_sLuaCmdPath).ToLower = ".lua" Then Return
' eseguo file Lua
Map.refProjectVM.PreExecScript(False)
Map.refProjectVM.ExecScript(m_sLuaCmdPath)
End Sub
#End Region ' LuaExecCommand
#End Region ' Commands
End Class