Files
EgtCAM5/SpecialPanel/SpecialPanelVM.vb
T
Emmanuele Sassi 05c315ac94 EgtCAM5 :
- correzioni e miglioramenti Editor delle lavorazioni travi.
2019-07-24 08:39:49 +00:00

102 lines
3.3 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
' verifico se ci sono i file ini
Dim TypeIni_FilePath As String = IniFile.m_sMachinesRoot & "\" & IniFile.m_sMachineName & "\" & "Beam" & "\MachiningTypes.ini"
Dim BeamTableTemplate_FilePath As String = IniFile.m_sMachinesRoot & "\" & IniFile.m_sMachineName & "\" & "Beam" & "\" & BeamMachiningsWindowVM.BEAMTABLETEMPLATE_FILE
If File.Exists(TypeIni_FilePath) AndAlso File.Exists(BeamTableTemplate_FilePath) Then
' apro finestra di gestione lavorazioni travi
Dim BeamMachiningsWindowV As New BeamMachiningsWindowV(Application.Current.MainWindow, New BeamMachiningsWindowVM)
BeamMachiningsWindowV.ShowDialog()
Else
MessageBox.Show(EgtMsg(9009), EgtMsg(9008), MessageBoxButton.OK, MessageBoxImage.Stop)
End If
Return
End If
If Not File.Exists(m_sLuaCmdPath) Then Return
If Not Path.GetExtension(m_sLuaCmdPath).ToLower = ".lua" Then Return
' eseguo file Lua
Application.Msn.NotifyColleagues(Application.PREEXECSCRIPT, False)
Application.Msn.NotifyColleagues(Application.EXECSCRIPT, m_sLuaCmdPath)
End Sub
#End Region ' LuaExecCommand
#End Region ' Commands
End Class