This commit is contained in:
Daniele Bariletti
2024-12-31 12:02:58 +01:00
6 changed files with 156 additions and 60 deletions
+68 -18
View File
@@ -1,4 +1,5 @@
Imports EgtUILib.EgtInterface
Imports EgtUILib.EgtInterface
Imports System.Windows.Forms.AxHost
Imports EgtWPFLib5
Public Class SceneButtonVM
@@ -44,10 +45,30 @@ Public Class SceneButtonVM
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("LeftListBtn", "Btn_" & Index.ToString, "", sBtnString) > 0
m_TopListBtn.Add(New ScenaBtn(0, "Btn 1", "Img 1"))
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
@@ -57,16 +78,6 @@ End Class
Public Class ScenaBtn
Private m_Type As Integer
Public Property Type As Integer
Get
Return m_Type
End Get
Set(value As Integer)
m_Type = value
End Set
End Property
Private m_Name As String
Public Property Name As String
Get
@@ -87,10 +98,20 @@ Public Class ScenaBtn
End Set
End Property
Sub New(_Type As Integer, _Name As String, _Img As String)
m_Type = _Type
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
@@ -109,12 +130,41 @@ Public Class ScenaBtn
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(Name)
Public Sub Exec(Flag)
Dim _SceneHostVM As SceneHostVM = DirectCast(Map.refSceneHostV.DataContext, SceneHostVM)
Dim nVeinCtx As Integer = _SceneHostVM.MainScene.GetCtx()
Select Case Name
Case "Btn 1"
Select Case Flag
Case "Pair"
EgtSetCurrentContext(nVeinCtx)
EgtLuaSetGlobIntVar("ASS.nVeinCtx", nVeinCtx)