OmagCUT :
- correzioni e miglioramenti a pagine ControlsMachineButtonUC e VacuumMachineButtonUC.
This commit is contained in:
@@ -66,7 +66,7 @@ Public Class ControlsMachineButtonUC
|
||||
Dim ButtonToAdd As MachineButton = Nothing
|
||||
Select Case sMachineButtonType
|
||||
Case MachineButtonType.NOSTATE
|
||||
ButtonToAdd = New TwoStateButton(sTImageName, sTLuaScriptName, sFImageName, sFLuaScriptName, sStateFlag)
|
||||
ButtonToAdd = New NoStateButton(sTImageName, sTLuaScriptName, sFImageName, sFLuaScriptName, sStateFlag)
|
||||
Case MachineButtonType.TWOSTATE
|
||||
ButtonToAdd = New TwoStateButton(sTImageName, sTLuaScriptName, sFImageName, sFLuaScriptName, sStateFlag)
|
||||
Case MachineButtonType.THREESTATE
|
||||
@@ -91,7 +91,7 @@ Public Class ControlsMachineButtonUC
|
||||
End If
|
||||
Next
|
||||
If Not IsNothing(SpindleButton) Then
|
||||
SpindleButton.SetButtonIsChecked(SpindleState)
|
||||
SpindleButton.SetIsChecked(SpindleState)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -103,7 +103,7 @@ Public Class ControlsMachineButtonUC
|
||||
End If
|
||||
Next
|
||||
If Not IsNothing(LaserButton) Then
|
||||
LaserButton.SetButtonIsChecked(LaserState)
|
||||
LaserButton.SetIsChecked(LaserState)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -115,7 +115,7 @@ Public Class ControlsMachineButtonUC
|
||||
End If
|
||||
Next
|
||||
If Not IsNothing(CoolantButton) Then
|
||||
CoolantButton.SetButtonIsChecked(CoolantState)
|
||||
CoolantButton.SetIsChecked(CoolantState)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -127,7 +127,7 @@ Public Class ControlsMachineButtonUC
|
||||
End If
|
||||
Next
|
||||
If Not IsNothing(IntCoolantButton) Then
|
||||
IntCoolantButton.SetButtonIsChecked(InternalCoolantState)
|
||||
IntCoolantButton.SetIsChecked(InternalCoolantState)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -139,19 +139,25 @@ Public Class ControlsMachineButtonUC
|
||||
End If
|
||||
Next
|
||||
If Not IsNothing(ExtCoolantButton) Then
|
||||
ExtCoolantButton.SetButtonIsChecked(ExternCoolantState)
|
||||
ExtCoolantButton.SetIsChecked(ExternCoolantState)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Friend Sub CBAxesStateChanged(CBAxesState As Boolean)
|
||||
Dim CBAxesButton As TwoStateButton = Nothing
|
||||
Dim CAxesButton As TwoStateButton = Nothing
|
||||
Dim BAxesButton As TwoStateButton = Nothing
|
||||
For Each MachineButton In m_ButtonList
|
||||
If MachineButton.StateFlag = K_CBAXES Then
|
||||
CBAxesButton = MachineButton
|
||||
If MachineButton.StateFlag = K_CAXES Then
|
||||
CAxesButton = MachineButton
|
||||
ElseIf MachineButton.StateFlag = K_BAXES Then
|
||||
BAxesButton = MachineButton
|
||||
End If
|
||||
Next
|
||||
If Not IsNothing(CBAxesButton) Then
|
||||
CBAxesButton.SetButtonIsChecked(CBAxesState)
|
||||
If Not IsNothing(CAxesButton) Then
|
||||
CAxesButton.SetIsChecked(CBAxesState)
|
||||
End If
|
||||
If Not IsNothing(BAxesButton) Then
|
||||
BAxesButton.SetIsChecked(Not CBAxesState)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -163,7 +169,7 @@ Public Class ControlsMachineButtonUC
|
||||
End If
|
||||
Next
|
||||
If Not IsNothing(AirBlowButton) Then
|
||||
AirBlowButton.SetButtonIsChecked(AirBlowState)
|
||||
AirBlowButton.SetIsChecked(AirBlowState)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -175,7 +181,7 @@ Public Class ControlsMachineButtonUC
|
||||
End If
|
||||
Next
|
||||
If Not IsNothing(HomeButton) Then
|
||||
HomeButton.SetButtonIsChecked(HomeState)
|
||||
HomeButton.SetIsChecked(HomeState)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -240,44 +246,38 @@ Public Class ControlsMachineButtonUC
|
||||
Case 1
|
||||
DoorOpenedButton.Background = Application.Current.FindResource("OmagCut_Yellow")
|
||||
Case 2
|
||||
DoorOpenedButton.Background = Application.Current.FindResource("OmagCut_Red")
|
||||
DoorOpenedButton.Background = Application.Current.FindResource("OmagCut_Green")
|
||||
End Select
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Friend Sub LimitZChanged(LimitZState As Boolean)
|
||||
Dim LimitZButton As TwoStateButton = Nothing
|
||||
Dim LimitZButton As DoubleCommandButton = Nothing
|
||||
For Each MachineButton In m_ButtonList
|
||||
If MachineButton.StateFlag = K_LIMITZ Then
|
||||
LimitZButton = MachineButton
|
||||
End If
|
||||
Next
|
||||
If Not IsNothing(LimitZButton) Then
|
||||
LimitZButton.SetButtonIsChecked(LimitZState)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Friend Sub ThreeAxisStateChanged(ThreeAxisState As Boolean)
|
||||
Dim ThreeAxisButton As TwoStateButton = Nothing
|
||||
For Each MachineButton In m_ButtonList
|
||||
If MachineButton.StateFlag = K_LIMITZ Then
|
||||
ThreeAxisButton = MachineButton
|
||||
End If
|
||||
Next
|
||||
If Not IsNothing(ThreeAxisButton) Then
|
||||
ThreeAxisButton.SetButtonIsChecked(ThreeAxisState)
|
||||
LimitZButton.SetIsChecked(LimitZState)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Friend Sub FiveAxisStateChanged(FiveAxisState As Boolean)
|
||||
Dim FiveAxisButton As TwoStateButton = Nothing
|
||||
Dim ThreeAxesButton As TwoStateButton = Nothing
|
||||
Dim FiveAxesButton As TwoStateButton = Nothing
|
||||
For Each MachineButton In m_ButtonList
|
||||
If MachineButton.StateFlag = K_LIMITZ Then
|
||||
FiveAxisButton = MachineButton
|
||||
If MachineButton.StateFlag = K_THREEAXES Then
|
||||
ThreeAxesButton = MachineButton
|
||||
ElseIf MachineButton.StateFlag = K_FIVEAXES Then
|
||||
FiveAxesButton = MachineButton
|
||||
End If
|
||||
Next
|
||||
If Not IsNothing(FiveAxisButton) Then
|
||||
FiveAxisButton.SetButtonIsChecked(FiveAxisState)
|
||||
If Not IsNothing(ThreeAxesButton) Then
|
||||
ThreeAxesButton.SetIsChecked(Not FiveAxisState)
|
||||
End If
|
||||
If Not IsNothing(FiveAxesButton) Then
|
||||
FiveAxesButton.SetIsChecked(FiveAxisState)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -313,9 +313,6 @@ Public Class ControlsMachineButtonUC
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Private Sub ManualAxesMove_UnLoaded(sender As Object, e As RoutedEventArgs) Handles Me.Unloaded
|
||||
End Sub
|
||||
|
||||
Public Event PropertyChanged(sender As Object, e As PropertyChangedEventArgs) Implements INotifyPropertyChanged.PropertyChanged
|
||||
|
||||
Public Sub NotifyPropertyChanged(propName As String)
|
||||
@@ -405,12 +402,19 @@ Public MustInherit Class MachineButton
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
'Friend MustOverride Sub ExecuteCommand(bIsChecked As Boolean)
|
||||
|
||||
Friend Sub ExecuteMDICommand(sLuaFileName As String)
|
||||
If String.IsNullOrWhiteSpace(sLuaFileName) Then Return
|
||||
Dim CmdString As String = String.Empty
|
||||
Dim b2Start As Boolean = False
|
||||
ExecuteDirectCmdLua(sLuaFileName, CmdString, b2Start)
|
||||
Dim EActive As Boolean = False
|
||||
Dim ENumber As String = String.Empty
|
||||
Dim EValue As String = String.Empty
|
||||
ExecuteDirectCmdLua(sLuaFileName, CmdString, b2Start, EActive, ENumber, EValue)
|
||||
' se attiva variabile E, la scrivo ed esco
|
||||
If EActive Then
|
||||
m_CN.DVariables_WriteVariables2(ENumber, EValue)
|
||||
Return
|
||||
End If
|
||||
Dim nResult As Short
|
||||
Select Case m_MainWindow.m_CNCommunication.m_nNCType
|
||||
Case 1, 2
|
||||
@@ -436,7 +440,7 @@ Public MustInherit Class MachineButton
|
||||
nResult = m_CN.DGeneralFunctions_WriteCncMode(7) ' Modalità manuale
|
||||
End Sub
|
||||
|
||||
Friend Sub ExecuteDirectCmdLua(LuaFileName As String, ByRef CmdString As String, ByRef b2Start As Boolean)
|
||||
Friend Sub ExecuteDirectCmdLua(LuaFileName As String, ByRef CmdString As String, ByRef b2Start As Boolean, ByRef EActive As Boolean, ByRef ENumber As String, ByRef EValue As String)
|
||||
Dim sBaseDir As String = m_MainWindow.m_CurrentMachine.sMachDir & "\DirectCmd\"
|
||||
EgtLuaExecFile(sBaseDir & LuaFileName)
|
||||
Dim dFeed As Double = 0
|
||||
@@ -469,11 +473,17 @@ Public MustInherit Class MachineButton
|
||||
EgtLuaGetGlobStringVar("CMD.CMDSTRING", CmdString)
|
||||
b2Start = False
|
||||
EgtLuaGetGlobBoolVar("CMD.DOUBLESTART", b2Start)
|
||||
EActive = False
|
||||
EgtLuaGetGlobBoolVar("CMD.EACTIVE", EActive)
|
||||
ENumber = String.Empty
|
||||
EgtLuaGetGlobStringVar("CMD.ENUMBER", ENumber)
|
||||
EValue = String.Empty
|
||||
EgtLuaGetGlobStringVar("CMD.EVALUE", EValue)
|
||||
' Reset lua
|
||||
EgtLuaResetGlobVar("CmdString")
|
||||
EgtLuaResetGlobVar("CMD")
|
||||
' Log del comando
|
||||
EgtOutLog("CmdString=" & CmdString & " b2Start=" & b2Start.ToString())
|
||||
EgtOutLog("CmdString=" & CmdString & " b2Start=" & b2Start.ToString() & " EActive=" & EActive & " ENumber=" & ENumber & " EValue=" & EValue)
|
||||
End Sub
|
||||
|
||||
#End Region ' METHODS
|
||||
@@ -489,34 +499,35 @@ End Class
|
||||
Public Class TwoStateButton
|
||||
Inherits MachineButton
|
||||
|
||||
Private m_Button_IsChecked As Boolean
|
||||
Public Property Button_IsChecked As Boolean
|
||||
Private m_IsChecked As Boolean
|
||||
Public Property IsChecked As Boolean
|
||||
Get
|
||||
Return m_Button_IsChecked
|
||||
Return m_IsChecked
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_Button_IsChecked = value
|
||||
m_IsChecked = value
|
||||
If value Then
|
||||
|
||||
ExecuteMDICommand(TLuaScriptName)
|
||||
Else
|
||||
ExecuteMDICommand(FLuaScriptName)
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
Friend Sub SetButtonIsChecked(value As Boolean)
|
||||
m_Button_IsChecked = value
|
||||
NotifyPropertyChanged("Button_IsChecked")
|
||||
Friend Sub SetIsChecked(value As Boolean)
|
||||
m_IsChecked = value
|
||||
NotifyPropertyChanged("IsChecked")
|
||||
NotifyPropertyChanged("ImageSource")
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property ImageSource As String
|
||||
Get
|
||||
' Se variabile di stato "Nothing" o non collegato a CN, imposto immagine fissa
|
||||
If StateFlag = BTN_STATE_NOTHING Or Not m_MainWindow.m_bNCLink Then
|
||||
If StateFlag = BTN_STATE_NOTHING Or Not m_MainWindow.m_bNCLink Or IsNothing(FImageName) Or String.IsNullOrWhiteSpace(FImageName) Then
|
||||
' ritorno immagine dello stato true
|
||||
Return m_MainWindow.GetResourcesDir() & "\MachineButtonsImage\" & TImageName
|
||||
End If
|
||||
If m_Button_IsChecked Then
|
||||
If m_IsChecked Then
|
||||
' ritorno immagine dello stato true
|
||||
Return m_MainWindow.GetResourcesDir() & "\MachineButtonsImage\" & TImageName
|
||||
Else
|
||||
@@ -539,6 +550,9 @@ End Class
|
||||
Public Class NoStateButton
|
||||
Inherits MachineButton
|
||||
|
||||
' definizione comandi
|
||||
Private m_cmdExecute As ICommand
|
||||
|
||||
Public ReadOnly Property ImageSource As String
|
||||
Get
|
||||
Return m_MainWindow.GetResourcesDir() & "\MachineButtonsImage\" & TImageName
|
||||
@@ -547,12 +561,39 @@ Public Class NoStateButton
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Sub New(TImagePath As String, TLuaScriptPath As String, FImagePath As String, FLuaScriptPath As String)
|
||||
MyBase.New(TImagePath, TLuaScriptPath, Nothing, Nothing, Nothing)
|
||||
Sub New(TImagePath As String, TLuaScriptPath As String, FImagePath As String, FLuaScriptPath As String, StateFlag As String)
|
||||
MyBase.New(TImagePath, TLuaScriptPath, Nothing, Nothing, StateFlag)
|
||||
End Sub
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
#Region "COMMANDS"
|
||||
|
||||
#Region "Execute"
|
||||
|
||||
' Returns a command that manage the MainWindow_Unloaded command
|
||||
Public ReadOnly Property ExecuteCommand() As ICommand
|
||||
Get
|
||||
If m_cmdExecute Is Nothing Then
|
||||
m_cmdExecute = New Command(AddressOf Execute)
|
||||
End If
|
||||
Return m_cmdExecute
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
||||
Public Sub Execute()
|
||||
If StateFlag = K_MANUAL Then
|
||||
m_CN.DGeneralFunctions_WriteCncMode(7) ' Modalità manuale
|
||||
Else
|
||||
ExecuteMDICommand(TLuaScriptName)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' Execute
|
||||
|
||||
#End Region ' COMMANDS
|
||||
|
||||
End Class
|
||||
|
||||
Public Class ThreeStateButton
|
||||
@@ -568,6 +609,7 @@ Public Class ThreeStateButton
|
||||
End Get
|
||||
Set(value As SolidColorBrush)
|
||||
m_Background = value
|
||||
NotifyPropertyChanged("Background")
|
||||
End Set
|
||||
End Property
|
||||
Public ReadOnly Property ImageSource As String
|
||||
@@ -602,6 +644,7 @@ Public Class ThreeStateButton
|
||||
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
||||
Public Sub Execute()
|
||||
ExecuteMDICommand(TLuaScriptName)
|
||||
ExecuteMDICommand(FLuaScriptName)
|
||||
End Sub
|
||||
|
||||
#End Region ' Execute
|
||||
@@ -621,6 +664,7 @@ Public Class DoubleCommandButton
|
||||
Set(value As Boolean)
|
||||
m_IsChecked = value
|
||||
ExecuteMDICommand(TLuaScriptName)
|
||||
System.Threading.Thread.Sleep(100)
|
||||
ExecuteMDICommand(FLuaScriptName)
|
||||
End Set
|
||||
End Property
|
||||
@@ -633,7 +677,7 @@ Public Class DoubleCommandButton
|
||||
Public ReadOnly Property ImageSource As String
|
||||
Get
|
||||
' Se variabile di stato "Nothing" o non collegato a CN, imposto immagine fissa
|
||||
If StateFlag = BTN_STATE_NOTHING Or Not m_MainWindow.m_bNCLink Then
|
||||
If StateFlag = BTN_STATE_NOTHING Or Not m_MainWindow.m_bNCLink Or IsNothing(FImageName) Or String.IsNullOrWhiteSpace(FImageName) Then
|
||||
' ritorno immagine dello stato true
|
||||
Return m_MainWindow.GetResourcesDir() & "\MachineButtonsImage\" & TImageName
|
||||
End If
|
||||
@@ -669,7 +713,7 @@ Public Class PressedCommandButton
|
||||
Public ReadOnly Property ImageSource As String
|
||||
Get
|
||||
' Se variabile di stato "Nothing" o non collegato a CN, imposto immagine fissa
|
||||
If StateFlag = BTN_STATE_NOTHING Or Not m_MainWindow.m_bNCLink Then
|
||||
If StateFlag = BTN_STATE_NOTHING Or Not m_MainWindow.m_bNCLink Or IsNothing(FImageName) Or String.IsNullOrWhiteSpace(FImageName) Then
|
||||
' ritorno immagine dello stato true
|
||||
Return m_MainWindow.GetResourcesDir() & "\MachineButtonsImage\" & TImageName
|
||||
End If
|
||||
|
||||
Reference in New Issue
Block a user