fb28e49222
- immagini per bottoni speciali con path completa oppure solo nome se da Resources - gestione disabilitazione bottoni Avanti/Indietro di Preview utensili in lavorazione.
92 lines
2.5 KiB
VB.net
92 lines
2.5 KiB
VB.net
Imports System.IO
|
|
Imports EgtUILib
|
|
|
|
Namespace EgtCAM5
|
|
|
|
Public Class SpecialPanelViewModel
|
|
|
|
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
|
|
|
|
End Namespace
|
|
|
|
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
|
|
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 |