177 lines
4.3 KiB
VB.net
177 lines
4.3 KiB
VB.net
Imports EgtUILib.EgtInterface
|
|
Imports System.Windows.Forms.AxHost
|
|
Imports EgtWPFLib5
|
|
|
|
Public Class SceneButtonVM
|
|
|
|
Private m_TopListBtn As New List(Of ScenaBtn)
|
|
Public Property TopListBtn As List(Of ScenaBtn)
|
|
Get
|
|
Return m_TopListBtn
|
|
End Get
|
|
Set(value As List(Of ScenaBtn))
|
|
m_TopListBtn = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_LeftListBtn As New List(Of ScenaBtn)
|
|
Public Property LeftListBtn As List(Of ScenaBtn)
|
|
Get
|
|
Return m_LeftListBtn
|
|
End Get
|
|
Set(value As List(Of ScenaBtn))
|
|
m_LeftListBtn = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_RightListBtn As New List(Of ScenaBtn)
|
|
Public Property RightListBtn As List(Of ScenaBtn)
|
|
Get
|
|
Return m_RightListBtn
|
|
End Get
|
|
Set(value As List(Of ScenaBtn))
|
|
m_RightListBtn = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_BottomListBtn As New List(Of ScenaBtn)
|
|
Public Property BottomListBtn As List(Of ScenaBtn)
|
|
Get
|
|
Return m_BottomListBtn
|
|
End Get
|
|
Set(value As List(Of ScenaBtn))
|
|
m_BottomListBtn = value
|
|
End Set
|
|
End Property
|
|
|
|
Sub New()
|
|
SetButtonsLocation("TopListBtn", m_TopListBtn)
|
|
SetButtonsLocation("LeftListBtn", m_LeftListBtn)
|
|
SetButtonsLocation("RightListBtn", m_RightListBtn)
|
|
SetButtonsLocation("BottomListBtn", m_BottomListBtn)
|
|
End Sub
|
|
|
|
Private Sub SetButtonsLocation(PositionList As String, ListBtn As List(Of ScenaBtn))
|
|
Dim Index As Integer = 1
|
|
Dim sBtnString As String = String.Empty
|
|
While GetMainPrivateProfileString(PositionList, "Btn_" & Index.ToString, "", sBtnString) > 0
|
|
Dim sItems As String() = Split(sBtnString, ",")
|
|
If sItems.Count < 3 Then
|
|
' Errore di configurazione comando: mancano dei parametri
|
|
'...
|
|
Else
|
|
Dim nType As Integer = 0
|
|
If sItems(0) = "Button" Then
|
|
' Button
|
|
ListBtn.Add(New _Button(sItems(1), sItems(2), sItems(3)))
|
|
ElseIf sItems(0) = "ToggleButton" Then
|
|
' ToggelButton
|
|
ListBtn.Add(New _ToggleButton(sItems(1), sItems(2), sItems(3)))
|
|
End If
|
|
End If
|
|
Index = Index + 1
|
|
sBtnString = String.Empty
|
|
End While
|
|
End Sub
|
|
|
|
End Class
|
|
|
|
Public Class ScenaBtn
|
|
|
|
Private m_Name As String
|
|
Public Property Name As String
|
|
Get
|
|
Return m_Name
|
|
End Get
|
|
Set(value As String)
|
|
m_Name = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_Img As String
|
|
Public Property Img As String
|
|
Get
|
|
Return m_Img
|
|
End Get
|
|
Set(value As String)
|
|
m_Img = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_Flag As String
|
|
Public Property Flag As String
|
|
Get
|
|
Return m_Flag
|
|
End Get
|
|
Set(value As String)
|
|
m_Flag = value
|
|
End Set
|
|
End Property
|
|
|
|
Sub New(_Name As String, _Img As String, _Flag As String)
|
|
m_Name = _Name
|
|
m_Img = _Img
|
|
m_Flag = _Flag
|
|
End Sub
|
|
|
|
Private m_CmdBtn As ICommand
|
|
Public ReadOnly Property CmdBtn As ICommand
|
|
Get
|
|
If m_CmdBtn Is Nothing Then
|
|
m_CmdBtn = New Command(AddressOf MethodBtn)
|
|
End If
|
|
Return m_CmdBtn
|
|
End Get
|
|
End Property
|
|
|
|
Private Sub MethodBtn()
|
|
SceneCmd.Exec(m_Name)
|
|
End Sub
|
|
|
|
End Class
|
|
|
|
Public Class _Button
|
|
Inherits ScenaBtn
|
|
|
|
Sub New(_Name As String, _Img As String, _Flag As String)
|
|
MyBase.New(_Name, _Img, _Flag)
|
|
End Sub
|
|
|
|
End Class
|
|
|
|
Public Class _ToggleButton
|
|
Inherits ScenaBtn
|
|
|
|
Private m_IsChecked As Boolean
|
|
Public Property IsChecked As Boolean
|
|
Get
|
|
Return m_IsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_IsChecked = value
|
|
End Set
|
|
End Property
|
|
|
|
|
|
Sub New(_Name As String, _Img As String, _Flag As String)
|
|
MyBase.New(_Name, _Img, _Flag)
|
|
End Sub
|
|
|
|
End Class
|
|
|
|
Module SceneCmd
|
|
Public Sub Exec(Flag)
|
|
Dim _SceneHostVM As SceneHostVM = DirectCast(Map.refSceneHostV.DataContext, SceneHostVM)
|
|
Dim nVeinCtx As Integer = _SceneHostVM.MainScene.GetCtx()
|
|
Select Case Flag
|
|
Case "Pair"
|
|
EgtSetCurrentContext(nVeinCtx)
|
|
|
|
EgtLuaSetGlobIntVar("ASS.nVeinCtx", nVeinCtx)
|
|
EgtLuaCallFunction("ASS.PairAll")
|
|
|
|
Case Else
|
|
Dim x As Boolean = False
|
|
End Select
|
|
End Sub
|
|
End Module |