-piccola correzione parametriccompo
This commit is contained in:
@@ -6,22 +6,17 @@ Imports EgtWPFLib5
|
||||
Public Class ParametricCompoVM
|
||||
Inherits SceneUserControlVM
|
||||
|
||||
Public Enum ParamType As Integer
|
||||
BOOL = 1
|
||||
INT = 2
|
||||
LEN = 3
|
||||
DOUB = 4
|
||||
STR = 5
|
||||
End Enum
|
||||
|
||||
Private Const LUA_CMP_VARS As String = "CMP"
|
||||
Friend Const LUA_VALUE As String = LUA_CMP_VARS & ".V"
|
||||
Const LUA_NAME As String = LUA_CMP_VARS & ".N"
|
||||
Const LUA_TYPE As String = LUA_CMP_VARS & ".T"
|
||||
#Region "FIELDS & PROPERTIES"
|
||||
|
||||
Private sLuaPath As String = String.Empty
|
||||
|
||||
#End Region ' Fields & Properties
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New(sFile As String)
|
||||
MyBase.New()
|
||||
Title = EGT_PARAMETRIC.ToUpper()
|
||||
' Recupero path cartella che contiene i componenti
|
||||
GetMainPrivateProfileString(K_COMPO, COMPO_DIR, "", sLuaPath)
|
||||
sLuaPath &= sFile
|
||||
@@ -31,33 +26,30 @@ Public Class ParametricCompoVM
|
||||
EgtZoom(ZM.ALL)
|
||||
End Sub
|
||||
|
||||
#End Region ' Contructor
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Public Overrides Sub LoadParamList()
|
||||
' Pulisco lista variabili
|
||||
ParamList.Clear()
|
||||
EgtLuaExecFile(sLuaPath)
|
||||
Dim sPar As String = "0"
|
||||
EgtLuaGetGlobStringVar("CMP.Npar", sPar)
|
||||
Dim sName As String = String.Empty
|
||||
EgtLuaGetGlobStringVar("CMP.Nome", sName)
|
||||
Dim nPar As Integer = CInt(sPar)
|
||||
ParamList.Add(New _TextBlockParam("Messaggio", "RETTANGOLO", Visibility.Visible))
|
||||
'ParamList.Add(New _TextBoxParam("L", "300", Visibility.Visible))
|
||||
'ParamList.Add(New _TextBoxParam("H", "200", Visibility.Visible))
|
||||
' Pulisco lista variabili
|
||||
ParamList.Add(New _TextBlockParam("Messaggio", sName, Visibility.Visible))
|
||||
' Recupero nome, tipo e valore delle variabili globali
|
||||
For i As Integer = 1 To nPar
|
||||
For Index As Integer = 1 To nPar
|
||||
Dim NewCompo As GenericParam = Nothing
|
||||
If NameTypeValueFromLua(i, NewCompo) Then
|
||||
If NameTypeValueFromLua(Index, NewCompo) Then
|
||||
ParamList.Add(NewCompo)
|
||||
End If
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Private Sub ExecLua()
|
||||
'' recupero i valori nelle box
|
||||
'Dim l_TextBox As _TextBoxParam = DirectCast(ParamList(1), _TextBoxParam)
|
||||
'Dim h_TextBox As _TextBoxParam = DirectCast(ParamList(2), _TextBoxParam)
|
||||
'' verifico che siano validi
|
||||
'If String.IsNullOrEmpty(l_TextBox.sValue) Then l_TextBox.sValue = "0"
|
||||
'If String.IsNullOrEmpty(h_TextBox.sValue) Then h_TextBox.sValue = "0"
|
||||
|
||||
Dim nVeinCtx As Integer = Map.refSceneHostVM.MainScene.GetCtx()
|
||||
If Not File.Exists(sLuaPath) Then
|
||||
EgtOutLog("Matching error: missing file (" & sLuaPath & ")")
|
||||
@@ -80,17 +72,26 @@ Public Class ParametricCompoVM
|
||||
End Sub
|
||||
|
||||
Public Overrides Sub Conferma()
|
||||
Map.refSceneHostVM.m_bPreviewShown = False
|
||||
ExecLua()
|
||||
EgtDraw()
|
||||
Close()
|
||||
End Sub
|
||||
|
||||
Public Overrides Sub Annulla()
|
||||
EgtErase(EgtGetFirstPart())
|
||||
EgtDraw()
|
||||
Close()
|
||||
End Sub
|
||||
|
||||
Public Overrides Sub ShowPreview()
|
||||
Map.refSceneHostVM.m_bPreviewShown = True
|
||||
ExecLua()
|
||||
EgtDraw()
|
||||
End Sub
|
||||
|
||||
Private Sub Close()
|
||||
Map.refSceneButtonV.RemoveParametricCompoUC()
|
||||
End Sub
|
||||
|
||||
Private Function NameTypeValueFromLua(nInd As Integer, ByRef Param As GenericParam) As Boolean
|
||||
@@ -103,29 +104,31 @@ Public Class ParametricCompoVM
|
||||
End Function
|
||||
|
||||
Private Function FromLua(nInd As Integer, sName As String, nType As Integer, ByRef Param As GenericParam) As Boolean
|
||||
Dim sVal As String = String.Empty
|
||||
Dim dVal As Double = 0
|
||||
Dim nVal As Integer = 0
|
||||
Dim bOk As Boolean = False
|
||||
Select Case nType
|
||||
Case ParamType.BOOL
|
||||
Dim Compo As New _CheckBoxParam(sName, ParamType.BOOL)
|
||||
Param = Compo
|
||||
Return EgtLuaGetGlobBoolVar(LUA_VALUE & nInd.ToString(), Compo.IsChecked)
|
||||
bOk = EgtLuaGetGlobBoolVar(LUA_VALUE & nInd.ToString(), ParamType.BOOL)
|
||||
Param = New _CheckBoxParam(sName, sVal)
|
||||
Return bOk
|
||||
Case ParamType.INT
|
||||
Dim Compo As New _TextBoxParam(sName, ParamType.INT)
|
||||
Param = Compo
|
||||
Return EgtLuaGetGlobIntVar(LUA_VALUE & nInd.ToString(), Compo.sValue)
|
||||
Case ParamType.LEN
|
||||
Dim Compo As New _TextBoxParam(sName, ParamType.LEN)
|
||||
Param = Compo
|
||||
Return EgtLuaGetGlobNumVar(LUA_VALUE & nInd.ToString(), Compo.sValue)
|
||||
Case ParamType.DOUB
|
||||
Dim Compo As New _TextBoxParam(sName, ParamType.DOUB)
|
||||
Param = Compo
|
||||
Return EgtLuaGetGlobNumVar(LUA_VALUE & nInd.ToString(), Compo.sValue)
|
||||
bOk = EgtLuaGetGlobIntVar(LUA_VALUE & nInd.ToString(), nVal)
|
||||
Param = New _TextBoxParam(sName, nVal.ToString(), nType)
|
||||
Return bOk
|
||||
Case ParamType.LEN, ParamType.DOUB
|
||||
bOk = EgtLuaGetGlobNumVar(LUA_VALUE & nInd.ToString(), dVal)
|
||||
Param = New _TextBoxParam(sName, dVal.ToString(), nType)
|
||||
Return bOk
|
||||
Case ParamType.STR
|
||||
Dim Compo As New _TextBoxParam(sName, ParamType.STR)
|
||||
Param = Compo
|
||||
Return EgtLuaGetGlobStringVar(LUA_VALUE & nInd.ToString(), Compo.sValue)
|
||||
bOk = EgtLuaGetGlobStringVar(LUA_VALUE & nInd.ToString(), sVal)
|
||||
Param = New _TextBoxParam(sName, sVal, nType)
|
||||
Return bOk
|
||||
End Select
|
||||
Return False
|
||||
End Function
|
||||
|
||||
#End Region ' Methods
|
||||
|
||||
End Class
|
||||
@@ -15,6 +15,7 @@
|
||||
Public Const EGT_ALZ As String = "AddSplashTop"
|
||||
Public Const EGT_FRO As String = "AddWaterfall"
|
||||
Public Const EGT_PANEL As String = "AddPanel"
|
||||
Public Const EGT_PARAMETRIC As String = "Parametric Compo"
|
||||
|
||||
Public Const EGT_X As String = "X"
|
||||
Public Const EGT_Y As String = "Y"
|
||||
@@ -95,4 +96,18 @@
|
||||
SelectPart = 0
|
||||
InsertMovement = 1
|
||||
End Enum
|
||||
|
||||
' Constanti ParametricCompo
|
||||
Public Enum ParamType As Integer
|
||||
BOOL = 1
|
||||
INT = 2
|
||||
LEN = 3
|
||||
DOUB = 4
|
||||
STR = 5
|
||||
End Enum
|
||||
|
||||
Public Const LUA_CMP_VARS As String = "CMP"
|
||||
Public Const LUA_VALUE As String = LUA_CMP_VARS & ".V"
|
||||
Public Const LUA_NAME As String = LUA_CMP_VARS & ".N"
|
||||
Public Const LUA_TYPE As String = LUA_CMP_VARS & ".T"
|
||||
End Module
|
||||
|
||||
+2
-2
@@ -90,9 +90,9 @@ Public Class RotateVM
|
||||
#Region "METHODS"
|
||||
|
||||
Public Overrides Sub LoadParamList()
|
||||
AddGenericParam(New _TextBlockParam("Messaggio", MsgList(Stage)))
|
||||
AddGenericParam(New _TextBlockParam("Messaggio", MsgList(Stage), ParamType.STR))
|
||||
' Angolo
|
||||
AddGenericParam(New _TextBoxParam(EgtMsg(110006), 0, Visibility.Visible, False))
|
||||
AddGenericParam(New _TextBoxParam(EgtMsg(110006), 0, ParamType.DOUB, Visibility.Visible, False))
|
||||
End Sub
|
||||
|
||||
Public Sub AdvanceStage()
|
||||
|
||||
@@ -212,14 +212,33 @@ Public Class GenericParam
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_TypeValue As ParamType
|
||||
Public Property TypeValue As Integer
|
||||
Get
|
||||
Return m_TypeValue
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_TypeValue = value
|
||||
NotifyPropertyChanged(NameOf(TypeValue))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#End Region ' Fields & Properties
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New(sName As String, Optional Visibility As Visibility = Visibility.Visible, Optional bIsEnabled As Boolean = True)
|
||||
m_Name = sName
|
||||
nVisibility = Visibility
|
||||
IsEnabled = bIsEnabled
|
||||
m_TypeValue = ParamType.STR
|
||||
m_nVisibility = Visibility
|
||||
m_IsEnabled = bIsEnabled
|
||||
End Sub
|
||||
|
||||
Sub New(sName As String, TypeValue As Integer, Optional Visibility As Visibility = Visibility.Visible, Optional bIsEnabled As Boolean = True)
|
||||
m_Name = sName
|
||||
m_TypeValue = TypeValue
|
||||
m_nVisibility = Visibility
|
||||
m_IsEnabled = bIsEnabled
|
||||
End Sub
|
||||
|
||||
#End Region ' Constructor
|
||||
@@ -249,8 +268,8 @@ Public Class _TextBoxParam
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New(sName As String, sValue As String, Optional nVisibility As Visibility = Visibility.Visible, Optional bIsEnabled As Boolean = True)
|
||||
MyBase.New(sName, nVisibility, bIsEnabled)
|
||||
Sub New(sName As String, sValue As String, TypeValue As Integer, Optional nVisibility As Visibility = Visibility.Visible, Optional bIsEnabled As Boolean = True)
|
||||
MyBase.New(sName, TypeValue, nVisibility, bIsEnabled)
|
||||
m_sValue = sValue
|
||||
End Sub
|
||||
|
||||
@@ -289,8 +308,8 @@ Public Class _TextBlockParam
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New(sName As String, sValue As String, Optional nVisibility As Visibility = Visibility.Visible, Optional bIsEnabled As Boolean = True)
|
||||
MyBase.New(sName, nVisibility, bIsEnabled)
|
||||
Sub New(sName As String, sValue As String, TypeValue As Integer, Optional nVisibility As Visibility = Visibility.Visible, Optional bIsEnabled As Boolean = True)
|
||||
MyBase.New(sName, TypeValue, nVisibility, bIsEnabled)
|
||||
m_MsgValue = sValue
|
||||
End Sub
|
||||
|
||||
@@ -404,7 +423,7 @@ Public Class _CheckBoxParam
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New(sName As String, sValue As String, Optional nVisibility As Visibility = Visibility.Visible, Optional bIsEnabled As Boolean = True)
|
||||
MyBase.New(sName, nVisibility, bIsEnabled)
|
||||
MyBase.New(sName, ParamType.BOOL, nVisibility, bIsEnabled)
|
||||
m_MsgValue = sValue
|
||||
End Sub
|
||||
|
||||
|
||||
Reference in New Issue
Block a user