Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fa0bdaba59 | |||
| 95d5baebc9 | |||
| 6e4645875b |
+18
@@ -0,0 +1,18 @@
|
||||
|
||||
# /
|
||||
/revision.h
|
||||
/*.aps
|
||||
/*.ncb
|
||||
/*.suo
|
||||
/*.user
|
||||
/*.sdf
|
||||
/*.opensdf
|
||||
/Debug32
|
||||
/Release32
|
||||
/Trial32
|
||||
/Debug64
|
||||
/Release64
|
||||
/ipch
|
||||
/bin
|
||||
/obj
|
||||
/.vs
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
</configuration>
|
||||
@@ -0,0 +1,8 @@
|
||||
<Application x:Class="Application"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:EgtCOMMTest">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary Source="Utility/Dictionary.xaml"/>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
@@ -0,0 +1,14 @@
|
||||
Class Application
|
||||
|
||||
' Application-level events, such as Startup, Exit, and DispatcherUnhandledException
|
||||
' can be handled in this file.
|
||||
Protected Overrides Sub OnStartup(e As StartupEventArgs)
|
||||
MyBase.OnStartup(e)
|
||||
ShutdownMode = System.Windows.ShutdownMode.OnMainWindowClose
|
||||
' Creo la View principale
|
||||
Me.MainWindow = New MainWindowV
|
||||
' Mostro la View principale
|
||||
Me.MainWindow.Show()
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,20 @@
|
||||
<UserControl x:Class="AxesPanelV"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:EgtCOMMTest"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<ItemsControl ItemsSource="{Binding AxesList}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<UniformGrid Columns="3">
|
||||
<TextBlock Text="{Binding nId}"/>
|
||||
<TextBlock Text="{Binding sName}"/>
|
||||
<TextBlock Text="{Binding dValue}"/>
|
||||
</UniformGrid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,3 @@
|
||||
Public Class AxesPanelV
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,123 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports EgtWPFLib5
|
||||
Imports EgtUILib
|
||||
|
||||
Public Class AxesPanelVM
|
||||
Inherits VMBase
|
||||
|
||||
Private m_AxesList As New ObservableCollection(Of Axis)
|
||||
Public ReadOnly Property AxesList As ObservableCollection(Of Axis)
|
||||
Get
|
||||
Return m_AxesList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Sub New()
|
||||
' immposto riferimento in Map
|
||||
Map.SetRefAxesPanelVM(Me)
|
||||
' leggo assi da ini
|
||||
Dim nIndex As Integer = 1
|
||||
Dim Axis As Axis = GetPrivateProfileAxis(S_AXES, nIndex.ToString(), Map.refMainWindowVM.MainWindowM.sMachIniFile)
|
||||
' leggo assi lineari
|
||||
While Not IsNothing(Axis)
|
||||
AxesList.Add(Axis)
|
||||
nIndex += 1
|
||||
Axis = GetPrivateProfileAxis(S_AXES, nIndex, Map.refMainWindowVM.MainWindowM.sMachIniFile)
|
||||
End While
|
||||
End Sub
|
||||
|
||||
Private Function GetPrivateProfileAxis(IpAppName As String, IpKeyName As String, IpFileName As String) As Axis
|
||||
Dim sAxis As String = ""
|
||||
EgtUILib.GetPrivateProfileString(IpAppName, IpKeyName, "", sAxis, IpFileName)
|
||||
Dim sAxisValues() As String = sAxis.Split(","c)
|
||||
If Not sAxisValues.Count >= 3 Then Return Nothing
|
||||
For Each Value In sAxisValues
|
||||
Value = Value.Trim()
|
||||
Next
|
||||
Dim nId As Integer = 0
|
||||
Dim Type As Axis.AxisTypes = Axis.AxisTypes.NULL
|
||||
Integer.TryParse(sAxisValues(1), nId)
|
||||
Select Case sAxisValues(0).ToLower()
|
||||
Case "l"
|
||||
Type = Axis.AxisTypes.LINEAR
|
||||
Case "r"
|
||||
Type = Axis.AxisTypes.ROTATIONAL
|
||||
Case Else
|
||||
Type = Axis.AxisTypes.NULL
|
||||
End Select
|
||||
Return New Axis(nId, Type, sAxisValues(2))
|
||||
End Function
|
||||
|
||||
Friend Sub AxisCoordinatesCallbackDlg(AxisValue As Double, AxisIndex As Integer)
|
||||
Dim Axis As Axis = m_AxesList.FirstOrDefault(Function(x) x.nId = AxisIndex)
|
||||
If Not IsNothing(Axis) Then
|
||||
Axis.SetValue(AxisValue)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub SetAxisValue(VarName As String, VarValue As String)
|
||||
Dim Axis As Axis = m_AxesList.FirstOrDefault(Function(x) x.sName = VarName)
|
||||
If Not IsNothing(Axis) Then
|
||||
Axis.SetValue(VarValue)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
Public Class Axis
|
||||
Inherits VMBase
|
||||
|
||||
Public Enum AxisTypes As Integer
|
||||
NULL = 0
|
||||
LINEAR = 1
|
||||
ROTATIONAL = 2
|
||||
End Enum
|
||||
|
||||
Private m_nId As String
|
||||
Public ReadOnly Property nId As String
|
||||
Get
|
||||
Return m_nId
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_sName As String
|
||||
Public ReadOnly Property sName As String
|
||||
Get
|
||||
Return m_sName
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_Type As AxisTypes
|
||||
Public ReadOnly Property Type As AxisTypes
|
||||
Get
|
||||
Return m_Type
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_dValue As Double
|
||||
Public ReadOnly Property dValue As Double
|
||||
Get
|
||||
Return m_dValue
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Friend Sub SetValue(value As Double)
|
||||
Select Case Type
|
||||
Case AxisTypes.LINEAR
|
||||
m_dValue = value / 1000
|
||||
Case AxisTypes.ROTATIONAL
|
||||
m_dValue = value / 10000
|
||||
Case Else
|
||||
m_dValue = value
|
||||
|
||||
End Select
|
||||
NotifyPropertyChanged(NameOf(dValue))
|
||||
End Sub
|
||||
|
||||
Public Sub New(nId As String, Type As AxisTypes, sName As String)
|
||||
m_nId = nId
|
||||
m_Type = Type
|
||||
m_sName = sName
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
+243
@@ -0,0 +1,243 @@
|
||||
Imports System
|
||||
Imports System.Collections.Generic
|
||||
Imports System.Linq
|
||||
Imports System.Runtime.Remoting.Channels
|
||||
Imports System.Runtime.Remoting.Channels.Ipc
|
||||
Imports System.Security.Permissions
|
||||
Imports System.Text
|
||||
Imports System.Threading.Tasks
|
||||
Imports System.Windows
|
||||
Imports ISOCNC.Remoting
|
||||
|
||||
Class Comm
|
||||
|
||||
' creo classe di gestione variabili
|
||||
Private m_RWVariableManager As RWVariableManager
|
||||
Friend ReadOnly Property RWVariableManager As RWVariableManager
|
||||
Get
|
||||
Return m_RWVariableManager
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_MachManaging As MachManaging
|
||||
Friend ReadOnly Property MachManaging As MachManaging
|
||||
Get
|
||||
Return m_MachManaging
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private _axesVal As Double() = New Double(23) {}
|
||||
Private _cmdActive As Integer = 0
|
||||
Private m_opState As ISOCNC.Remoting.MachineOperatingState = ISOCNC.Remoting.MachineOperatingState.Unspecified
|
||||
Public ReadOnly Property opState As ISOCNC.Remoting.MachineOperatingState
|
||||
Get
|
||||
Return m_opState
|
||||
End Get
|
||||
End Property
|
||||
Private _remObject As ISOCNC.Remoting_Server
|
||||
|
||||
Public ReadOnly Property remObject As ISOCNC.Remoting_Server
|
||||
Get
|
||||
Return _remObject
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private serverURI As String = "ipc://localhost:9090/IRemoteObject.rem"
|
||||
Private m_eventProxy As ISOCNC.Remoting.EventProxyManager
|
||||
Friend ReadOnly Property eventProxy As ISOCNC.Remoting.EventProxyManager
|
||||
Get
|
||||
Return m_eventProxy
|
||||
End Get
|
||||
End Property
|
||||
Private _rpc As Integer
|
||||
Private _prgCount As Integer
|
||||
Private _prgAtIndex As String
|
||||
Private _prgList As String()
|
||||
Private _prgListUpdated As Boolean
|
||||
Private _errCycle As String
|
||||
Private _iso As String
|
||||
Private _message As String
|
||||
Private _errSystem As String
|
||||
|
||||
Private m_Proxy_CommandExecutedEventHandler As New CommandExecutedEventHandler(AddressOf RemoteObject_CommandExecuted)
|
||||
Private m_Proxy_ServerErrorEventHandler As New ServerErrorEventHandler(AddressOf RemoteObject_ServerError)
|
||||
Private m_Proxy_AxesCoordinatesUpdateEventHandler As New AxesCoordinatesUpdateEventHandler(AddressOf RemoteObject_AxisCoordinatesUpdate)
|
||||
Private m_Proxy_OpStateUpdateEventHandler As New OpStateUpdateEventHandler(AddressOf RemoteObject_OpStateUpdate)
|
||||
Private m_Proxy_AlarmNotificationEventHandler As New AlarmNotificationEventHandler(AddressOf RemoteObject_AlarmNotification)
|
||||
Private m_Proxy_ListInfoEventHandler As New ListInfoEventHandler(AddressOf RemoteObject_ListInfoResponse)
|
||||
Private m_Proxy_RPCUpdateEventHandler As New RPCUpdateEventHandler(AddressOf RemoteObject_RPCUpdate)
|
||||
Private m_Proxy_VariableCommandExecutedEventHandler As New VariableCommandExecutedEventHandler(AddressOf RemoteObject_VariableCommandExecuted)
|
||||
Private m_Proxy_TickUpdateEventHandler As New TickUpdateEventHandler(AddressOf RemoteObject_TickUpdate)
|
||||
Private m_Rem_CommandExecutedEventHandler As CommandExecutedEventHandler
|
||||
Private m_Rem_ServerErrorEventHandler As ServerErrorEventHandler
|
||||
Private m_Rem_AxesCoordinatesUpdateEventHandler As AxesCoordinatesUpdateEventHandler
|
||||
Private m_Rem_OpStateUpdateEventHandler As OpStateUpdateEventHandler
|
||||
Private m_Rem_AlarmNotificationEventHandler As AlarmNotificationEventHandler
|
||||
Private m_Rem_ListInfoEventHandler As ListInfoEventHandler
|
||||
Private m_Rem_RPCUpdateEventHandler As RPCUpdateEventHandler
|
||||
Private m_Rem_VariableCommandExecutedEventHandler As VariableCommandExecutedEventHandler
|
||||
|
||||
|
||||
<SecurityPermission(SecurityAction.Demand)>
|
||||
Public Sub New(Machmanaging As MachManaging)
|
||||
m_MachManaging = Machmanaging
|
||||
Dim properties As System.Collections.Hashtable = New System.Collections.Hashtable()
|
||||
properties("name") = "remotingClient"
|
||||
properties("priority") = "20"
|
||||
properties("portName") = "67"
|
||||
Dim clientProv As BinaryClientFormatterSinkProvider = New BinaryClientFormatterSinkProvider()
|
||||
Dim serverProv As BinaryServerFormatterSinkProvider = New BinaryServerFormatterSinkProvider()
|
||||
serverProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full
|
||||
Dim channel As IpcChannel = New IpcChannel(properties, clientProv, serverProv)
|
||||
System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(channel, False)
|
||||
Dim remoteType As System.Runtime.Remoting.WellKnownClientTypeEntry = New System.Runtime.Remoting.WellKnownClientTypeEntry(GetType(ISOCNC.Remoting_Server), serverURI)
|
||||
System.Runtime.Remoting.RemotingConfiguration.RegisterWellKnownClientType(remoteType)
|
||||
Dim objectUri As String
|
||||
Dim messageSink As System.Runtime.Remoting.Messaging.IMessageSink = channel.CreateMessageSink("ipc://localhost:9090/IRemoteObject.rem", Nothing, objectUri)
|
||||
Console.WriteLine("The URI of the message sink is {0}.", objectUri)
|
||||
|
||||
If messageSink IsNot Nothing Then
|
||||
Console.WriteLine("The type of the message sink is {0}.", messageSink.[GetType]().ToString())
|
||||
End If
|
||||
|
||||
m_eventProxy = New ISOCNC.Remoting.EventProxyManager()
|
||||
AddHandler m_eventProxy.CommandExecuted, m_Proxy_CommandExecutedEventHandler
|
||||
AddHandler m_eventProxy.ServerError, m_Proxy_ServerErrorEventHandler
|
||||
AddHandler m_eventProxy.AxisCoordinatesUpdate, m_Proxy_AxesCoordinatesUpdateEventHandler
|
||||
AddHandler m_eventProxy.OpStateUpdate, m_Proxy_OpStateUpdateEventHandler
|
||||
AddHandler m_eventProxy.AlarmNotification, m_Proxy_AlarmNotificationEventHandler
|
||||
AddHandler m_eventProxy.ListInfoResponse, m_Proxy_ListInfoEventHandler
|
||||
AddHandler m_eventProxy.RPCUpdate, m_Proxy_RPCUpdateEventHandler
|
||||
AddHandler m_eventProxy.VariableCommandExecuted, m_Proxy_VariableCommandExecutedEventHandler
|
||||
AddHandler m_eventProxy.TickUpdate, m_Proxy_TickUpdateEventHandler
|
||||
|
||||
_remObject = CType(Activator.GetObject(GetType(ISOCNC.Remoting_Server), serverURI), ISOCNC.Remoting_Server)
|
||||
Try
|
||||
m_Rem_CommandExecutedEventHandler = New CommandExecutedEventHandler(AddressOf m_eventProxy.LocallyHandleCommandExecuted)
|
||||
m_Rem_ServerErrorEventHandler = New ServerErrorEventHandler(AddressOf m_eventProxy.LocallyHandleServerError)
|
||||
m_Rem_AxesCoordinatesUpdateEventHandler = New AxesCoordinatesUpdateEventHandler(AddressOf m_eventProxy.LocallyHandleAxisCoordinatesUpdate)
|
||||
m_Rem_OpStateUpdateEventHandler = New OpStateUpdateEventHandler(AddressOf m_eventProxy.LocallyHandleOpStateUpdate)
|
||||
m_Rem_AlarmNotificationEventHandler = New AlarmNotificationEventHandler(AddressOf m_eventProxy.LocallyHandleAlarmNotification)
|
||||
m_Rem_ListInfoEventHandler = New ListInfoEventHandler(AddressOf m_eventProxy.LocallyHandleListInfo)
|
||||
m_Rem_RPCUpdateEventHandler = New RPCUpdateEventHandler(AddressOf m_eventProxy.LocallyHandleRPCUpdate)
|
||||
m_Rem_VariableCommandExecutedEventHandler = New VariableCommandExecutedEventHandler(AddressOf m_eventProxy.LocallyHandleVariableCommandExecuted)
|
||||
AddHandler _remObject.CommandExecuted, m_Rem_CommandExecutedEventHandler
|
||||
AddHandler _remObject.ServerError, m_Rem_ServerErrorEventHandler
|
||||
AddHandler _remObject.AxisCoordinatesUpdate, m_Rem_AxesCoordinatesUpdateEventHandler
|
||||
AddHandler _remObject.OpStateUpdate, m_Rem_OpStateUpdateEventHandler
|
||||
AddHandler _remObject.AlarmNotification, m_Rem_AlarmNotificationEventHandler
|
||||
AddHandler _remObject.ListInfoResponse, m_Rem_ListInfoEventHandler
|
||||
AddHandler _remObject.RPCUpdate, m_Rem_RPCUpdateEventHandler
|
||||
AddHandler _remObject.VariableCommandExecuted, m_Rem_VariableCommandExecutedEventHandler
|
||||
Catch ex As System.Runtime.Remoting.RemotingException
|
||||
Dim dR As MessageBoxResult = MessageBox.Show(ex.Message)
|
||||
End Try
|
||||
' creo classe che gestisce variabili
|
||||
m_RWVariableManager = RWVariableManager.CreateRWVariableManager(Me)
|
||||
End Sub
|
||||
|
||||
Friend Sub OnDispose()
|
||||
RemoveHandler _remObject.CommandExecuted, m_Rem_CommandExecutedEventHandler
|
||||
RemoveHandler _remObject.ServerError, m_Rem_ServerErrorEventHandler
|
||||
RemoveHandler _remObject.AxisCoordinatesUpdate, m_Rem_AxesCoordinatesUpdateEventHandler
|
||||
RemoveHandler _remObject.OpStateUpdate, m_Rem_OpStateUpdateEventHandler
|
||||
RemoveHandler _remObject.AlarmNotification, m_Rem_AlarmNotificationEventHandler
|
||||
RemoveHandler _remObject.ListInfoResponse, m_Rem_ListInfoEventHandler
|
||||
RemoveHandler _remObject.RPCUpdate, m_Rem_RPCUpdateEventHandler
|
||||
RemoveHandler _remObject.VariableCommandExecuted, m_Rem_VariableCommandExecutedEventHandler
|
||||
RemoveHandler m_eventProxy.CommandExecuted, m_Proxy_CommandExecutedEventHandler
|
||||
RemoveHandler m_eventProxy.ServerError, m_Proxy_ServerErrorEventHandler
|
||||
RemoveHandler m_eventProxy.AxisCoordinatesUpdate, m_Proxy_AxesCoordinatesUpdateEventHandler
|
||||
RemoveHandler m_eventProxy.OpStateUpdate, m_Proxy_OpStateUpdateEventHandler
|
||||
RemoveHandler m_eventProxy.AlarmNotification, m_Proxy_AlarmNotificationEventHandler
|
||||
RemoveHandler m_eventProxy.ListInfoResponse, m_Proxy_ListInfoEventHandler
|
||||
RemoveHandler m_eventProxy.RPCUpdate, m_Proxy_RPCUpdateEventHandler
|
||||
RemoveHandler m_eventProxy.VariableCommandExecuted, m_Proxy_VariableCommandExecutedEventHandler
|
||||
RemoveHandler m_eventProxy.TickUpdate, m_Proxy_TickUpdateEventHandler
|
||||
End Sub
|
||||
|
||||
Private Sub RemoteObject_OpStateUpdate(ByVal newOpState As ISOCNC.Remoting.MachineOperatingState)
|
||||
' resetto stato pending iniziale
|
||||
If Map.refMachManaging.StartPending AndAlso newOpState = MachineOperatingState.Pending Then
|
||||
MachManaging.ResetStartPending()
|
||||
End If
|
||||
m_opState = newOpState
|
||||
m_OpStateCallbackDlg(newOpState)
|
||||
End Sub
|
||||
|
||||
Private Sub RemoteObject_CommandExecuted(ByVal executedCommand As Integer)
|
||||
Select Case executedCommand
|
||||
Case CInt(ISOCNC.Remoting.Commands.NoCommand)
|
||||
Case CInt(ISOCNC.Remoting.Commands.[End])
|
||||
m_ResultCallbackDlg(CommandTypes.RESET, CommandStates.OK, ResultTypes.RESULT, "")
|
||||
Case CInt(ISOCNC.Remoting.Commands.[Error])
|
||||
m_ResultCallbackDlg(CommandTypes.ERROR_, CommandStates.ERROR_, ResultTypes.RESULT, "")
|
||||
Case CInt(ISOCNC.Remoting.Commands.MDI_End)
|
||||
Case CInt(ISOCNC.Remoting.Commands.MDI_Start)
|
||||
Case CInt(ISOCNC.Remoting.Commands.MDI_Stop)
|
||||
Case CInt(ISOCNC.Remoting.Commands.SetPoint)
|
||||
m_ResultCallbackDlg(CommandTypes.SETPOINT, CommandStates.OK, ResultTypes.RESULT, "")
|
||||
Case CInt(ISOCNC.Remoting.Commands.Start)
|
||||
m_ResultCallbackDlg(CommandTypes.START, CommandStates.OK, ResultTypes.RESULT, "")
|
||||
Case CInt(ISOCNC.Remoting.Commands.[Step])
|
||||
m_ResultCallbackDlg(CommandTypes.STEP_, CommandStates.OK, ResultTypes.RESULT, "")
|
||||
Case CInt(ISOCNC.Remoting.Commands.[Stop])
|
||||
m_ResultCallbackDlg(CommandTypes.STOP_, CommandStates.OK, ResultTypes.RESULT, "")
|
||||
Case CInt(ISOCNC.Remoting.Commands.Start_Program_Soft)
|
||||
m_ResultCallbackDlg(CommandTypes.SOFTSTART, CommandStates.OK, ResultTypes.RESULT, "")
|
||||
Case Else
|
||||
End Select
|
||||
_cmdActive = CInt(executedCommand)
|
||||
End Sub
|
||||
|
||||
Private Sub RemoteObject_ServerError(ByVal sender As Object, ByVal seEA As ISOCNC.Remoting.ServerErrorEventArgs)
|
||||
m_ResultCallbackDlg(CommandTypes.ERROR_, CommandStates.ERROR_, ResultTypes.RESULT, "Server Error: " & seEA.[Error])
|
||||
Dim dr As MessageBoxResult = MessageBox.Show("Server Error: " & seEA.[Error])
|
||||
End Sub
|
||||
|
||||
Private Sub RemoteObject_AxisCoordinatesUpdate(ByVal axisValue As Double, ByVal axisIndex As Integer)
|
||||
m_AxisCoordinatesCallbackDlg(axisValue, axisIndex)
|
||||
End Sub
|
||||
|
||||
Private Sub RemoteObject_RPCUpdate(ByVal newRPC As UInteger)
|
||||
_rpc = CInt(newRPC)
|
||||
End Sub
|
||||
|
||||
Private Sub RemoteObject_ListInfoResponse(ByVal prgCount As Integer, ByVal prgAtIndex As String, ByVal prgList As String())
|
||||
If prgCount >= 0 Then
|
||||
_prgCount = prgCount
|
||||
End If
|
||||
|
||||
If prgAtIndex <> "" Then
|
||||
_prgAtIndex = prgAtIndex
|
||||
End If
|
||||
|
||||
If prgList IsNot Nothing AndAlso prgList.Length > 0 Then
|
||||
_prgList = prgList
|
||||
_prgListUpdated = True
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub RemoteObject_AlarmNotification(ByVal alarmOperation As Integer, ByVal alarmType As Integer, ByVal alarmMessage As String, ByVal alarmCode As String, ByVal alarmDateTime As String)
|
||||
' restituisco errore ad interfaccia
|
||||
m_AlarmCallbackDlg(alarmOperation, alarmType, alarmMessage, alarmCode, alarmDateTime)
|
||||
End Sub
|
||||
|
||||
Private Sub RemoteObject_VariableCommandExecuted(ByVal executedCommand As Integer, ByVal commandExecutedCorrectly As Boolean, ByVal varName As String, ByVal varValue As String, ByVal varType As Integer)
|
||||
' riporto valore variabile su array
|
||||
Select Case executedCommand
|
||||
Case VariableCommands.Error
|
||||
Case VariableCommands.NotExecuted
|
||||
Case VariableCommands.ReadVar
|
||||
m_RWVariableManager.UpdateVar(commandExecutedCorrectly, varName, varValue, varType)
|
||||
Case VariableCommands.WriteVar
|
||||
m_ResultCallbackDlg(CommandTypes.WRITE, If(commandExecutedCorrectly, CommandStates.OK, CommandStates.ERROR_), ResultTypes.RESULT, varName & "=" & varValue)
|
||||
Case VariableCommands.ReadAxis
|
||||
Case VariableCommands.ReadAny
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Private Sub RemoteObject_TickUpdate(ByVal newTick As ULong)
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,833 @@
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class NUMFlexiumComm
|
||||
|
||||
Enum CNMode As Integer
|
||||
AUTO = 0
|
||||
SINGLE_ = 1
|
||||
MDI = 2
|
||||
MANUAL = 7
|
||||
End Enum
|
||||
|
||||
Private m_MachManaging As MachManaging
|
||||
Friend ReadOnly Property MachManaging As MachManaging
|
||||
Get
|
||||
Return m_MachManaging
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private objDRunTimeSystem As FXServer.DRunTimeSystem
|
||||
Private objDGroupManager As FXServer.DGroupManager
|
||||
Private objDGeneralFunction As FXServer.DGeneralFunctions
|
||||
Private objDMainCncData As FXServer.DMainCncData
|
||||
Private objErrorHandler As FXLog.ErrorHandler
|
||||
Private objDPlcVariables As FXServer.DPlcVariables
|
||||
Private objDReadELS As FXServer.DReadELS
|
||||
Private objDFileTransfer As FXServer.DFileTransfer
|
||||
Private objDPosition As FXServer.DPosition
|
||||
Private objDMdiCommand As FXServer.DMdiCommand
|
||||
Private objDVariables As FXServer.DVariables
|
||||
Private objDCncMode As FXServer.DCncMode
|
||||
|
||||
Private m_IsFlexiumPlus As Boolean = False
|
||||
Private m_CNCVersion As String = ""
|
||||
Private _PartProgramNumber As Single
|
||||
Private _CNCAxisChannelArray As String() = New String() {"Channel 1", "Channel 2"}
|
||||
Private m_ChannelList As New List(Of String)
|
||||
' Arraylist for read out the messages
|
||||
Private _ReadFXMessages As New ArrayList
|
||||
' lista variabili in lettura
|
||||
Private Shared m_ReadingVars(19) As CommVar
|
||||
Private m_BytesTransferedCounter As Integer
|
||||
Private m_LinearAxisPrecision As Integer
|
||||
|
||||
Public Sub New(MachManaging As MachManaging)
|
||||
m_MachManaging = MachManaging
|
||||
End Sub
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Friend Sub InitFxServer()
|
||||
objDRunTimeSystem = New FXServer.DRunTimeSystem()
|
||||
AddHandler objDRunTimeSystem.ServerInitializationFinished, AddressOf objDRunTimeSystem_ServerInitializationFinished
|
||||
AddHandler objDRunTimeSystem.ServerReinitializationStarted, AddressOf objDRunTimeSystem_ServerReinitializationStarted
|
||||
objDRunTimeSystem.Init()
|
||||
End Sub
|
||||
|
||||
Private Sub InitFxObjects()
|
||||
objDGroupManager = New FXServer.DGroupManager()
|
||||
AddHandler objDGroupManager.ErrorHandler, AddressOf objDGroupManager_ErrorHandler
|
||||
objDGroupManager.CncNumber = 0
|
||||
objDGroupManager.AxisGroup = 0
|
||||
|
||||
objDGeneralFunction = New FXServer.DGeneralFunctions()
|
||||
AddHandler objDGeneralFunction.ProgramActivated, AddressOf objDGeneralFunction_ProgramActivated
|
||||
AddHandler objDGeneralFunction.OnCncStart, AddressOf objDGeneralFunction_OnCncStart
|
||||
AddHandler objDGeneralFunction.OnCncStop, AddressOf objDGeneralFunction_OnCncStop
|
||||
AddHandler objDGeneralFunction.OnCncReset, AddressOf objDGeneralFunction_OnCncReset
|
||||
AddHandler objDGeneralFunction.CncModeWritten, AddressOf objDGeneralFunction_CncModeWritten
|
||||
AddHandler objDGeneralFunction.VariableWritten, AddressOf objDGeneralFunction_VariableWritten
|
||||
objDGeneralFunction.Init(objDGroupManager.Handle)
|
||||
objDMainCncData = New FXServer.DMainCncData()
|
||||
objDMainCncData.Init(objDGroupManager.Handle)
|
||||
m_LinearAxisPrecision = objDMainCncData.GetLinearPrecision()
|
||||
Dim CncFxIdentifier As String = objDMainCncData.GetCncIdentifier()
|
||||
EgtOutLog("CncFxIdentifier: " & CncFxIdentifier)
|
||||
|
||||
m_IsFlexiumPlus = Not (CncFxIdentifier = "Flexium 6" OrElse CncFxIdentifier = "Flexium 8" OrElse CncFxIdentifier = "Flexium 68")
|
||||
|
||||
m_CNCVersion = objDMainCncData.GetCncVersion()
|
||||
|
||||
' Initialize for Channel Change
|
||||
Dim CncGroupNumber As Integer = objDMainCncData.GetCncGroupNumber()
|
||||
Dim PlcGroupNumber As Integer = objDMainCncData.GetPlcGroupNumber()
|
||||
|
||||
Dim sumChannels As Integer = 0
|
||||
sumChannels = PlcGroupNumber + CncGroupNumber
|
||||
For i = 1 To sumChannels
|
||||
m_ChannelList.Add(i)
|
||||
Next
|
||||
|
||||
' Initialize FXLog Objects
|
||||
objErrorHandler = New FXLog.ErrorHandler()
|
||||
AddHandler objErrorHandler.ErrorFromActiveCnc2, AddressOf objErrorHandler_ErrorFromActiveCnc2
|
||||
AddHandler objErrorHandler.ErrorOnCnc, AddressOf objErrorHandler_ErrorOnCnc
|
||||
AddHandler objErrorHandler.ErrorOnOtherChannel, AddressOf objErrorHandler_ErrorOnOtherChannel
|
||||
AddHandler objErrorHandler.Exception, AddressOf objErrorHandler_Exception
|
||||
'Initialisation config for testing
|
||||
'Accepting all messages
|
||||
'Consult the documentation for detailed information
|
||||
|
||||
objErrorHandler.AllError = 1
|
||||
objErrorHandler.ErrorGlobal = 0
|
||||
objErrorHandler.SetChannel(0, 0)
|
||||
objErrorHandler.AcceptBootSysMessage(1)
|
||||
objErrorHandler.AcceptException(0)
|
||||
|
||||
objDPlcVariables = New FXServer.DPlcVariables()
|
||||
'objDPlcVariables.Symbols += New FXServer.IDPlcVariablesEvents_SymbolsEventHandler(AddressOf objDPlcVariables_Symbols)
|
||||
AddHandler objDPlcVariables.ReadVariablesChanged, AddressOf objDPlcVariables_ReadVariablesChanged
|
||||
AddHandler objDPlcVariables.VariablesWritten2, AddressOf objDPlcVariables_VariablesWritten2
|
||||
AddHandler objDPlcVariables.ReadOnceVariablesChanged, AddressOf objDPlcVariables_ReadOnceVariablesChanged
|
||||
objDPlcVariables.Flag = 3
|
||||
objDPlcVariables.Init(objDGroupManager.Handle)
|
||||
|
||||
' Initialize FXServer class DReadELS
|
||||
objDReadELS = New FXServer.DReadELS()
|
||||
AddHandler objDReadELS.ValueChanged, AddressOf objDReadELS_ValueChanged
|
||||
AddHandler objDReadELS.ValueChanged2, AddressOf objDReadELS_ValueChanged2
|
||||
' Only for FX Server >= 3.9.0.0
|
||||
AddHandler objDReadELS.ValueChanged3, AddressOf objDReadELS_ValueChanged3
|
||||
objDReadELS.Init(objDGroupManager.Handle)
|
||||
|
||||
'Initialize FXServer class DFileTransfer
|
||||
objDFileTransfer = New FXServer.DFileTransfer()
|
||||
AddHandler objDFileTransfer.Completed, AddressOf objDFileTransfer_Completed
|
||||
AddHandler objDFileTransfer.TransferStarted, AddressOf objDFileTransfer_TransferStarted
|
||||
AddHandler objDFileTransfer.Failed, AddressOf objDFileTransfer_Failed
|
||||
AddHandler objDFileTransfer.BytesTransfered, AddressOf objDFileTransfer_BytesTransfered
|
||||
|
||||
objDFileTransfer.Init(objDGroupManager.Handle)
|
||||
|
||||
objDPosition = New FXServer.DPosition()
|
||||
'objDPosition.ValidAxisChanged += New FXServer.IDPositionEvents_ValidAxisChangedEventHandler(AddressOf objDPosition_ValidAxisChanged)
|
||||
AddHandler objDPosition.PositionChanged, AddressOf objDPosition_PositionChanged
|
||||
'objDPosition.DeltaChanged += New FXServer.IDPositionEvents_DeltaChangedEventHandler(AddressOf objDPosition_DeltaChanged)
|
||||
'objDPosition.ReadOnceValidAxisChanged += New FXServer.IDPositionEvents_ReadOnceValidAxisChangedEventHandler(AddressOf objDPosition_ReadOnceValidAxisChanged)
|
||||
'objDPosition.ReadOncePositionChanged += New FXServer.IDPositionEvents_ReadOncePositionChangedEventHandler(AddressOf objDPosition_ReadOncePositionChanged)
|
||||
'objDPosition.ReadOnceDeltaChanged += New FXServer.IDPositionEvents_ReadOnceDeltaChangedEventHandler(AddressOf objDPosition_ReadOnceDeltaChanged)
|
||||
'objDPosition.EndposChanged += New FXServer.IDPositionEvents_EndposChangedEventHandler(AddressOf objDPosition_EndposChanged)
|
||||
|
||||
objDPosition.Flag = 0
|
||||
objDPosition.ModeOP = 0
|
||||
objDPosition.FastUpdate = 0 ' Disable FastUpdate=0 To show the refresh time by Flag > 0
|
||||
objDPosition.Init(objDGroupManager.Handle)
|
||||
|
||||
'Initialize FXServer class DMdiCommand
|
||||
objDMdiCommand = New FXServer.DMdiCommand()
|
||||
AddHandler objDMdiCommand.CommandWritten, AddressOf objDMdiCommand_CommandWritten
|
||||
objDMdiCommand.Init(objDGroupManager.Handle)
|
||||
|
||||
'Initialize FXServer class DVariables
|
||||
objDVariables = New FXServer.DVariables()
|
||||
'AddHandler objDVariables.ValueChanged, AddressOf objDVariables_ValueChanged
|
||||
'AddHandler objDVariables.ValueChanged2, AddressOf objDVariables_ValueChanged2
|
||||
AddHandler objDVariables.VariableWritten, AddressOf objDVariables_VariableWritten
|
||||
AddHandler objDVariables.VariableWritten2, AddressOf objDVariables_VariableWritten2
|
||||
' Init & send the list of requested variables
|
||||
Dim rc As Short = objDVariables.Init(objDGroupManager.Handle, "E80000", 1)
|
||||
If (rc <> 0) Then EgtOutLog(" objDVariables.Init() Error : " + rc)
|
||||
|
||||
' Initialize FXServer class DCncMode
|
||||
objDCncMode = New FXServer.DCncMode()
|
||||
AddHandler objDCncMode.ValueChanged, AddressOf objDCncMode_ValueChanged
|
||||
objDCncMode.Init(objDGroupManager.Handle)
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub CloseFxObjects()
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(objDGroupManager)
|
||||
objDGroupManager = Nothing
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(objDGeneralFunction)
|
||||
objDGeneralFunction = Nothing
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(objErrorHandler)
|
||||
objErrorHandler = Nothing
|
||||
objDReadELS.Close()
|
||||
objDPlcVariables.Close()
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(objDReadELS)
|
||||
objDReadELS = Nothing
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(objDFileTransfer)
|
||||
objDFileTransfer = Nothing
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(objDPosition)
|
||||
objDPosition = Nothing
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(objDMdiCommand)
|
||||
objDMdiCommand = Nothing
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(objDVariables)
|
||||
objDVariables = Nothing
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub GetGeneralFunctions()
|
||||
Dim _GetConnectState As Int16 = objDGeneralFunction.ConnectionStatus
|
||||
|
||||
Select Case _GetConnectState
|
||||
Case 0
|
||||
' Not connected
|
||||
m_MachManaging.SetConnected(False)
|
||||
m_ResultCallbackDlg(CommandTypes.CONNECT, CommandStates.NULL, ResultTypes.EXECUTED, "")
|
||||
Case 1
|
||||
' Connection error
|
||||
m_MachManaging.SetConnected(False)
|
||||
m_ResultCallbackDlg(CommandTypes.CONNECT, CommandStates.ERROR_, ResultTypes.EXECUTED, "")
|
||||
Case 2
|
||||
' Connected
|
||||
m_MachManaging.SetConnected(True)
|
||||
m_ResultCallbackDlg(CommandTypes.CONNECT, CommandStates.OK, ResultTypes.EXECUTED, "")
|
||||
' avvio lettura variabili
|
||||
'MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.READ_NUMFLEXIUM))
|
||||
StartReadList()
|
||||
StartReadELS()
|
||||
Case Else
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Friend Sub Start()
|
||||
objDGeneralFunction.CncStart()
|
||||
End Sub
|
||||
|
||||
Friend Sub Stop_()
|
||||
objDGeneralFunction.CncStop()
|
||||
End Sub
|
||||
|
||||
Friend Sub Reset()
|
||||
objDGeneralFunction.CncReset()
|
||||
End Sub
|
||||
|
||||
Friend Sub SetMode(value As CNMode)
|
||||
objDGeneralFunction.WriteCncMode(value, 0)
|
||||
End Sub
|
||||
|
||||
'Private Sub WriteVariable(ByVal sender As Object, ByVal e As EventArgs)
|
||||
' Dim _E80011FxStd As Int32 = 88888
|
||||
' Dim _FXReturn As Short = objDGeneralFunction.WriteVariable("E80011", _E80011FxStd)
|
||||
|
||||
' If _FXReturn <> 0 Then
|
||||
' MessageBox.Show("Error from WriteVariable:" & " " & _FXReturn.ToString())
|
||||
' End If
|
||||
'End Sub
|
||||
|
||||
'Private Sub WriteVariable2(ByVal sender As Object, ByVal e As EventArgs)
|
||||
' Dim _E80010FxPlus As Double = 51515.6161
|
||||
' Dim _FXReturn As Short = objDGeneralFunction.WriteVariable2("E80010", _E80010FxPlus)
|
||||
|
||||
' If _FXReturn <> 0 Then
|
||||
' MessageBox.Show("Error from WriteVariable2:" & " " & _FXReturn.ToString())
|
||||
' End If
|
||||
'End Sub
|
||||
|
||||
Private Sub ChangeChannel(Channel As Short)
|
||||
objErrorHandler.SetChannel(0, Channel)
|
||||
End Sub
|
||||
|
||||
Friend Sub StartReadList()
|
||||
Dim AddressList() As String = (From CommVar In m_ReadingVars
|
||||
Where Not IsNothing(CommVar) AndAlso CommVar.nType = EgtCOMMTest.CommVar.Types.PLC
|
||||
Select CommVar.sAddress).ToArray()
|
||||
Dim _FXReturn As Short = objDPlcVariables.ReadVariables(AddressList)
|
||||
|
||||
If _FXReturn <> 0 Then
|
||||
EgtOutLog("Error ReadVariables:" & " " & _FXReturn.ToString())
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Friend Sub CloseReadList()
|
||||
objDPlcVariables.CloseReadList()
|
||||
End Sub
|
||||
|
||||
Private Sub ReadVariablesOnce(Address As String)
|
||||
'Dim _ReadSymbolicPlcVariableOnetime As String = "Application.IOCONFIG_GLOBALS.Flexium_NCK.RCNC.General.Mode"
|
||||
Dim _FXReturn As Int16 = objDPlcVariables.ReadVariablesOnce(10, Address)
|
||||
|
||||
If _FXReturn <> 0 Then
|
||||
EgtOutLog("Error ReadVariablesOnce:" & " " & _FXReturn.ToString())
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Friend Sub WritePlcVariables(Address As String, value As String)
|
||||
'Dim _WriteSymbolicPlcVariable As String = _txtReadWritePlcVariables0.Text
|
||||
Dim _FXReturn As Int16 = objDPlcVariables.WriteVariables2(11, Address, value)
|
||||
|
||||
If _FXReturn <> 0 Then
|
||||
EgtOutLog("Error WriteVariables2 :" & " " & _FXReturn.ToString())
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Public Shared Function InitVar(Variable As CommVar) As CommVar
|
||||
Dim Index As Integer = Array.IndexOf(m_ReadingVars, Nothing)
|
||||
m_ReadingVars(Index) = Variable
|
||||
Return m_ReadingVars(Index)
|
||||
End Function
|
||||
|
||||
Friend Sub StartReadELS()
|
||||
For Index = 0 To m_ReadingVars.Length - 1
|
||||
If IsNothing(m_ReadingVars(Index)) OrElse m_ReadingVars(Index).nType <> CommVar.Types.CN Then Continue For
|
||||
Dim rc As Short = objDReadELS.AddParameter(m_ReadingVars(Index).sAddress, Index)
|
||||
If rc <> 0 Then EgtOutLog(" Error AddParameter2 : " & rc & " on Variable : " & m_ReadingVars(Index).sAddress)
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Friend Sub CloseReadELS()
|
||||
objDPlcVariables.CloseReadList()
|
||||
End Sub
|
||||
|
||||
#Region "File transfer"
|
||||
|
||||
Friend Sub FileDownload(sFileType As String, sFilePath As String)
|
||||
Dim _Return_Download As Short
|
||||
|
||||
_Return_Download = objDFileTransfer.FileDownload2(10, sFileType, sFilePath, "", 1, 0)
|
||||
|
||||
If _Return_Download <> 0 Then
|
||||
EgtOutLog("Error: File not stored to the job list:" & " " & _Return_Download.ToString())
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub FileUpload(sFileType As String, sFilePath As String)
|
||||
Dim _Return_Upload As Short
|
||||
_Return_Upload = objDFileTransfer.FileUpload(20, sFileType, sFilePath, "")
|
||||
|
||||
If _Return_Upload <> 0 Then
|
||||
EgtOutLog("Error: File not stored to the job list:" & " " & _Return_Upload.ToString())
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Friend Sub FileDelete(sFileType As String, sFilePath As String)
|
||||
Dim _ReturnFileDelete As Short
|
||||
_ReturnFileDelete = objDFileTransfer.FileDelete(20, sFileType, "")
|
||||
|
||||
If _ReturnFileDelete <> 0 Then
|
||||
EgtOutLog("Error: File not deleted:" & " " & _ReturnFileDelete.ToString())
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Friend Sub StartTransfer()
|
||||
Dim _Return_StartTransfer As Short
|
||||
_Return_StartTransfer = objDFileTransfer.StartTransfer()
|
||||
|
||||
If _Return_StartTransfer <> 0 Then
|
||||
EgtOutLog("Error: Start transfer not executed:" & " " & _Return_StartTransfer.ToString())
|
||||
Else
|
||||
m_BytesTransferedCounter = 0
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' File transfer
|
||||
|
||||
#Region "MDI"
|
||||
|
||||
Friend Sub MDI_Execute(sCommand As String)
|
||||
Dim _FxReturn As Int16 = objDMdiCommand.ExecuteCommand(sCommand)
|
||||
|
||||
If _FxReturn <> 0 Then
|
||||
EgtOutLog("Error ExecuteCommand :" & " " & _FxReturn.ToString())
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' MDI
|
||||
|
||||
#Region "Variables"
|
||||
|
||||
Friend Sub WriteNCVariables(Address As String, value As String)
|
||||
Try
|
||||
Dim dValue As Double = 0
|
||||
StringToDouble(value, dValue)
|
||||
Dim rc As Short = objDVariables.WriteVariables2(2, objDGroupManager.Handle, Address, dValue)
|
||||
|
||||
If rc <> 0 Then EgtOutLog(" objDVariables.WriteVariables2() Error : " & rc)
|
||||
|
||||
Catch ex As Exception
|
||||
EgtOutLog(" objDVariables.WriteVariables2() Exception : " & ex.Message)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
#End Region ' Variables
|
||||
#End Region ' METHODS
|
||||
|
||||
#Region "EVENTS"
|
||||
|
||||
Private Sub objDRunTimeSystem_ServerInitializationFinished()
|
||||
InitFxObjects()
|
||||
GetGeneralFunctions()
|
||||
End Sub
|
||||
|
||||
Private Sub objDRunTimeSystem_ServerReinitializationStarted()
|
||||
CloseFxObjects()
|
||||
End Sub
|
||||
|
||||
Private Sub objDGeneralFunction_ProgramActivated(ByVal nerrorCode As Short)
|
||||
MessageBox.Show("Part program activated:" & " " & nerrorCode)
|
||||
End Sub
|
||||
|
||||
Private Sub objDGeneralFunction_OnCncStart(ByVal errorCode As Short)
|
||||
Dim bOk As Boolean = (errorCode = 0)
|
||||
m_MachManaging.SetStartPending(bOk)
|
||||
m_ResultCallbackDlg(CommandTypes.START, If(bOk, CommandStates.OK, CommandStates.ERROR_), ResultTypes.EXECUTED, If(bOk, "", "Error CNC Start: " & errorCode.ToString()))
|
||||
End Sub
|
||||
|
||||
Private Sub objDGeneralFunction_OnCncStop(ByVal errorCode As Short)
|
||||
Dim bOk As Boolean = (errorCode = 0)
|
||||
m_ResultCallbackDlg(CommandTypes.START, If(bOk, CommandStates.OK, CommandStates.ERROR_), ResultTypes.EXECUTED, If(bOk, "", "Error Feed Hold: " & errorCode.ToString()))
|
||||
End Sub
|
||||
|
||||
Private Sub objDGeneralFunction_OnCncReset(ByVal errorCode As Short)
|
||||
Dim bOk As Boolean = (errorCode = 0)
|
||||
m_ResultCallbackDlg(CommandTypes.START, If(bOk, CommandStates.OK, CommandStates.ERROR_), ResultTypes.EXECUTED, If(bOk, "", "Error CNC Reset: " & errorCode.ToString()))
|
||||
End Sub
|
||||
|
||||
Private Sub objDGeneralFunction_CncModeWritten(ByVal errorCode As Short)
|
||||
If errorCode <> 0 Then EgtOutLog("Error CNC Mode selection completed:" & " " & errorCode.ToString())
|
||||
End Sub
|
||||
|
||||
'Private Sub _txtPartProgramNumber_KeyPress(ByVal sender As Object, ByVal e As KeyPressEventArgs)
|
||||
' If e.KeyChar = CChar(Keys.[Return]) Then
|
||||
' e.Handled = True
|
||||
' Dim _CncAxisChannelIndependent As Int16
|
||||
' _PartProgramNumber = Single.Parse(_txtPartProgramNumber.Text)
|
||||
' MessageBox.Show("PartProgNumber:" & " " & _PartProgramNumber.ToString())
|
||||
' Dim _PartProgramNumberActivate As Int32 = Convert.ToInt32(_PartProgramNumber * 10)
|
||||
' MessageBox.Show("PartProgNumberActivate:" & " " & _PartProgramNumberActivate.ToString())
|
||||
|
||||
' If _checkChannelTypeState.Checked = True Then
|
||||
' _CncAxisChannelIndependent = 1
|
||||
' Else
|
||||
' _CncAxisChannelIndependent = 0
|
||||
' End If
|
||||
|
||||
' Dim _FXReturn As Int16 = objDGeneralFunction.ActivateProgram(_PartProgramNumberActivate, _CncAxisChannelIndependent)
|
||||
|
||||
' If _FXReturn <> 0 Then
|
||||
' MessageBox.Show("Error Activate Program:" & " " & _FXReturn.ToString())
|
||||
' End If
|
||||
' End If
|
||||
'End Sub
|
||||
|
||||
Private Sub objDGroupManager_ErrorHandler(ByVal sError As String, ByVal nTextNumber As Short)
|
||||
EgtOutLog("ErrorHandler message:" & " " & sError & " " & "ErrorHandler number:" & " " & nTextNumber.ToString())
|
||||
End Sub
|
||||
|
||||
Private Sub _comboCncAxisChannel_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
|
||||
'Select Case _comboCncAxisChannel.SelectedItem.ToString()
|
||||
' Case "Channel 1"
|
||||
' objDGroupManager.AxisGroup = 0
|
||||
' Case "Channel 2"
|
||||
' objDGroupManager.AxisGroup = 1
|
||||
' Case Else
|
||||
'End Select
|
||||
End Sub
|
||||
|
||||
Private Sub objDGeneralFunction_VariableWritten(ByVal errorCode As Short)
|
||||
If errorCode <> 0 Then
|
||||
MessageBox.Show("Error from VariableWritten:" & " " & errorCode.ToString())
|
||||
Else
|
||||
MessageBox.Show("VariableWritten successfully")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub objErrorHandler_ErrorOnCnc(ByVal cnc As Short, ByVal channel As Short, ByVal [set] As Short)
|
||||
'AplCncNumber.Add(cnc)
|
||||
'AplChannel.Add(channel)
|
||||
'AplSet.Add([set])
|
||||
End Sub
|
||||
|
||||
Private Sub objErrorHandler_ErrorOnOtherChannel(ByVal status As Short)
|
||||
'AplStatus = status
|
||||
End Sub
|
||||
|
||||
Private Sub objErrorHandler_Exception(ByVal status As Short)
|
||||
'ExceptStatus = status
|
||||
End Sub
|
||||
|
||||
Private Sub objErrorHandler_ErrorFromActiveCnc2(ByVal CncNumber As Short, ByVal numberOfError As Short, ByVal ErrorTyp As Object, ByVal ErrorIndex As Object, ByVal ErrorNumber As Object, ByVal ErrorLine As Object, ByVal ErrorMessage As Object, ByVal ErrorAdditional As Object)
|
||||
_ReadFXMessages.Clear()
|
||||
Dim AplCnCNumber As Short = CncNumber
|
||||
Dim AplnumberofError As Short = numberOfError
|
||||
Dim AplErrorType As Object() = CType(ErrorTyp, Object())
|
||||
Dim AplErrorIndex As Object() = CType(ErrorIndex, Object())
|
||||
Dim AplErrorNumber As Object() = CType(ErrorNumber, Object())
|
||||
Dim AplErrorLine As Object() = CType(ErrorLine, Object())
|
||||
Dim AplErrorMessage As Object() = CType(ErrorMessage, Object())
|
||||
Dim AplErrorAdditional As Object() = CType(ErrorAdditional, Object())
|
||||
|
||||
For index As Integer = 0 To numberOfError - 1
|
||||
_ReadFXMessages.Add(New ReadMessages(AplCnCNumber.ToString(), AplnumberofError.ToString(), AplErrorType(index).ToString(), AplErrorIndex(index).ToString(), AplErrorNumber(index).ToString(), AplErrorLine(index).ToString(), AplErrorMessage(index).ToString(), AplErrorAdditional(index).ToString()))
|
||||
Next
|
||||
|
||||
'Timers(TimerStartCounter).Interval = 100
|
||||
'AddHandler Timers(TimerStartCounter).Elapsed, New System.Timers.ElapsedEventHandler(timer1_Elapsed)
|
||||
'Timers(TimerStartCounter).Start()
|
||||
'TimerStartCounter += 1
|
||||
'Debug.WriteLine("Timer Started")
|
||||
'Debug.WriteLine(DateTime.Now)
|
||||
End Sub
|
||||
|
||||
#Region "PLC Variables"
|
||||
|
||||
Private Sub objDPlcVariables_ReadVariablesChanged(ByVal index As Object, ByVal value As Object)
|
||||
Dim _ObjIndex As Object() = CType(index, Object())
|
||||
Dim _ObjValue As Object() = CType(value, Object())
|
||||
Dim index_1 As Integer = 0
|
||||
|
||||
For Each PlcVarIndex As Object In _ObjIndex
|
||||
Dim indexIn As Integer = Integer.Parse(PlcVarIndex.ToString())
|
||||
m_ReadingVars(indexIn).SetValue(_ObjValue(index_1).ToString())
|
||||
index_1 += 1
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Private Sub objDPlcVariables_ReadOnceVariablesChanged(ByVal lHandle As Integer, ByVal value As Object)
|
||||
'Dim _ObjValue As Object() = CType(value, Object())
|
||||
|
||||
'If lHandle = 10 Then
|
||||
|
||||
' For i As Integer = 0 To _ObjValue.Length - 1
|
||||
' _ReadPlcVariableOnetime(i).Invoke(CType(Function()
|
||||
' _ReadPlcVariableOnetime(i).Text = _ObjValue(i).ToString()
|
||||
' End Function, MethodInvoker))
|
||||
' Next
|
||||
'End If
|
||||
End Sub
|
||||
|
||||
Private Sub objDPlcVariables_VariablesWritten2(ByVal lHandle As Integer, ByVal errorCode As Integer)
|
||||
Dim bOk As Boolean = (errorCode <> 0)
|
||||
m_ResultCallbackDlg(CommandTypes.WRITE, If(bOk, CommandStates.OK, CommandStates.ERROR_), ResultTypes.RESULT, If(bOk, "", "Error VariablesWritten2 :" & " " & errorCode.ToString()))
|
||||
End Sub
|
||||
|
||||
#End Region ' PLC Variables
|
||||
|
||||
#Region "ReadELS"
|
||||
|
||||
Private Sub objDReadELS_ValueChanged2(ByVal nHandle As Integer, ByVal dValue As Double, ByVal nerrorCode As Short)
|
||||
If nHandle < 1 OrElse nHandle > m_ReadingVars.Count - 1 Then Return
|
||||
If nerrorCode <> 0 Then EgtOutLog(" Error in Validchanged2 : " & nerrorCode & " Handle : " & nHandle)
|
||||
|
||||
Try
|
||||
m_ReadingVars(nHandle).SetValue(dValue.ToString("F04"))
|
||||
Catch Ex As Exception
|
||||
EgtOutLog(Ex.Message)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub objDReadELS_ValueChanged3(ByVal nHandle As Integer, ByVal value As Object, ByVal DataType As Short, ByVal Writable As Short, ByVal nerrorCode As Short)
|
||||
If nHandle < 1 OrElse nHandle > m_ReadingVars.Count - 1 Then
|
||||
EgtOutLog(" Invalid handle in Validchanged3 : " & nHandle)
|
||||
Return
|
||||
End If
|
||||
|
||||
If nerrorCode <> 0 Then EgtOutLog(" Error in Validchanged3 : " & nerrorCode & " Handle : " & nHandle)
|
||||
Dim sValue As String
|
||||
|
||||
Try
|
||||
|
||||
Select Case DataType
|
||||
Case 0
|
||||
sValue = (CSByte(value)).ToString()
|
||||
Case 1
|
||||
sValue = (CByte(value)).ToString()
|
||||
Case 2
|
||||
sValue = (CType(value, Int16)).ToString()
|
||||
Case 3
|
||||
sValue = (CType(value, UInt16)).ToString()
|
||||
Case 4
|
||||
sValue = (CType(value, Int32)).ToString()
|
||||
Case 5
|
||||
sValue = (CType(value, UInt32)).ToString()
|
||||
Case 6
|
||||
sValue = (CDbl(value)).ToString()
|
||||
Case 7
|
||||
sValue = (CBool(value)).ToString()
|
||||
Case 8
|
||||
sValue = (CBool(value)).ToString()
|
||||
Case 9
|
||||
sValue = (CBool(value)).ToString()
|
||||
Case 10
|
||||
sValue = (CType(value, Int64)).ToString()
|
||||
Case 11
|
||||
sValue = (CType(value, UInt32)).ToString()
|
||||
Case -1
|
||||
sValue = value.ToString()
|
||||
Case Else
|
||||
sValue = String.Empty
|
||||
EgtOutLog("objDReadELS_ValueChanged3() : Unknown Datatype !")
|
||||
End Select
|
||||
|
||||
m_ReadingVars(nHandle).SetValue(sValue)
|
||||
|
||||
'_ELS(nHandle - 1, 1).Text = sValue
|
||||
'_ELS(nHandle - 1, 2).Text = (CType(DataType, eDatatype)).ToString()
|
||||
'_ELS(nHandle - 1, 3).Text = If(Writable = 0, "No", If(Writable = 1, "Yes", Writable.ToString()))
|
||||
Catch Ex As Exception
|
||||
EgtOutLog("objDReadELS_ValueChanged3 " & Ex.Message & " Handle : " + nHandle)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub objDReadELS_ValueChanged(ByVal nHandle As Short, ByVal dValue As Double, ByVal nerrorCode As Short)
|
||||
'Throw New NotImplementedException()
|
||||
End Sub
|
||||
|
||||
#End Region ' ReadELS
|
||||
|
||||
#Region "File transfer"
|
||||
|
||||
Private Sub objDFileTransfer_Completed(ByVal lHandle As Integer)
|
||||
If lHandle = 10 OrElse lHandle = 20 Then
|
||||
EgtOutLog("Up- or Download successful completed:" & " " & lHandle.ToString())
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub objDFileTransfer_TransferStarted(ByVal lHandle As Integer)
|
||||
EgtOutLog("Transfer has been started !")
|
||||
End Sub
|
||||
|
||||
Private Sub objDFileTransfer_Failed(ByVal lHandle As Integer, ByVal nSeq As Short, ByVal nReason As Short)
|
||||
EgtOutLog("Sequence:" & " " & nSeq.ToString() & " " & "Reason:" & " " & nReason.ToString())
|
||||
End Sub
|
||||
|
||||
Private Sub objDFileTransfer_BytesTransfered(ByVal lHandle As Integer, ByVal lBytes As Integer)
|
||||
m_BytesTransferedCounter += lBytes
|
||||
End Sub
|
||||
|
||||
#End Region ' File transfer
|
||||
|
||||
#Region "Position"
|
||||
|
||||
Private Sub objDPosition_PositionChanged(ByVal vtArrayIndex As Object, ByVal vtArrayValues As Object)
|
||||
Dim _indexArray As Object() = CType(vtArrayIndex, Object())
|
||||
Dim _valueArray As Object() = CType(vtArrayValues, Object())
|
||||
|
||||
For _index As Integer = 0 To _indexArray.Length - 1
|
||||
|
||||
If m_IsFlexiumPlus = True Then
|
||||
Dim _index1 As Int16 = CType(_indexArray.GetValue(_index), Int16)
|
||||
Dim _axisPosValue As Double = CType(_valueArray.GetValue(_index), Double)
|
||||
Dim _axisRefPosValue As Double = CType(_axisPosValue, Double) / m_LinearAxisPrecision
|
||||
m_AxisCoordinatesCallbackDlg(_axisPosValue, _index1)
|
||||
Else
|
||||
Dim _index1 As Int16 = CType(_indexArray.GetValue(_index), Int16)
|
||||
Dim _axisPosValue As Int32 = CType(_valueArray.GetValue(_index), Int32)
|
||||
Dim _axisRefPosValue As Single = CSng(_axisPosValue) / m_LinearAxisPrecision
|
||||
m_AxisCoordinatesCallbackDlg(_axisPosValue, _index1)
|
||||
End If
|
||||
|
||||
Next
|
||||
End Sub
|
||||
|
||||
#End Region ' Position
|
||||
|
||||
#Region "MDI"
|
||||
|
||||
Private Sub objDMdiCommand_CommandWritten(ByVal retVal As Short)
|
||||
If retVal <> 0 Then
|
||||
EgtOutLog("Error CommandWritten :" & " " & retVal.ToString())
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' MDI
|
||||
|
||||
#Region "Variables"
|
||||
|
||||
Private Sub objDVariables_VariableWritten2(ByVal lHandle As Integer, ByVal errorCode As Short)
|
||||
If lHandle <> 2 OrElse errorCode <> 0 Then
|
||||
EgtOutLog(" Error on objDVariables_VariableWritten2 : handle " & lHandle.ToString() & " errorCode : " & errorCode.ToString())
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub objDVariables_VariableWritten(ByVal errorCode As Short)
|
||||
If errorCode <> 0 Then
|
||||
EgtOutLog(" Error on objDVariables_VariableWritten errorCode : " & errorCode.ToString())
|
||||
End If
|
||||
End Sub
|
||||
|
||||
'Private Sub objDVariables_ValueChanged(ByVal vtArrayIndex As Object, ByVal vtArrayValues As Object)
|
||||
' Dim AplArrayIndex As Object() = CType(vtArrayIndex, Object())
|
||||
' Dim AplArrayValue As Object() = CType(vtArrayValues, Object())
|
||||
' Dim Idx As Int16
|
||||
' If IsFlexiumPlus Then Return
|
||||
|
||||
' For index As Integer = 0 To AplArrayIndex.Length - 1
|
||||
|
||||
' Try
|
||||
' Idx = CType(AplArrayIndex.GetValue(index), Int16)
|
||||
' If Idx > 8 Then Exit For
|
||||
' _Variables(Idx, 1).Invoke(CType(Function()
|
||||
' _Variables(Idx, 1).Text = (CDbl(AplArrayValue.GetValue(index))).ToString()
|
||||
' End Function, MethodInvoker))
|
||||
' Catch Ex As Exception
|
||||
' DisplayMessage(Ex.Message)
|
||||
' End Try
|
||||
' Next
|
||||
'End Sub
|
||||
|
||||
'Private Sub objDVariables_ValueChanged2(ByVal vtArrayIndex As Object, ByVal vtArrayValues As Object)
|
||||
' Dim AplArrayIndex As Object() = CType(vtArrayIndex, Object())
|
||||
' Dim AplArrayValue As Object() = CType(vtArrayValues, Object())
|
||||
' Dim index, IdxVar, IdxData, Idx As Int16, Datatype As Int16 = -1
|
||||
' Dim _objValue As Object = Nothing
|
||||
' Dim sValue As String
|
||||
|
||||
' For index = 0 To AplArrayIndex.Length - 1
|
||||
|
||||
' Try
|
||||
' Idx = CType(AplArrayIndex.GetValue(index), Int16)
|
||||
' IdxVar = CShort((Idx / 10))
|
||||
' IdxData = CShort((Idx Mod 10))
|
||||
' If IdxData < 0 OrElse IdxData > 2 OrElse IdxVar > 8 Then Continue For
|
||||
|
||||
' Select Case IdxData
|
||||
' Case 0
|
||||
' _objValue = AplArrayValue.GetValue(index)
|
||||
' Case 1
|
||||
' Me.Invoke(CType(Function()
|
||||
' _Variables(IdxVar, 2).Tag = CShort(AplArrayValue.GetValue(index))
|
||||
' _Variables(IdxVar, 2).Text = (CType(AplArrayValue.GetValue(index), eDatatype)).ToString()
|
||||
' End Function, MethodInvoker))
|
||||
' Case 2
|
||||
' Me.Invoke(CType(Function()
|
||||
' _Variables(IdxVar, 3).Text = If((CShort(AplArrayValue.GetValue(index))) = 0, "No", If((CShort(AplArrayValue.GetValue(index))) = 1, "Yes", (CShort(AplArrayValue.GetValue(index))).ToString()))
|
||||
' End Function, MethodInvoker))
|
||||
' End Select
|
||||
|
||||
' Me.Invoke(CType(Function()
|
||||
' Datatype = If(_Variables(IdxVar, 2).Tag IsNot Nothing, CShort(_Variables(IdxVar, 2).Tag), CShort(-2))
|
||||
' End Function, MethodInvoker))
|
||||
|
||||
' If IdxData = 1 OrElse IdxData = 0 AndAlso Datatype <> -1 Then
|
||||
|
||||
' Select Case Datatype
|
||||
' Case 0
|
||||
' sValue = (CSByte(_objValue)).ToString()
|
||||
' Case 1
|
||||
' sValue = (CByte(_objValue)).ToString()
|
||||
' Case 2
|
||||
' sValue = (CType(_objValue, Int16)).ToString()
|
||||
' Case 3
|
||||
' sValue = (CType(_objValue, UInt16)).ToString()
|
||||
' Case 4
|
||||
' sValue = (CType(_objValue, Int32)).ToString()
|
||||
' Case 5
|
||||
' sValue = (CType(_objValue, UInt32)).ToString()
|
||||
' Case 6
|
||||
' sValue = (CDbl(_objValue)).ToString()
|
||||
' Case 7
|
||||
' sValue = (CBool(_objValue)).ToString()
|
||||
' Case 8
|
||||
' sValue = (CBool(_objValue)).ToString()
|
||||
' Case 9
|
||||
' sValue = (CBool(_objValue)).ToString()
|
||||
' Case 10
|
||||
' sValue = (CType(_objValue, Int64)).ToString()
|
||||
' Case 11
|
||||
' sValue = (CType(_objValue, UInt32)).ToString()
|
||||
' Case -1
|
||||
' sValue = (CType(_objValue, Int32)).ToString()
|
||||
' Case Else
|
||||
' sValue = String.Empty
|
||||
' DisplayMessage("objDVariables_ValueChanged2() : Unknown Datatype !")
|
||||
' End Select
|
||||
|
||||
' Me.Invoke(CType(Function()
|
||||
' _Variables(IdxVar, 1).Text = sValue
|
||||
' End Function, MethodInvoker))
|
||||
' End If
|
||||
|
||||
' Catch Ex As Exception
|
||||
' DisplayMessage("objDVariables_ValueChanged2 " & Ex.Message & " Index : " + index)
|
||||
' End Try
|
||||
' Next
|
||||
'End Sub
|
||||
|
||||
#End Region ' Variables
|
||||
|
||||
#Region "CNCMode"
|
||||
|
||||
Private Sub objDCncMode_ValueChanged(ByVal mode As Short, ByVal preselected As Short)
|
||||
|
||||
m_OpStateCallbackDlg(mode)
|
||||
|
||||
'Select Case mode
|
||||
' Case 0
|
||||
' CncModeSelect = "Auto"
|
||||
' Case 1
|
||||
' CncModeSelect = "Single"
|
||||
' Case 2
|
||||
' CncModeSelect = "MDI"
|
||||
' Case 8
|
||||
' CncModeSelect = "Home"
|
||||
' Case Else
|
||||
'End Select
|
||||
|
||||
'Select Case preselected
|
||||
' Case 0
|
||||
' CncModePreselect = "Auto"
|
||||
' Case 1
|
||||
' CncModePreselect = "Single"
|
||||
' Case 2
|
||||
' CncModePreselect = "MDI"
|
||||
' Case 8
|
||||
' CncModePreselect = "Home"
|
||||
' Case Else
|
||||
'End Select
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region ' CNCMode
|
||||
|
||||
#End Region ' EVENTS
|
||||
|
||||
End Class
|
||||
|
||||
Public Class ReadMessages
|
||||
|
||||
Public CMsgCncNumber As String
|
||||
Public CMsgNumberOfError As String
|
||||
Public CMsgErrorType As String
|
||||
Public CMsgErrorIndex As String
|
||||
Public CMsgErrorNumber As String
|
||||
Public CMsgErrorLine As String
|
||||
Public CMsgErrorMessage As String
|
||||
Public CMsgErrorAdditional As String
|
||||
|
||||
Public Sub New(ByVal MsgCncNumber As String, ByVal MsgNumberofError As String, ByVal MsgErrorType As String, ByVal MsgErrorIndex As String, ByVal MsgErrorNumber As String, ByVal MsgErrorLine As String, ByVal MsgErrorMessage As String, ByVal MsgErrorAdditional As String)
|
||||
CMsgCncNumber = MsgCncNumber
|
||||
CMsgNumberOfError = MsgNumberofError
|
||||
CMsgErrorType = MsgErrorType
|
||||
CMsgErrorIndex = MsgErrorIndex
|
||||
CMsgErrorNumber = MsgErrorNumber
|
||||
CMsgErrorLine = MsgErrorLine
|
||||
CMsgErrorMessage = MsgErrorMessage
|
||||
CMsgErrorAdditional = MsgErrorAdditional
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,333 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Remoting.Channels;
|
||||
using System.Runtime.Remoting.Channels.Ipc;
|
||||
using System.Security.Permissions;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
class TPAComm
|
||||
{
|
||||
#region Fields
|
||||
//VM
|
||||
private MainWindowVM _MainWindowVM;
|
||||
//Axes values
|
||||
private double[] _axesVal = new double[24];
|
||||
//Active command
|
||||
private int _cmdActive = 0;
|
||||
//Current machine operative state
|
||||
private ISOCNC.Remoting.MachineOperatingState _opState = ISOCNC.Remoting.MachineOperatingState.Unspecified;
|
||||
#region Remoting - Client
|
||||
// Instance of the remote server object.
|
||||
private ISOCNC.Remoting_Server _remObject;
|
||||
public ISOCNC.Remoting_Server remObject
|
||||
{
|
||||
get => _remObject;
|
||||
}
|
||||
// Server IPC URI address
|
||||
private string serverURI = "ipc://localhost:9090/IRemoteObject.rem";
|
||||
//Remoting events proxy manager object
|
||||
ISOCNC.Remoting.EventProxyManager eventProxy;
|
||||
#endregion Remoting - Client
|
||||
//RPC
|
||||
private int _rpc;
|
||||
//List Info
|
||||
private int _prgCount;
|
||||
private string _prgAtIndex;
|
||||
private string[] _prgList;
|
||||
private bool _prgListUpdated;
|
||||
|
||||
//Alarms
|
||||
private string _errCycle;
|
||||
private string _iso;
|
||||
private string _message;
|
||||
private string _errSystem;
|
||||
#endregion Fields
|
||||
|
||||
#region Constructor
|
||||
[SecurityPermission(SecurityAction.Demand)]
|
||||
public TPAComm(MainWindowVM MainWindowVM)
|
||||
{
|
||||
//imposto VM
|
||||
_MainWindowVM = MainWindowVM;
|
||||
//Set up for remoting events properly
|
||||
System.Collections.Hashtable properties = new System.Collections.Hashtable();
|
||||
properties["name"] = "remotingClient";
|
||||
properties["priority"] = "20";
|
||||
properties["portName"] = "67";
|
||||
BinaryClientFormatterSinkProvider clientProv = new
|
||||
BinaryClientFormatterSinkProvider();
|
||||
BinaryServerFormatterSinkProvider serverProv = new
|
||||
BinaryServerFormatterSinkProvider();
|
||||
serverProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
|
||||
//// Create the IPC channel.
|
||||
IpcChannel channel = new IpcChannel(properties, clientProv, serverProv);
|
||||
// Register the channel.
|
||||
System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(channel, false);
|
||||
// Register as client for remote object.
|
||||
System.Runtime.Remoting.WellKnownClientTypeEntry remoteType =
|
||||
new System.Runtime.Remoting.WellKnownClientTypeEntry(typeof(ISOCNC.Remoting_Server), serverURI);
|
||||
System.Runtime.Remoting.RemotingConfiguration.RegisterWellKnownClientType(remoteType);
|
||||
// Create a message sink.
|
||||
string objectUri;
|
||||
System.Runtime.Remoting.Messaging.IMessageSink messageSink =
|
||||
channel.CreateMessageSink("ipc://localhost:9090/IRemoteObject.rem", null, out objectUri);
|
||||
Console.WriteLine("The URI of the message sink is {0}.", objectUri);
|
||||
if (messageSink != null)
|
||||
{
|
||||
Console.WriteLine("The type of the message sink is {0}.",
|
||||
messageSink.GetType().ToString());
|
||||
}
|
||||
//Event Proxy management
|
||||
eventProxy = new ISOCNC.Remoting.EventProxyManager();
|
||||
eventProxy.CommandExecuted += new
|
||||
ISOCNC.Remoting.CommandExecutedEventHandler(RemoteObject_CommandExecuted);
|
||||
eventProxy.ServerError += new
|
||||
ISOCNC.Remoting.ServerErrorEventHandler(RemoteObject_ServerError);
|
||||
eventProxy.AxisCoordinatesUpdate += new
|
||||
ISOCNC.Remoting.AxesCoordinatesUpdateEventHandler(RemoteObject_AxisCoordinatesUpdate);
|
||||
eventProxy.OpStateUpdate += new
|
||||
ISOCNC.Remoting.OpStateUpdateEventHandler(RemoteObject_OpStateUpdate);
|
||||
eventProxy.AlarmNotification += new
|
||||
ISOCNC.Remoting.AlarmNotificationEventHandler(RemoteObject_AlarmNotification);
|
||||
eventProxy.ListInfoResponse += new
|
||||
ISOCNC.Remoting.ListInfoEventHandler(RemoteObject_ListInfoResponse);
|
||||
eventProxy.RPCUpdate += new
|
||||
ISOCNC.Remoting.RPCUpdateEventHandler(RemoteObject_RPCUpdate);
|
||||
eventProxy.VariableCommandExecuted += new
|
||||
ISOCNC.Remoting.VariableCommandExecutedEventHandler(RemoteObject_VariableCommandExecuted);
|
||||
eventProxy.TickUpdate += new
|
||||
ISOCNC.Remoting.TickUpdateEventHandler(RemoteObject_TickUpdate);
|
||||
//Connection to Remote Server instance
|
||||
_remObject = (ISOCNC.Remoting_Server)Activator.GetObject(typeof(ISOCNC.Remoting_Server), serverURI);
|
||||
try
|
||||
{
|
||||
//Event management
|
||||
_remObject.CommandExecuted += new
|
||||
ISOCNC.Remoting.CommandExecutedEventHandler(eventProxy.LocallyHandleCommandExecuted);
|
||||
_remObject.ServerError += new
|
||||
ISOCNC.Remoting.ServerErrorEventHandler(eventProxy.LocallyHandleServerError);
|
||||
_remObject.AxisCoordinatesUpdate += new
|
||||
ISOCNC.Remoting.AxesCoordinatesUpdateEventHandler(eventProxy.LocallyHandleAxisCoordinatesUpdate);
|
||||
_remObject.OpStateUpdate += new
|
||||
ISOCNC.Remoting.OpStateUpdateEventHandler(eventProxy.LocallyHandleOpStateUpdate);
|
||||
_remObject.AlarmNotification += new
|
||||
ISOCNC.Remoting.AlarmNotificationEventHandler(eventProxy.LocallyHandleAlarmNotification);
|
||||
_remObject.ListInfoResponse += new
|
||||
ISOCNC.Remoting.ListInfoEventHandler(eventProxy.LocallyHandleListInfo);
|
||||
_remObject.RPCUpdate += new
|
||||
ISOCNC.Remoting.RPCUpdateEventHandler(eventProxy.LocallyHandleRPCUpdate);
|
||||
_remObject.VariableCommandExecuted += new
|
||||
ISOCNC.Remoting.VariableCommandExecutedEventHandler(eventProxy.LocallyHandleVariableCommandExecuted);
|
||||
//_remObject.TickUpdate += new
|
||||
//ISOCNC.Remoting.TickUpdateEventHandler(eventProxy.LocallyHandleTickUpdate)
|
||||
}
|
||||
catch (System.Runtime.Remoting.RemotingException ex)
|
||||
{
|
||||
MessageBoxResult dR = MessageBox.Show(ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion Constructor
|
||||
|
||||
#region Event management
|
||||
#region Remoting obj events
|
||||
/// <summary>
|
||||
/// Notify operative state change
|
||||
/// </summary>
|
||||
/// <param name="newOpState">New operative state</param>
|
||||
void RemoteObject_OpStateUpdate(ISOCNC.Remoting.MachineOperatingState newOpState)
|
||||
{
|
||||
_opState = newOpState;
|
||||
_MainWindowVM.SelOPState = _opState;
|
||||
if (_MainWindowVM.SelOPState == ISOCNC.Remoting.MachineOperatingState.Pending)
|
||||
remObject.RemoveAllProgramsFromList();
|
||||
}
|
||||
/// <summary>
|
||||
/// Notify the execution of a command – server side
|
||||
/// </summary>
|
||||
/// <param name="executedCommand">Command executed index</param>
|
||||
void RemoteObject_CommandExecuted(int executedCommand)
|
||||
{
|
||||
switch (executedCommand)
|
||||
{
|
||||
case (int)ISOCNC.Remoting.Commands.NoCommand:
|
||||
break;
|
||||
case (int)ISOCNC.Remoting.Commands.End:
|
||||
break;
|
||||
case (int)ISOCNC.Remoting.Commands.Error:
|
||||
break;
|
||||
case (int)ISOCNC.Remoting.Commands.MDI_End:
|
||||
break;
|
||||
case (int)ISOCNC.Remoting.Commands.MDI_Start:
|
||||
break;
|
||||
case (int)ISOCNC.Remoting.Commands.MDI_Stop:
|
||||
break;
|
||||
case (int)ISOCNC.Remoting.Commands.SetPoint:
|
||||
break;
|
||||
case (int)ISOCNC.Remoting.Commands.Start:
|
||||
break;
|
||||
case (int)ISOCNC.Remoting.Commands.Step:
|
||||
break;
|
||||
case (int)ISOCNC.Remoting.Commands.Stop:
|
||||
break;
|
||||
case (int)ISOCNC.Remoting.Commands.Start_Program_Soft:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
//Update internal active executed command field
|
||||
_cmdActive = (int)executedCommand;
|
||||
}
|
||||
/// <summary>
|
||||
/// Notify an error occured during the execution of a command – server side
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="seEA">Error</param>
|
||||
void RemoteObject_ServerError(object sender, ISOCNC.Remoting.ServerErrorEventArgs seEA)
|
||||
{
|
||||
MessageBoxResult dr = MessageBox.Show("Server Error: " + seEA.Error);
|
||||
}
|
||||
/// <summary>
|
||||
/// Notify the update of an axis coordinate
|
||||
/// </summary>
|
||||
/// <param name="axisValue">New axis value</param>
|
||||
/// <param name="axisIndex">Axis index</param>
|
||||
void RemoteObject_AxisCoordinatesUpdate(double axisValue, int axisIndex)
|
||||
{
|
||||
_axesVal[axisIndex] = axisValue;
|
||||
_MainWindowVM.AxisList[axisIndex].Value = axisValue;
|
||||
_MainWindowVM.AxisList[axisIndex].NotifyPropertyChanged("Value");
|
||||
}
|
||||
/// <summary>
|
||||
/// Notify the actual ISO line processed
|
||||
/// </summary>
|
||||
/// <param name="newRPC">Actual ISO Line</param>
|
||||
void RemoteObject_RPCUpdate(uint newRPC)
|
||||
{
|
||||
_rpc = (int)newRPC;
|
||||
}
|
||||
/// <summary>
|
||||
/// Receive program list information
|
||||
/// </summary>
|
||||
/// <param name="prgCount">Program count</param>
|
||||
/// <param name="prgAtIndex">Program at index </param>
|
||||
/// <param name="prgList">Program List</param>
|
||||
void RemoteObject_ListInfoResponse(int prgCount, string prgAtIndex, string[] prgList)
|
||||
{
|
||||
// Program count
|
||||
if (prgCount >= 0)
|
||||
{
|
||||
_prgCount = prgCount;
|
||||
}
|
||||
//Program at index
|
||||
if (prgAtIndex != "")
|
||||
{
|
||||
_prgAtIndex = prgAtIndex;
|
||||
}
|
||||
//Program List
|
||||
if (prgList != null && prgList.Length > 0)
|
||||
{
|
||||
_prgList = prgList;
|
||||
_prgListUpdated = true;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Notify the adding or removal of an alarm
|
||||
/// </summary>
|
||||
/// <param name="alarmOperation">Operation: Add-Remove</param>
|
||||
/// <param name="alarmType">Type: Cycle, Message, System, ISO</param>
|
||||
/// <param name="alarmMessage">Alarm</param>
|
||||
/// <param name="alarmCode">Alarm code</param>
|
||||
/// <param name="alarmDateTime">Data</param>
|
||||
void RemoteObject_AlarmNotification(int alarmOperation, int alarmType, string alarmMessage, string alarmCode, string alarmDateTime)
|
||||
{
|
||||
switch (alarmType)
|
||||
{
|
||||
case (int)ISOCNC.Remoting.AlarmType.Cycle:
|
||||
if (alarmOperation == (int)ISOCNC.Remoting.AlarmOperation.Addition)
|
||||
_errCycle = alarmCode + ": " + alarmMessage;
|
||||
else
|
||||
{
|
||||
//Removal
|
||||
if (_errCycle != null && _errCycle != "")
|
||||
{
|
||||
if (_errCycle.Split(':')[0] == alarmCode)
|
||||
_errCycle = "";
|
||||
}
|
||||
}
|
||||
_MainWindowVM.UpdateErrCycle(_errCycle);
|
||||
break;
|
||||
case (int)ISOCNC.Remoting.AlarmType.ISO:
|
||||
if (alarmOperation == (int)ISOCNC.Remoting.AlarmOperation.Addition)
|
||||
_iso = alarmCode + ": " + alarmMessage;
|
||||
else
|
||||
{
|
||||
// Removal
|
||||
if (_iso != null && _iso != "")
|
||||
{
|
||||
if (_iso.Split(':')[0] == alarmCode)
|
||||
_iso = "";
|
||||
}
|
||||
}
|
||||
_MainWindowVM.UpdateIso(_iso);
|
||||
break;
|
||||
case (int)ISOCNC.Remoting.AlarmType.Message:
|
||||
if (alarmOperation == (int)ISOCNC.Remoting.AlarmOperation.Addition)
|
||||
_message = alarmCode + ": " + alarmMessage;
|
||||
else
|
||||
{
|
||||
// Removal
|
||||
if (_message != null && _message != "")
|
||||
{
|
||||
if (_message.Split(':')[0] == alarmCode)
|
||||
_message = "";
|
||||
}
|
||||
}
|
||||
_MainWindowVM.UpdateMessage(_message);
|
||||
break;
|
||||
case (int)ISOCNC.Remoting.AlarmType.None:
|
||||
break;
|
||||
case (int)ISOCNC.Remoting.AlarmType.System:
|
||||
if (alarmOperation == (int)ISOCNC.Remoting.AlarmOperation.Addition)
|
||||
_errSystem = alarmCode + ": " + alarmMessage;
|
||||
else
|
||||
{
|
||||
// Removal
|
||||
if (_errSystem != null && _errSystem != "")
|
||||
{
|
||||
if (_errSystem.Split(':')[0] == alarmCode)
|
||||
_errSystem = "";
|
||||
}
|
||||
}
|
||||
_MainWindowVM.UpdateErrSystem(_errSystem);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Notify info on the executed command
|
||||
/// </summary>
|
||||
/// <param name="executedCommand">Indice di comando eseguito</param>
|
||||
/// <param name="commandExecutedCorrectly">True se il comando è stato eseguito correttamente</param>
|
||||
/// <param name="varName">Nome variabile ovvero percorso in Albatros della variabile</param>
|
||||
/// <param name="varValue">Valore variabile</param>
|
||||
/// <param name="varType">Tipologia variabile</param>
|
||||
void RemoteObject_VariableCommandExecuted(int executedCommand, bool commandExecutedCorrectly, string varName, string varValue, int varType)
|
||||
{
|
||||
_MainWindowVM.SetVarValue(varValue);
|
||||
}
|
||||
/// <summary>
|
||||
/// Notify the server alive
|
||||
/// </summary>
|
||||
/// <param name="newTick">Tick corrente per verifica server alive</param>
|
||||
void RemoteObject_TickUpdate(ulong newTick)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion Event management
|
||||
#endregion Remoting obj events
|
||||
}
|
||||
@@ -0,0 +1,243 @@
|
||||
Imports System
|
||||
Imports System.Collections.Generic
|
||||
Imports System.Linq
|
||||
Imports System.Runtime.Remoting.Channels
|
||||
Imports System.Runtime.Remoting.Channels.Ipc
|
||||
Imports System.Security.Permissions
|
||||
Imports System.Text
|
||||
Imports System.Threading.Tasks
|
||||
Imports System.Windows
|
||||
Imports ISOCNC.Remoting
|
||||
|
||||
Public Class TPAComm
|
||||
|
||||
' creo classe di gestione variabili
|
||||
Private m_RWVariableManager As RWVariableManager
|
||||
Friend ReadOnly Property RWVariableManager As RWVariableManager
|
||||
Get
|
||||
Return m_RWVariableManager
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_MachManaging As MachManaging
|
||||
Friend ReadOnly Property MachManaging As MachManaging
|
||||
Get
|
||||
Return m_MachManaging
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private _cmdActive As Integer = 0
|
||||
|
||||
Private m_opState As ISOCNC.Remoting.MachineOperatingState = ISOCNC.Remoting.MachineOperatingState.Unspecified
|
||||
Public ReadOnly Property opState As ISOCNC.Remoting.MachineOperatingState
|
||||
Get
|
||||
Return m_opState
|
||||
End Get
|
||||
End Property
|
||||
Private _remObject As ISOCNC.Remoting_Server
|
||||
|
||||
Public ReadOnly Property remObject As ISOCNC.Remoting_Server
|
||||
Get
|
||||
Return _remObject
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private serverURI As String = "ipc://localhost:9090/IRemoteObject.rem"
|
||||
Private m_eventProxy As ISOCNC.Remoting.EventProxyManager
|
||||
Friend ReadOnly Property eventProxy As ISOCNC.Remoting.EventProxyManager
|
||||
Get
|
||||
Return m_eventProxy
|
||||
End Get
|
||||
End Property
|
||||
Private _rpc As Integer
|
||||
Private _prgCount As Integer
|
||||
Private _prgAtIndex As String
|
||||
Private _prgList As String()
|
||||
Private _prgListUpdated As Boolean
|
||||
Private _errCycle As String
|
||||
Private _iso As String
|
||||
Private _message As String
|
||||
Private _errSystem As String
|
||||
|
||||
Private m_Proxy_CommandExecutedEventHandler As New CommandExecutedEventHandler(AddressOf RemoteObject_CommandExecuted)
|
||||
Private m_Proxy_ServerErrorEventHandler As New ServerErrorEventHandler(AddressOf RemoteObject_ServerError)
|
||||
Private m_Proxy_AxesCoordinatesUpdateEventHandler As New AxesCoordinatesUpdateEventHandler(AddressOf RemoteObject_AxisCoordinatesUpdate)
|
||||
Private m_Proxy_OpStateUpdateEventHandler As New OpStateUpdateEventHandler(AddressOf RemoteObject_OpStateUpdate)
|
||||
Private m_Proxy_AlarmNotificationEventHandler As New AlarmNotificationEventHandler(AddressOf RemoteObject_AlarmNotification)
|
||||
Private m_Proxy_ListInfoEventHandler As New ListInfoEventHandler(AddressOf RemoteObject_ListInfoResponse)
|
||||
Private m_Proxy_RPCUpdateEventHandler As New RPCUpdateEventHandler(AddressOf RemoteObject_RPCUpdate)
|
||||
Private m_Proxy_VariableCommandExecutedEventHandler As New VariableCommandExecutedEventHandler(AddressOf RemoteObject_VariableCommandExecuted)
|
||||
Private m_Proxy_TickUpdateEventHandler As New TickUpdateEventHandler(AddressOf RemoteObject_TickUpdate)
|
||||
Private m_Rem_CommandExecutedEventHandler As CommandExecutedEventHandler
|
||||
Private m_Rem_ServerErrorEventHandler As ServerErrorEventHandler
|
||||
Private m_Rem_AxesCoordinatesUpdateEventHandler As AxesCoordinatesUpdateEventHandler
|
||||
Private m_Rem_OpStateUpdateEventHandler As OpStateUpdateEventHandler
|
||||
Private m_Rem_AlarmNotificationEventHandler As AlarmNotificationEventHandler
|
||||
Private m_Rem_ListInfoEventHandler As ListInfoEventHandler
|
||||
Private m_Rem_RPCUpdateEventHandler As RPCUpdateEventHandler
|
||||
Private m_Rem_VariableCommandExecutedEventHandler As VariableCommandExecutedEventHandler
|
||||
|
||||
|
||||
<SecurityPermission(SecurityAction.Demand)>
|
||||
Public Sub New(MachManaging As MachManaging)
|
||||
m_MachManaging = MachManaging
|
||||
Dim properties As System.Collections.Hashtable = New System.Collections.Hashtable()
|
||||
properties("name") = "remotingClient"
|
||||
properties("priority") = "20"
|
||||
properties("portName") = "67"
|
||||
Dim clientProv As BinaryClientFormatterSinkProvider = New BinaryClientFormatterSinkProvider()
|
||||
Dim serverProv As BinaryServerFormatterSinkProvider = New BinaryServerFormatterSinkProvider()
|
||||
serverProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full
|
||||
Dim channel As IpcChannel = New IpcChannel(properties, clientProv, serverProv)
|
||||
System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(channel, False)
|
||||
Dim remoteType As System.Runtime.Remoting.WellKnownClientTypeEntry = New System.Runtime.Remoting.WellKnownClientTypeEntry(GetType(ISOCNC.Remoting_Server), serverURI)
|
||||
System.Runtime.Remoting.RemotingConfiguration.RegisterWellKnownClientType(remoteType)
|
||||
Dim objectUri As String
|
||||
Dim messageSink As System.Runtime.Remoting.Messaging.IMessageSink = channel.CreateMessageSink("ipc://localhost:9090/IRemoteObject.rem", Nothing, objectUri)
|
||||
Console.WriteLine("The URI of the message sink is {0}.", objectUri)
|
||||
|
||||
If messageSink IsNot Nothing Then
|
||||
Console.WriteLine("The type of the message sink is {0}.", messageSink.[GetType]().ToString())
|
||||
End If
|
||||
|
||||
m_eventProxy = New ISOCNC.Remoting.EventProxyManager()
|
||||
AddHandler m_eventProxy.CommandExecuted, m_Proxy_CommandExecutedEventHandler
|
||||
AddHandler m_eventProxy.ServerError, m_Proxy_ServerErrorEventHandler
|
||||
AddHandler m_eventProxy.AxisCoordinatesUpdate, m_Proxy_AxesCoordinatesUpdateEventHandler
|
||||
AddHandler m_eventProxy.OpStateUpdate, m_Proxy_OpStateUpdateEventHandler
|
||||
AddHandler m_eventProxy.AlarmNotification, m_Proxy_AlarmNotificationEventHandler
|
||||
AddHandler m_eventProxy.ListInfoResponse, m_Proxy_ListInfoEventHandler
|
||||
AddHandler m_eventProxy.RPCUpdate, m_Proxy_RPCUpdateEventHandler
|
||||
AddHandler m_eventProxy.VariableCommandExecuted, m_Proxy_VariableCommandExecutedEventHandler
|
||||
AddHandler m_eventProxy.TickUpdate, m_Proxy_TickUpdateEventHandler
|
||||
|
||||
_remObject = CType(Activator.GetObject(GetType(ISOCNC.Remoting_Server), serverURI), ISOCNC.Remoting_Server)
|
||||
Try
|
||||
m_Rem_CommandExecutedEventHandler = New CommandExecutedEventHandler(AddressOf m_eventProxy.LocallyHandleCommandExecuted)
|
||||
m_Rem_ServerErrorEventHandler = New ServerErrorEventHandler(AddressOf m_eventProxy.LocallyHandleServerError)
|
||||
m_Rem_AxesCoordinatesUpdateEventHandler = New AxesCoordinatesUpdateEventHandler(AddressOf m_eventProxy.LocallyHandleAxisCoordinatesUpdate)
|
||||
m_Rem_OpStateUpdateEventHandler = New OpStateUpdateEventHandler(AddressOf m_eventProxy.LocallyHandleOpStateUpdate)
|
||||
m_Rem_AlarmNotificationEventHandler = New AlarmNotificationEventHandler(AddressOf m_eventProxy.LocallyHandleAlarmNotification)
|
||||
m_Rem_ListInfoEventHandler = New ListInfoEventHandler(AddressOf m_eventProxy.LocallyHandleListInfo)
|
||||
m_Rem_RPCUpdateEventHandler = New RPCUpdateEventHandler(AddressOf m_eventProxy.LocallyHandleRPCUpdate)
|
||||
m_Rem_VariableCommandExecutedEventHandler = New VariableCommandExecutedEventHandler(AddressOf m_eventProxy.LocallyHandleVariableCommandExecuted)
|
||||
AddHandler _remObject.CommandExecuted, m_Rem_CommandExecutedEventHandler
|
||||
AddHandler _remObject.ServerError, m_Rem_ServerErrorEventHandler
|
||||
AddHandler _remObject.AxisCoordinatesUpdate, m_Rem_AxesCoordinatesUpdateEventHandler
|
||||
AddHandler _remObject.OpStateUpdate, m_Rem_OpStateUpdateEventHandler
|
||||
AddHandler _remObject.AlarmNotification, m_Rem_AlarmNotificationEventHandler
|
||||
AddHandler _remObject.ListInfoResponse, m_Rem_ListInfoEventHandler
|
||||
AddHandler _remObject.RPCUpdate, m_Rem_RPCUpdateEventHandler
|
||||
AddHandler _remObject.VariableCommandExecuted, m_Rem_VariableCommandExecutedEventHandler
|
||||
Catch ex As System.Runtime.Remoting.RemotingException
|
||||
Dim dR As MessageBoxResult = MessageBox.Show(ex.Message)
|
||||
End Try
|
||||
' creo classe che gestisce variabili
|
||||
m_RWVariableManager = RWVariableManager.CreateRWVariableManager(Me)
|
||||
End Sub
|
||||
|
||||
Friend Sub OnDispose()
|
||||
RemoveHandler _remObject.CommandExecuted, m_Rem_CommandExecutedEventHandler
|
||||
RemoveHandler _remObject.ServerError, m_Rem_ServerErrorEventHandler
|
||||
RemoveHandler _remObject.AxisCoordinatesUpdate, m_Rem_AxesCoordinatesUpdateEventHandler
|
||||
RemoveHandler _remObject.OpStateUpdate, m_Rem_OpStateUpdateEventHandler
|
||||
RemoveHandler _remObject.AlarmNotification, m_Rem_AlarmNotificationEventHandler
|
||||
RemoveHandler _remObject.ListInfoResponse, m_Rem_ListInfoEventHandler
|
||||
RemoveHandler _remObject.RPCUpdate, m_Rem_RPCUpdateEventHandler
|
||||
RemoveHandler _remObject.VariableCommandExecuted, m_Rem_VariableCommandExecutedEventHandler
|
||||
RemoveHandler m_eventProxy.CommandExecuted, m_Proxy_CommandExecutedEventHandler
|
||||
RemoveHandler m_eventProxy.ServerError, m_Proxy_ServerErrorEventHandler
|
||||
RemoveHandler m_eventProxy.AxisCoordinatesUpdate, m_Proxy_AxesCoordinatesUpdateEventHandler
|
||||
RemoveHandler m_eventProxy.OpStateUpdate, m_Proxy_OpStateUpdateEventHandler
|
||||
RemoveHandler m_eventProxy.AlarmNotification, m_Proxy_AlarmNotificationEventHandler
|
||||
RemoveHandler m_eventProxy.ListInfoResponse, m_Proxy_ListInfoEventHandler
|
||||
RemoveHandler m_eventProxy.RPCUpdate, m_Proxy_RPCUpdateEventHandler
|
||||
RemoveHandler m_eventProxy.VariableCommandExecuted, m_Proxy_VariableCommandExecutedEventHandler
|
||||
RemoveHandler m_eventProxy.TickUpdate, m_Proxy_TickUpdateEventHandler
|
||||
End Sub
|
||||
|
||||
Private Sub RemoteObject_OpStateUpdate(ByVal newOpState As ISOCNC.Remoting.MachineOperatingState)
|
||||
' resetto stato pending iniziale
|
||||
If Map.refMachManaging.StartPending AndAlso newOpState = MachineOperatingState.Pending Then
|
||||
MachManaging.ResetStartPending()
|
||||
End If
|
||||
m_opState = newOpState
|
||||
m_OpStateCallbackDlg(newOpState)
|
||||
End Sub
|
||||
|
||||
Private Sub RemoteObject_CommandExecuted(ByVal executedCommand As Integer)
|
||||
Select Case executedCommand
|
||||
Case CInt(ISOCNC.Remoting.Commands.NoCommand)
|
||||
Case CInt(ISOCNC.Remoting.Commands.[End])
|
||||
m_ResultCallbackDlg(CommandTypes.RESET, CommandStates.OK, ResultTypes.RESULT, "")
|
||||
Case CInt(ISOCNC.Remoting.Commands.[Error])
|
||||
m_ResultCallbackDlg(CommandTypes.ERROR_, CommandStates.ERROR_, ResultTypes.RESULT, "")
|
||||
Case CInt(ISOCNC.Remoting.Commands.MDI_End)
|
||||
Case CInt(ISOCNC.Remoting.Commands.MDI_Start)
|
||||
Case CInt(ISOCNC.Remoting.Commands.MDI_Stop)
|
||||
Case CInt(ISOCNC.Remoting.Commands.SetPoint)
|
||||
m_ResultCallbackDlg(CommandTypes.SETPOINT, CommandStates.OK, ResultTypes.RESULT, "")
|
||||
Case CInt(ISOCNC.Remoting.Commands.Start)
|
||||
m_ResultCallbackDlg(CommandTypes.START, CommandStates.OK, ResultTypes.RESULT, "")
|
||||
Case CInt(ISOCNC.Remoting.Commands.[Step])
|
||||
m_ResultCallbackDlg(CommandTypes.STEP_, CommandStates.OK, ResultTypes.RESULT, "")
|
||||
Case CInt(ISOCNC.Remoting.Commands.[Stop])
|
||||
m_ResultCallbackDlg(CommandTypes.STOP_, CommandStates.OK, ResultTypes.RESULT, "")
|
||||
Case CInt(ISOCNC.Remoting.Commands.Start_Program_Soft)
|
||||
m_ResultCallbackDlg(CommandTypes.SOFTSTART, CommandStates.OK, ResultTypes.RESULT, "")
|
||||
Case Else
|
||||
End Select
|
||||
_cmdActive = CInt(executedCommand)
|
||||
End Sub
|
||||
|
||||
Private Sub RemoteObject_ServerError(ByVal sender As Object, ByVal seEA As ISOCNC.Remoting.ServerErrorEventArgs)
|
||||
m_ResultCallbackDlg(CommandTypes.ERROR_, CommandStates.ERROR_, ResultTypes.RESULT, "Server Error: " & seEA.[Error])
|
||||
Dim dr As MessageBoxResult = MessageBox.Show("Server Error: " & seEA.[Error])
|
||||
End Sub
|
||||
|
||||
Private Sub RemoteObject_AxisCoordinatesUpdate(ByVal axisValue As Double, ByVal axisIndex As Integer)
|
||||
m_AxisCoordinatesCallbackDlg(axisValue, axisIndex)
|
||||
End Sub
|
||||
|
||||
Private Sub RemoteObject_RPCUpdate(ByVal newRPC As UInteger)
|
||||
_rpc = CInt(newRPC)
|
||||
End Sub
|
||||
|
||||
Private Sub RemoteObject_ListInfoResponse(ByVal prgCount As Integer, ByVal prgAtIndex As String, ByVal prgList As String())
|
||||
If prgCount >= 0 Then
|
||||
_prgCount = prgCount
|
||||
End If
|
||||
|
||||
If prgAtIndex <> "" Then
|
||||
_prgAtIndex = prgAtIndex
|
||||
End If
|
||||
|
||||
If prgList IsNot Nothing AndAlso prgList.Length > 0 Then
|
||||
_prgList = prgList
|
||||
_prgListUpdated = True
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub RemoteObject_AlarmNotification(ByVal alarmOperation As Integer, ByVal alarmType As Integer, ByVal alarmMessage As String, ByVal alarmCode As String, ByVal alarmDateTime As String)
|
||||
' restituisco errore ad interfaccia
|
||||
m_AlarmCallbackDlg(alarmOperation, alarmType, alarmMessage, alarmCode, alarmDateTime)
|
||||
End Sub
|
||||
|
||||
Private Sub RemoteObject_VariableCommandExecuted(ByVal executedCommand As Integer, ByVal commandExecutedCorrectly As Boolean, ByVal varName As String, ByVal varValue As String, ByVal varType As Integer)
|
||||
' riporto valore variabile su array
|
||||
Select Case executedCommand
|
||||
Case VariableCommands.Error
|
||||
Case VariableCommands.NotExecuted
|
||||
Case VariableCommands.ReadVar
|
||||
m_RWVariableManager.UpdateVar(commandExecutedCorrectly, varName, varValue, varType)
|
||||
Case VariableCommands.WriteVar
|
||||
m_ResultCallbackDlg(CommandTypes.WRITE, If(commandExecutedCorrectly, CommandStates.OK, CommandStates.ERROR_), ResultTypes.RESULT, varName & "=" & varValue)
|
||||
Case VariableCommands.ReadAxis
|
||||
Case VariableCommands.ReadAny
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Private Sub RemoteObject_TickUpdate(ByVal newTick As ULong)
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,32 @@
|
||||
'----------------------------------------------------------------------------
|
||||
' EgalTech 2015-2017
|
||||
'----------------------------------------------------------------------------
|
||||
' File : ConstGen.vb Data : 10.04.17 Versione : 1.8d1
|
||||
' Contenuto : Modulo costanti generali.
|
||||
'
|
||||
'
|
||||
'
|
||||
' Modifiche : 10.04.17 DS Creazione modulo.
|
||||
'
|
||||
'
|
||||
'----------------------------------------------------------------------------
|
||||
|
||||
Module ConstCommVa
|
||||
|
||||
' Assi
|
||||
Public Const ASSE_X As String = "AsseX"
|
||||
Public Const ASSE_Y As String = "AsseY"
|
||||
Public Const ASSE_Z As String = "AsseZ"
|
||||
Public Const ASSE_C As String = "AsseC"
|
||||
Public Const ASSE_B As String = "AsseB"
|
||||
' variabili P eventi pezzo
|
||||
Public Const P_PROD As String = "P_Prod"
|
||||
Public Const P_MACHGROUP As String = "P_Machgroup"
|
||||
Public Const P_PART As String = "P_Part"
|
||||
Public Const P_STATE As String = "P_State"
|
||||
' variabile stato di reset
|
||||
Public Const RESET_STATE As String = "Reset_State"
|
||||
' variabili V per anticipo carico
|
||||
Public Const VPAR As String = "V"
|
||||
|
||||
End Module
|
||||
@@ -0,0 +1,74 @@
|
||||
'----------------------------------------------------------------------------
|
||||
' EgalTech 2015-2017
|
||||
'----------------------------------------------------------------------------
|
||||
' File : ConstGen.vb Data : 10.04.17 Versione : 1.8d1
|
||||
' Contenuto : Modulo costanti generali.
|
||||
'
|
||||
'
|
||||
'
|
||||
' Modifiche : 10.04.17 DS Creazione modulo.
|
||||
'
|
||||
'
|
||||
'----------------------------------------------------------------------------
|
||||
|
||||
Public Module ConstGen
|
||||
|
||||
' File con direttorio radice dei dati
|
||||
Public Const DAT_FILE_NAME As String = "DataRoot.Ini"
|
||||
Public Const S_DATA As String = "Data"
|
||||
Public Const K_DATAROOT As String = "DataRoot"
|
||||
|
||||
' File con dati di licenza
|
||||
Public Const LIC_FILE_NAME As String = "EgtBEAMWALL.lic"
|
||||
Public Const S_LICENCE As String = "Licence"
|
||||
Public Const K_KEY As String = "Key"
|
||||
Public Const K_NESTKEY As String = "NestKey"
|
||||
|
||||
' Pagine del programma
|
||||
Public Enum Pages As Integer
|
||||
VIEW = 0
|
||||
MACHINING = 1
|
||||
SUPERVISOR = 2
|
||||
CONFIG = 3
|
||||
End Enum
|
||||
|
||||
' Abilitazioni licenza
|
||||
Public Enum KEY_OPT As UInteger
|
||||
BEAM = 1
|
||||
WALL = 2
|
||||
NESTING_AUTO = 4
|
||||
SUPERVISOR = 8
|
||||
NETWORK = 16
|
||||
End Enum
|
||||
|
||||
' File di log generale
|
||||
Public Const GENLOG_FILE_NAME As String = "EgtBEAMWALLLog#.txt"
|
||||
|
||||
' Sottodirettorio di configurazione
|
||||
Public Const CONF_DIR As String = "Config"
|
||||
' Sottodirettorio delle risorse
|
||||
Public Const RES_DIR As String = "Resources"
|
||||
' Sottodirettorio temporaneo
|
||||
Public Const TEMP_DIR As String = "Temp"
|
||||
' Sottodirettorio per Cam automatico
|
||||
Public Const PROJS_DIR As String = "Projs"
|
||||
' Sottodirettorio per Csv automatico
|
||||
Public Const PRODS_DIR As String = "Prods"
|
||||
' Sottodirettorio per Macro
|
||||
Public Const MACRO_DIR As String = "Macro"
|
||||
' Sottodirettorio per Magazzino
|
||||
Public Const WAREHOUSE_DIR As String = "Warehouse"
|
||||
' Sottodirettorio per lavorazioni travi
|
||||
Public Const BEAM_DIR As String = "Beam"
|
||||
' Sottodirettorio per lavorazioni pareti
|
||||
Public Const WALL_DIR As String = "Wall"
|
||||
' Sottodirettorio di default per il salvataggio con nome
|
||||
Public Const SAVE_DFL_NAMEDIR As String = "MyProjects"
|
||||
' Sottodirettorio di default per le macchine
|
||||
Public Const MACHINES_DFL_DIR As String = "Machines"
|
||||
' Sottodirettorio di default per toolmakers
|
||||
Public Const TOOLMAKERS_DFL_DIR As String = "ToolMakers"
|
||||
' Nome file Lua con le funzioni di attrezzaggio
|
||||
Public Const SETUP_LUA As String = "SetUp.lua"
|
||||
|
||||
End Module
|
||||
@@ -0,0 +1,125 @@
|
||||
'----------------------------------------------------------------------------
|
||||
' EgalTech 2015-2015
|
||||
'----------------------------------------------------------------------------
|
||||
' File : ConstIni.vb Data : 12.02.15 Versione : 1.6b3
|
||||
' Contenuto : Modulo costanti sezione e chiavi per file Ini.
|
||||
'
|
||||
'
|
||||
'
|
||||
' Modifiche : 12.02.15 DS Creazione modulo.
|
||||
'
|
||||
'
|
||||
'----------------------------------------------------------------------------
|
||||
|
||||
Public Module ConstIni
|
||||
|
||||
Public Const INI_FILE_NAME As String = "EgtCOMMTest.ini"
|
||||
|
||||
Public Const S_GENERAL As String = "General"
|
||||
Public Const K_NCTYPE As String = "NCType"
|
||||
'Public Const K_DEBUG As String = "Debug"
|
||||
'Public Const K_LICENCE As String = "Licence"
|
||||
'Public Const K_USERLEVEL As String = "UserLevel"
|
||||
'Public Const K_MAXINST As String = "MaxInstances"
|
||||
Public Const K_MAXCAMINST As String = "MaxCamInstances"
|
||||
'Public Const K_INSTANCES As String = "Instances"
|
||||
'Public Const K_COMMANDLOG As String = "CommandLog"
|
||||
'Public Const K_MESSAGESDIR As String = "MessagesDir"
|
||||
'Public Const K_MESSAGES As String = "Messages"
|
||||
'Public Const K_WINPLACE As String = "WinPlace"
|
||||
'Public Const K_LASTPROJ As String = "LastProj"
|
||||
'Public Const K_AUTOLOADLASTPROJ As String = "AutoLoadLastProj"
|
||||
Public Const K_LASTIMPDIR As String = "LastImpDir"
|
||||
Public Const K_PROJSINDEX As String = "ProjsIndex"
|
||||
Public Const K_PRODSINDEX As String = "ProdsIndex"
|
||||
'Public Const K_SUPPORT As String = "Support"
|
||||
Public Const K_WAREHOUSE As String = "Warehouse"
|
||||
|
||||
'Public Const S_LANGUAGES As String = "Languages"
|
||||
'Public Const K_LANGUAGE As String = "Language"
|
||||
|
||||
'Public Const S_LUA As String = "Lua"
|
||||
'Public Const K_LIBSDIR As String = "LibsDir"
|
||||
'Public Const K_BASELIB As String = "BaseLib"
|
||||
|
||||
'Public Const S_GEOMDB As String = "GeomDB"
|
||||
'Public Const K_DEFAULTFONT As String = "DefaultFont"
|
||||
'Public Const K_NFEFONTDIR As String = "NfeFontDir"
|
||||
'Public Const K_DEFAULTCOLOR As String = "DefaultColor"
|
||||
'Public Const K_SAVETYPE As String = "SaveType"
|
||||
|
||||
'Public Const S_OPENGL As String = "OpenGL"
|
||||
'Public Const K_DOUBLEBUFFER As String = "DoubleBuffer"
|
||||
'Public Const K_COLORBITS As String = "ColorBits"
|
||||
'Public Const K_DEPTHBITS As String = "DepthBits"
|
||||
'Public Const K_DRIVER As String = "Driver"
|
||||
|
||||
'Public Const S_SCENE As String = "Scene"
|
||||
'Public Const K_BACKTOP As String = "BackTop"
|
||||
'Public Const K_BACKBOTTOM As String = "BackBottom"
|
||||
'Public Const K_SHOWGFRAME As String = "ShowGFrame"
|
||||
'Public Const K_MARK As String = "Mark"
|
||||
'Public Const K_SELSURF As String = "SelSurf"
|
||||
'Public Const K_SHOWMODE As String = "ShowMode"
|
||||
Public Const K_SHOWBUILDING As String = "ShowBuilding"
|
||||
'Public Const K_CURVEDIR As String = "CurveDir"
|
||||
'Public Const K_SHOWTRIAADV As String = "ShowTriaAdv"
|
||||
'Public Const K_SHOWZMAP As String = "ShowZmap"
|
||||
'Public Const K_TEXMAXLINPIX As String = "TextureMaxLinPixels"
|
||||
'Public Const K_ZOOMWIN As String = "ZoomWin"
|
||||
'Public Const K_DISTLINE As String = "DistLine"
|
||||
'Public Const K_MMUNITS As String = "MmUnits"
|
||||
|
||||
'Public Const S_GRID As String = "Grid"
|
||||
'Public Const K_SHOWGRID As String = "ShowGrid"
|
||||
'Public Const K_SHOWFRAME As String = "ShowFrame"
|
||||
'Public Const K_SNAPSTEP As String = "SnapStep"
|
||||
'Public Const K_SNAPSTEPINCH As String = "SnapStepInch"
|
||||
'Public Const K_MINLINESSTEP As String = "MinLineSStep"
|
||||
'Public Const K_MAJLINESSTEP As String = "MajLineSStep"
|
||||
'Public Const K_EXTSSTEP As String = "ExtSStep"
|
||||
'Public Const K_MINLNCOLOR As String = "MinLnColor"
|
||||
'Public Const K_MAJLNCOLOR As String = "MajLnColor"
|
||||
|
||||
Public Const S_IMPORT As String = "Import"
|
||||
Public Const K_BTLFLAG As String = "BtlFlag"
|
||||
Public Const K_WALLBTLFLAG As String = "WallBtlFlag"
|
||||
|
||||
'Public Const S_MACH As String = "Mach"
|
||||
'Public Const K_MACHINESDIR As String = "MachinesDir"
|
||||
'Public Const K_TOOLMAKERSDIR As String = "ToolMakersDir"
|
||||
'Public Const K_CURRMACH As String = "CurrMach"
|
||||
Public Const K_PASSWORD As String = "Password"
|
||||
|
||||
'Public Const S_SIMUL As String = "Simul"
|
||||
'Public Const K_SLIDERX As String = "SliderX"
|
||||
'Public Const K_SLIDERVAL As String = "SliderVal"
|
||||
|
||||
Public Const S_BEAM As String = "Beam"
|
||||
Public Const K_CALCPATH As String = "CalcPath"
|
||||
Public Const K_BEAMBASEDIR As String = "BaseDir"
|
||||
Public Const K_BEAMBWEEXEC As String = "BweExec"
|
||||
|
||||
Public Const S_WALL As String = "Wall"
|
||||
Public Const K_WALLBASEDIR As String = "BaseDir"
|
||||
Public Const K_WALLBWEEXEC As String = "BweExec"
|
||||
|
||||
'Public Const S_NEST As String = "Nest"
|
||||
Public Const K_NESTEXEC As String = "NestExec"
|
||||
Public Const K_SECTIONTIME As String = "SectionTime"
|
||||
Public Const K_PARTTIME As String = "PartTime"
|
||||
Public Const K_RAWPARTDEF As String = "RawPartDefinition"
|
||||
Public Const K_MANUALNEST As String = "ManualNest"
|
||||
|
||||
Public Const S_BEAMWALL As String = "BeamWall"
|
||||
Public Const K_BEAMWALLENABLE As String = "BtlEnable"
|
||||
Public Const K_BEAMWALLBASEDIR As String = "BaseDir"
|
||||
Public Const K_BEAMWALLBUTTON As String = "Button"
|
||||
|
||||
Public Const S_MRUPROJFILES As String = "MruProjFiles"
|
||||
Public Const S_MRUPRODFILES As String = "MruProdFiles"
|
||||
|
||||
Public Const S_PRINTER As String = "Printer"
|
||||
Public Const K_LINK As String = "Link"
|
||||
|
||||
End Module
|
||||
@@ -0,0 +1,59 @@
|
||||
Public Module ConstMachComm
|
||||
|
||||
Public Enum ResultTypes As Integer
|
||||
NULL = 0
|
||||
EXECUTED = 1
|
||||
RESULT = 2
|
||||
End Enum
|
||||
|
||||
Public Enum CommandTypes As Integer
|
||||
ERROR_ = 1
|
||||
CONNECT = 2
|
||||
DISCONNECT = 3
|
||||
START = 4
|
||||
SOFTSTART = 5
|
||||
STOP_ = 6
|
||||
RESET = 7
|
||||
STEP_ = 8
|
||||
SETPOINT = 9
|
||||
SENDPROG = 10
|
||||
REMOVEPROG = 11
|
||||
REMOVEALLPROG = 12
|
||||
READ_TPA = 13
|
||||
WRITE = 14
|
||||
DELETEALARMS = 15
|
||||
SETOP = 16
|
||||
READ_NUMFLEXIUM = 17
|
||||
STOPREAD_NUMFLEXIUM = 18
|
||||
MDI = 19
|
||||
End Enum
|
||||
|
||||
Public Enum LogCommandTypes As Integer
|
||||
NULL = 0
|
||||
ERROR_ = 1
|
||||
CONNECT = 2
|
||||
DISCONNECT = 3
|
||||
START = 4
|
||||
SOFTSTART = 5
|
||||
STOP_ = 6
|
||||
RESET = 7
|
||||
STEP_ = 8
|
||||
SETPOINT = 9
|
||||
SENDPROG = 10
|
||||
REMOVEPROG = 11
|
||||
REMOVEALLPROG = 12
|
||||
READ = 13
|
||||
WRITE = 14
|
||||
DELETEALARMS = 15
|
||||
SETOP = 16
|
||||
ALARM = 17
|
||||
NEWOP = 18
|
||||
End Enum
|
||||
|
||||
Public Enum CommandStates As Integer
|
||||
NULL = 0
|
||||
ERROR_ = 1
|
||||
OK = 2
|
||||
End Enum
|
||||
|
||||
End Module
|
||||
@@ -0,0 +1,8 @@
|
||||
Public Module ConstMachIni
|
||||
|
||||
Public Const MACH_INI_FILE_NAME As String = "MachData.ini"
|
||||
|
||||
Public Const S_AXES As String = "Axes"
|
||||
Public Const S_VARIABLES As String = "Variables"
|
||||
|
||||
End Module
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31005.135
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "EgtCOMMTest", "EgtCOMMTest.vbproj", "{EFD7A228-A3D4-4C0B-A7AF-655A03E33939}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{EFD7A228-A3D4-4C0B-A7AF-655A03E33939}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{EFD7A228-A3D4-4C0B-A7AF-655A03E33939}.Debug|x86.Build.0 = Debug|x86
|
||||
{EFD7A228-A3D4-4C0B-A7AF-655A03E33939}.Release|x86.ActiveCfg = Release|x86
|
||||
{EFD7A228-A3D4-4C0B-A7AF-655A03E33939}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {789B56F2-F6BD-429C-8B3E-DF096D0B2C9E}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,229 @@
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{EFD7A228-A3D4-4C0B-A7AF-655A03E33939}</ProjectGuid>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>EgtCOMMTest</RootNamespace>
|
||||
<AssemblyName>EgtCOMMTest</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<MyType>Custom</MyType>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<IncrementalBuild>true</IncrementalBuild>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DocumentationFile>EgtCOMMTest.xml</DocumentationFile>
|
||||
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<IncrementalBuild>false</IncrementalBuild>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DocumentationFile>EgtCOMMTest.xml</DocumentationFile>
|
||||
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionExplicit>On</OptionExplicit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionCompare>Binary</OptionCompare>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionStrict>Off</OptionStrict>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DocumentationFile>EgtCOMMTest.xml</DocumentationFile>
|
||||
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DocumentationFile>EgtCOMMTest.xml</DocumentationFile>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="EgtUILib">
|
||||
<HintPath>..\..\EgtProg\DllD32\EgtUILib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EgtWPFLib5">
|
||||
<HintPath>..\..\EgtProg\DllD32\EgtWPFLib5.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Interop.FXLog">
|
||||
<HintPath>..\..\CNC\NUM\Libs\Interop.FXLog.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Interop.FXServer">
|
||||
<HintPath>..\..\CNC\NUM\Libs\Interop.FXServer.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="ISOCNC.Remoting">
|
||||
<HintPath>..\..\Albatros\Bin\ISOCNC.Remoting.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Runtime.Remoting" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="Application.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="AxesPanel\AxesPanelV.xaml.vb">
|
||||
<DependentUpon>AxesPanelV.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="AxesPanel\AxesPanelVM.vb" />
|
||||
<Compile Include="Comms\NUMFlexiumComm.vb" />
|
||||
<Compile Include="Constants\ConstCommVar.vb" />
|
||||
<Compile Include="Constants\ConstGen.vb" />
|
||||
<Compile Include="Constants\ConstIni.vb" />
|
||||
<Compile Include="Constants\ConstMachComm.vb" />
|
||||
<Compile Include="Constants\ConstMachIni.vb" />
|
||||
<Compile Include="MachManagingThread\NewValueEventArgs.vb" />
|
||||
<Compile Include="MainWindow\MainWindowM.vb" />
|
||||
<Compile Include="Utility\Dictionary.xaml.vb">
|
||||
<DependentUpon>Dictionary.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Utility\Map.vb" />
|
||||
<Compile Include="VariablesList\VariablesListV.xaml.vb">
|
||||
<DependentUpon>VariablesListV.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="VariablesList\VariablesListVM.vb" />
|
||||
<Page Include="AxesPanel\AxesPanelV.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="MachCommandMessagePanel\MachCommandMessagePanelV.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Compile Include="Application.xaml.vb">
|
||||
<DependentUpon>Application.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Comms\TPAComm.vb" />
|
||||
<Compile Include="MachCommandMessagePanel\MachCommandMessagePanelV.xaml.vb">
|
||||
<DependentUpon>MachCommandMessagePanelV.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MachCommandMessagePanel\MachCommandMessagePanelVM.vb" />
|
||||
<Compile Include="MachManagingThread\MachCommConst.vb" />
|
||||
<Compile Include="MachManagingThread\MachManaging.vb" />
|
||||
<Compile Include="MachManagingThread\MachManagingThread.vb" />
|
||||
<Compile Include="MachManagingThread\RWVariableManager.vb" />
|
||||
<Page Include="MainWindow\MainWindowV.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>XamlIntelliSenseFileGenerator</Generator>
|
||||
</Page>
|
||||
<Page Include="Utility\Dictionary.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="VariablesList\VariablesListV.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>XamlIntelliSenseFileGenerator</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Import Include="System.Threading.Tasks" />
|
||||
<Import Include="System.Linq" />
|
||||
<Import Include="System.Xml.Linq" />
|
||||
<Import Include="Microsoft.VisualBasic" />
|
||||
<Import Include="System" />
|
||||
<Import Include="System.Collections" />
|
||||
<Import Include="System.Collections.Generic" />
|
||||
<Import Include="System.Diagnostics" />
|
||||
<Import Include="System.Windows" />
|
||||
<Import Include="System.Windows.Controls" />
|
||||
<Import Include="System.Windows.Data" />
|
||||
<Import Include="System.Windows.Documents" />
|
||||
<Import Include="System.Windows.Input" />
|
||||
<Import Include="System.Windows.Shapes" />
|
||||
<Import Include="System.Windows.Media" />
|
||||
<Import Include="System.Windows.Media.Imaging" />
|
||||
<Import Include="System.Windows.Navigation" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MainWindow\MainWindowV.xaml.vb">
|
||||
<DependentUpon>MainWindowV.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MainWindow\MainWindowVM.vb" />
|
||||
<Compile Include="My Project\AssemblyInfo.vb">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="My Project\MyExtensions\MyWpfExtension.vb">
|
||||
<VBMyExtensionTemplateID>Microsoft.VisualBasic.WPF.MyExtension</VBMyExtensionTemplateID>
|
||||
<VBMyExtensionTemplateVersion>1.0.0.0</VBMyExtensionTemplateVersion>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Resources.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Settings.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="My Project\Resources.resx">
|
||||
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
|
||||
<CustomToolNamespace>My.Resources</CustomToolNamespace>
|
||||
</EmbeddedResource>
|
||||
<None Include="My Project\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\AboutBoxImage.png" />
|
||||
<Resource Include="Resources\EgtCOMMTest.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\EgtCOMMTest\EgtCOMMTestR32.exe
|
||||
IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Debug" copy $(TargetPath) c:\EgtProg\EgtCOMMTest\EgtCOMMTestD32.exe
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,37 @@
|
||||
<UserControl x:Class="MachCommandMessagePanelV"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding sErrCycle}"/>
|
||||
<TextBlock Text="{Binding sIso}"/>
|
||||
<TextBlock Text="{Binding sMessage}"/>
|
||||
<TextBlock Text="{Binding sErrSystem}"/>
|
||||
<Button Content="CANCELLA ALLARMI"
|
||||
Command="{Binding DeleteAlarms_Command}"
|
||||
Visibility="Collapsed"/>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Content="CONNECT"
|
||||
Command="{Binding Connect_Command}"
|
||||
Background="{Binding Connect_Background}"
|
||||
Style="{StaticResource ToolBar_TextButton}"/>
|
||||
<Button Content="START"
|
||||
Command="{Binding Start_Command}"
|
||||
Style="{StaticResource ToolBar_TextButton}"/>
|
||||
<Button Content="STOP"
|
||||
Command="{Binding Stop_Command}"
|
||||
Style="{StaticResource ToolBar_TextButton}"/>
|
||||
<Button Content="RESET"
|
||||
Command="{Binding Reset_Command}"
|
||||
Style="{StaticResource ToolBar_TextButton}"/>
|
||||
<Button Content="STEP"
|
||||
Command="{Binding Step_Command}"
|
||||
Style="{StaticResource ToolBar_TextButton}"/>
|
||||
<Button Content="SET POINT"
|
||||
Command="{Binding SetPoint_Command}"
|
||||
Style="{StaticResource ToolBar_TextButton}"/>
|
||||
<Button Content="DELETE ALARMS"
|
||||
Command="{Binding DeleteAlarms_Command}"
|
||||
Style="{StaticResource ToolBar_TextButton}"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,3 @@
|
||||
Public Class MachCommandMessagePanelV
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,479 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.Threading
|
||||
Imports System.Windows.Threading
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class MachCommandMessagePanelVM
|
||||
Inherits VMBase
|
||||
|
||||
Public Enum MachineOperatingState
|
||||
Start = 1
|
||||
[Stop] = 2
|
||||
[End] = 3
|
||||
SetPoint = 4
|
||||
Pending = 5
|
||||
Unspecified = 100
|
||||
End Enum
|
||||
|
||||
Private m_AlarmTimer As New DispatcherTimer
|
||||
|
||||
Private m_MachManagingThread As Thread
|
||||
Public ReadOnly Property MachManagingThread As Thread
|
||||
Get
|
||||
Return m_MachManagingThread
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private _Connected As Boolean = False
|
||||
Public ReadOnly Property Connected As Boolean
|
||||
Get
|
||||
Return _Connected
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Connect_Background As SolidColorBrush
|
||||
Get
|
||||
Return (If(_Connected, Brushes.Green, Brushes.Red))
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private _ProgramPath As String
|
||||
|
||||
Public ReadOnly Property ProgramPath As String
|
||||
Get
|
||||
Return _ProgramPath
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private _ProgramIndex As Integer = 0
|
||||
|
||||
Public Property ProgramIndex As Integer
|
||||
Get
|
||||
Return _ProgramIndex
|
||||
End Get
|
||||
Set(ByVal value As Integer)
|
||||
_ProgramIndex = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private _VarName As String
|
||||
|
||||
Public Property VarName As String
|
||||
Get
|
||||
Return _VarName
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
_VarName = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private _VarValue As String = ""
|
||||
|
||||
Public Property VarValue As String
|
||||
Get
|
||||
Return _VarValue
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
_VarValue = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Sub SetVarValue(ByVal value As Object)
|
||||
_VarValue = CStr(value)
|
||||
NotifyPropertyChanged(NameOf(VarValue))
|
||||
End Sub
|
||||
|
||||
'Private m_OPState As MachineOperatingState
|
||||
|
||||
'Public ReadOnly Property OPState As MachineOperatingState
|
||||
' Get
|
||||
' Return m_OPState
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
'Public ReadOnly Property sOPState As String
|
||||
' Get
|
||||
' Select Case m_OPState
|
||||
' Case MachineOperatingState.Start
|
||||
' Return "START"
|
||||
' Case MachineOperatingState.Stop
|
||||
' Return "STOP"
|
||||
' Case MachineOperatingState.End
|
||||
' Return "RESET"
|
||||
' Case MachineOperatingState.SetPoint
|
||||
' Return "SETPOINT"
|
||||
' Case MachineOperatingState.Pending
|
||||
' Return "PENDING"
|
||||
' Case Else
|
||||
' Return "UNSPECIFIED"
|
||||
' End Select
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
Private m_ErrCycle As New List(Of Alarm)
|
||||
Private m_ErrCycleCount As Integer = 0
|
||||
Public ReadOnly Property sErrCycle As String
|
||||
Get
|
||||
Dim ShownErr As Alarm = If(m_ErrCycleCount < m_ErrCycle.Count, m_ErrCycle(m_ErrCycleCount), Nothing)
|
||||
Return If(Not IsNothing(ShownErr), ShownErr.sCode & ": " & ShownErr.sMessage, "")
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_Iso As New List(Of Alarm)
|
||||
Private m_IsoCount As Integer = 0
|
||||
Public ReadOnly Property sIso As String
|
||||
Get
|
||||
Dim ShownErr As Alarm = If(m_IsoCount < m_Iso.Count, m_Iso(m_IsoCount), Nothing)
|
||||
Return If(Not IsNothing(ShownErr), ShownErr.sCode & ": " & ShownErr.sMessage, "")
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_Message As New List(Of Alarm)
|
||||
Private m_MessageCount As Integer = 0
|
||||
Public ReadOnly Property sMessage As String
|
||||
Get
|
||||
Dim ShownErr As Alarm = If(m_MessageCount < m_Message.Count, m_Message(m_MessageCount), Nothing)
|
||||
Return If(Not IsNothing(ShownErr), ShownErr.sCode & ": " & ShownErr.sMessage, "")
|
||||
End Get
|
||||
End Property
|
||||
|
||||
|
||||
Private m_ErrSystem As New List(Of Alarm)
|
||||
Private m_ErrSystemCount As Integer = 0
|
||||
Public ReadOnly Property sErrSystem As String
|
||||
Get
|
||||
Dim ShownErr As Alarm = If(m_ErrSystemCount < m_ErrSystem.Count, m_ErrSystem(m_ErrSystemCount), Nothing)
|
||||
Return If(Not IsNothing(ShownErr), ShownErr.sCode & ": " & ShownErr.sMessage, "")
|
||||
End Get
|
||||
End Property
|
||||
|
||||
|
||||
Private m_cmdConnect As ICommand
|
||||
Private m_cmdDisconnect As ICommand
|
||||
Private m_cmdStart As ICommand
|
||||
Private m_cmdStop As ICommand
|
||||
Private m_cmdReset As ICommand
|
||||
Private m_cmdStep As ICommand
|
||||
Private m_cmdDeleteAlarms As ICommand
|
||||
Private m_cmdSetPoint As ICommand
|
||||
'Private m_cmdPrintLabel As ICommand
|
||||
|
||||
Public Sub New()
|
||||
Map.SetRefMachCommandMessagePanelVM(Me)
|
||||
' impostazioni timer degli allarmi
|
||||
m_AlarmTimer.Interval = TimeSpan.FromMilliseconds(1500)
|
||||
AddHandler m_AlarmTimer.Tick, AddressOf AlarmTimer_Tick
|
||||
|
||||
NotifyPropertyChanged(NameOf(Connect_Background))
|
||||
End Sub
|
||||
|
||||
Private Sub AlarmTimer_Tick()
|
||||
If m_ErrCycle.Count = 0 AndAlso m_Iso.Count = 0 AndAlso m_Message.Count = 0 AndAlso m_ErrSystem.Count = 0 Then
|
||||
NotifyPropertyChanged(NameOf(sErrCycle))
|
||||
NotifyPropertyChanged(NameOf(sIso))
|
||||
NotifyPropertyChanged(NameOf(sMessage))
|
||||
NotifyPropertyChanged(NameOf(sErrSystem))
|
||||
Return
|
||||
End If
|
||||
If m_ErrCycle.Count > 0 Then
|
||||
If m_ErrCycleCount < m_ErrCycle.Count - 1 Then
|
||||
m_ErrCycleCount += 1
|
||||
Else
|
||||
m_ErrCycleCount = 0
|
||||
End If
|
||||
End If
|
||||
NotifyPropertyChanged(NameOf(sErrCycle))
|
||||
If m_Iso.Count > 0 Then
|
||||
If m_IsoCount < m_Iso.Count - 1 Then
|
||||
m_IsoCount += 1
|
||||
Else
|
||||
m_IsoCount = 0
|
||||
End If
|
||||
End If
|
||||
NotifyPropertyChanged(NameOf(sIso))
|
||||
If m_Message.Count > 0 Then
|
||||
If m_MessageCount < m_Message.Count - 1 Then
|
||||
m_MessageCount += 1
|
||||
Else
|
||||
m_MessageCount = 0
|
||||
End If
|
||||
End If
|
||||
NotifyPropertyChanged(NameOf(sMessage))
|
||||
If m_ErrSystem.Count > 0 Then
|
||||
If m_ErrSystemCount < m_ErrSystem.Count - 1 Then
|
||||
m_ErrSystemCount += 1
|
||||
Else
|
||||
m_ErrSystemCount = 0
|
||||
End If
|
||||
End If
|
||||
NotifyPropertyChanged(NameOf(sErrSystem))
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property Connect_Command As ICommand
|
||||
Get
|
||||
If m_cmdConnect Is Nothing Then m_cmdConnect = New Command(AddressOf Connect)
|
||||
Return m_cmdConnect
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub Connect(ByVal param As Object)
|
||||
' creo thread gestione macchina
|
||||
m_MachManagingThread = New Thread(Sub()
|
||||
MachineCommThread.MachManagingThreadFunction(AddressOf ResultCallbackDlg, AddressOf CloseCallbackDlg,
|
||||
AddressOf UpdateCallbackDlg, AddressOf AlarmCallbackDlg,
|
||||
AddressOf AxisCoordinatesCallbackDlg, AddressOf OpStateCallbackDlg,
|
||||
AddressOf ReadVarCallbackDlg)
|
||||
End Sub)
|
||||
' avvio thread di gestione della macchina che avvia la connessione
|
||||
m_MachManagingThread.Start()
|
||||
End Sub
|
||||
|
||||
Private Sub Init()
|
||||
' inizializzo valori assi leggendoli da variabili
|
||||
'MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.READ_TPA, ASSE_X))
|
||||
'MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.READ_TPA, ASSE_Y))
|
||||
'MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.READ_TPA, ASSE_Z))
|
||||
'MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.READ_TPA, ASSE_B))
|
||||
'MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.READ_TPA, ASSE_C))
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property Disconnect_Command As ICommand
|
||||
Get
|
||||
If m_cmdDisconnect Is Nothing Then m_cmdDisconnect = New Command(AddressOf Disconnect)
|
||||
Return m_cmdDisconnect
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub Disconnect()
|
||||
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.DISCONNECT))
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property Start_Command As ICommand
|
||||
Get
|
||||
If m_cmdStart Is Nothing Then m_cmdStart = New Command(AddressOf Start)
|
||||
Return m_cmdStart
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub Start(ByVal param As Object)
|
||||
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.START))
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property Stop_Command As ICommand
|
||||
Get
|
||||
If m_cmdStop Is Nothing Then m_cmdStop = New Command(AddressOf [Stop])
|
||||
Return m_cmdStop
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub [Stop](ByVal param As Object)
|
||||
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.STOP_))
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property Reset_Command As ICommand
|
||||
Get
|
||||
If m_cmdReset Is Nothing Then m_cmdReset = New Command(AddressOf Reset)
|
||||
Return m_cmdReset
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub Reset(ByVal param As Object)
|
||||
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.RESET))
|
||||
' annullo stato di pronto ad essere lavorato di tutti i programmi
|
||||
' If Not IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM) Then Map.refProjectVM.SupervisorMachGroupPanelVM.ResetAllMachGroups()
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property Step_Command As ICommand
|
||||
Get
|
||||
If m_cmdStep Is Nothing Then m_cmdStep = New Command(AddressOf [Step])
|
||||
Return m_cmdStep
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub [Step](ByVal param As Object)
|
||||
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.STEP_))
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property SetPoint_Command As ICommand
|
||||
Get
|
||||
If m_cmdSetPoint Is Nothing Then m_cmdSetPoint = New Command(AddressOf SetPoint)
|
||||
Return m_cmdSetPoint
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub SetPoint(ByVal param As Object)
|
||||
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.SETPOINT))
|
||||
End Sub
|
||||
|
||||
'Public ReadOnly Property PrintLabel_Command As ICommand
|
||||
' Get
|
||||
' If m_cmdPrintLabel Is Nothing Then m_cmdPrintLabel = New Command(AddressOf PrintLabel)
|
||||
' Return m_cmdPrintLabel
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
'Public Sub PrintLabel()
|
||||
' 'DbControllers.m_LogMachineController.Create(MachLog.CreateResultLog(LogCommandTypes.ALARM, CommandStates.ERROR_, ResultTypes.EXECUTED, ""))
|
||||
' 'DbControllers.m_LogMachineController.Create(MachLog.CreateAlarmLog(5, 7, "Allaaaaaaaarmeeeeeeeeee!!", 7645, DateTime.Now()))
|
||||
' 'DbControllers.m_LogMachineController.Create(MachLog.CreateOPStateLog(85))
|
||||
' 'DbControllers.m_LogMachineController.Create(MachLog.CreateReadLog(True, "E80048", "46"))
|
||||
|
||||
' 'LabelPrinter.SetTestPrintVariables(2, 34, 76)
|
||||
' 'LabelPrinter.Print()
|
||||
'End Sub
|
||||
|
||||
Public ReadOnly Property DeleteAlarms_Command As ICommand
|
||||
Get
|
||||
If m_cmdDeleteAlarms Is Nothing Then m_cmdDeleteAlarms = New Command(AddressOf DeleteAlarms)
|
||||
Return m_cmdDeleteAlarms
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub DeleteAlarms(ByVal param As Object)
|
||||
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.DELETEALARMS))
|
||||
End Sub
|
||||
|
||||
#Region "CALLBACKS"
|
||||
|
||||
Friend Sub ResultCallbackDlg(CommandType As CommandTypes, CommandState As CommandStates, ResultType As ResultTypes, Params As String)
|
||||
Select Case CommandType
|
||||
Case CommandTypes.CONNECT
|
||||
If CommandState = CommandStates.OK Then
|
||||
_Connected = True
|
||||
NotifyPropertyChanged(NameOf(Connect_Background))
|
||||
Init()
|
||||
End If
|
||||
Case CommandTypes.DISCONNECT
|
||||
If CommandState = CommandStates.OK Then
|
||||
_Connected = False
|
||||
NotifyPropertyChanged(NameOf(Connect_Background))
|
||||
End If
|
||||
End Select
|
||||
'DbControllers.m_LogMachineController.Create(MachLog.CreateResultLog(CommandType, CommandState, ResultType, Params))
|
||||
End Sub
|
||||
Friend Sub CloseCallbackDlg(ByRef bCancel As Boolean)
|
||||
' serve?
|
||||
End Sub
|
||||
Friend Sub UpdateCallbackDlg(Param As String, Params As String)
|
||||
|
||||
End Sub
|
||||
Friend Sub AlarmCallbackDlg(ByVal AlarmOperation As Integer, ByVal AlarmType As Integer, ByVal AlarmMessage As String, ByVal AlarmCode As String, ByVal AlarmDateTime As String)
|
||||
' se aggiungo allarme e non ce ne erano
|
||||
If AlarmOperation = CInt(ISOCNC.Remoting.AlarmOperation.Addition) AndAlso m_ErrCycle.Count = 0 AndAlso m_Iso.Count = 0 AndAlso m_Message.Count = 0 AndAlso m_ErrSystem.Count = 0 Then
|
||||
' avvio il timer degli allarmi
|
||||
m_AlarmTimer.Start()
|
||||
End If
|
||||
' analizzo errore
|
||||
Select Case AlarmType
|
||||
Case CInt(ISOCNC.Remoting.AlarmType.Cycle)
|
||||
If AlarmOperation = CInt(ISOCNC.Remoting.AlarmOperation.Addition) Then
|
||||
m_ErrCycle.Add(Alarm.CreateAlarm(AlarmCode, AlarmMessage))
|
||||
Else
|
||||
m_ErrCycle.RemoveAll(Function(x) x.sCode = AlarmCode)
|
||||
'Dim ToRemove As Alarm = m_ErrCycle.FirstOrDefault(Function(x) x.sCode = AlarmCode)
|
||||
'If Not IsNothing(ToRemove) Then
|
||||
' m_ErrCycle.Remove(ToRemove)
|
||||
'End If
|
||||
End If
|
||||
Case CInt(ISOCNC.Remoting.AlarmType.ISO)
|
||||
If AlarmOperation = CInt(ISOCNC.Remoting.AlarmOperation.Addition) Then
|
||||
m_Iso.Add(Alarm.CreateAlarm(AlarmCode, AlarmMessage))
|
||||
Else
|
||||
m_Iso.RemoveAll(Function(x) x.sCode = AlarmCode)
|
||||
'Dim ToRemove As Alarm = m_Iso.FirstOrDefault(Function(x) x.sCode = AlarmCode)
|
||||
'If Not IsNothing(ToRemove) Then
|
||||
' m_Iso.Remove(ToRemove)
|
||||
'End If
|
||||
End If
|
||||
Case CInt(ISOCNC.Remoting.AlarmType.Message)
|
||||
If AlarmOperation = CInt(ISOCNC.Remoting.AlarmOperation.Addition) Then
|
||||
m_Message.Add(Alarm.CreateAlarm(AlarmCode, AlarmMessage))
|
||||
Else
|
||||
m_Message.RemoveAll(Function(x) x.sCode = AlarmCode)
|
||||
'Dim ToRemove As Alarm = m_Message.FirstOrDefault(Function(x) x.sCode = AlarmCode)
|
||||
'If Not IsNothing(ToRemove) Then
|
||||
' m_Message.Remove(ToRemove)
|
||||
'End If
|
||||
End If
|
||||
Case CInt(ISOCNC.Remoting.AlarmType.None)
|
||||
Case CInt(ISOCNC.Remoting.AlarmType.System)
|
||||
If AlarmOperation = CInt(ISOCNC.Remoting.AlarmOperation.Addition) Then
|
||||
m_ErrSystem.Add(Alarm.CreateAlarm(AlarmCode, AlarmMessage))
|
||||
Else
|
||||
m_ErrSystem.RemoveAll(Function(x) x.sCode = AlarmCode)
|
||||
'Dim ToRemove As Alarm = m_ErrSystem.FirstOrDefault(Function(x) x.sCode = AlarmCode)
|
||||
'If Not IsNothing(ToRemove) Then
|
||||
' m_ErrSystem.Remove(ToRemove)
|
||||
'End If
|
||||
End If
|
||||
Case Else
|
||||
End Select
|
||||
' forzo aggiornamento allarmi
|
||||
AlarmTimer_Tick()
|
||||
' se non ci sono errori
|
||||
If m_ErrCycle.Count = 0 AndAlso m_Iso.Count = 0 AndAlso m_Message.Count = 0 AndAlso m_ErrSystem.Count = 0 Then
|
||||
' fermo timer degli allarmi
|
||||
m_AlarmTimer.Stop()
|
||||
End If
|
||||
'DbControllers.m_LogMachineController.Create(MachLog.CreateAlarmLog(AlarmOperation, AlarmType, AlarmMessage, AlarmCode, AlarmDateTime))
|
||||
End Sub
|
||||
|
||||
Friend Sub AxisCoordinatesCallbackDlg(AxisValue As Double, AxisIndex As Integer)
|
||||
Map.refAxesPanelVM.AxisCoordinatesCallbackDlg(AxisValue, AxisIndex)
|
||||
End Sub
|
||||
|
||||
Friend Sub OpStateCallbackDlg(newOpState As Integer)
|
||||
Map.refMainWindowVM.SetOPState(Map.refMainWindowVM.OPStateList.FirstOrDefault(Function(x) x.Id = newOpState))
|
||||
' Map.refLeftPanelVM.NotifyPropertyChanged(NameOf(Map.refLeftPanelVM.sOPState))
|
||||
'DbControllers.m_LogMachineController.Create(MachLog.CreateOPStateLog(newOpState))
|
||||
End Sub
|
||||
|
||||
Friend Sub ReadVarCallbackDlg(CommandExecutedCorrectly As Boolean, VarAddress As String, VarValue As String, VarType As Integer)
|
||||
Dim VarName As String = RWVariableManager.GetReadVarNameFromAddress(VarAddress)
|
||||
If Not String.IsNullOrEmpty(VarName) Then
|
||||
Select Case VarName
|
||||
Case "AsseX", "AsseY", "AsseZ", "AsseC", "AsseB"
|
||||
SetAxisValue(VarName, VarValue)
|
||||
End Select
|
||||
End If
|
||||
'DbControllers.m_LogMachineController.Create(MachLog.CreateReadLog(CommandExecutedCorrectly, VarAddress, VarValue))
|
||||
End Sub
|
||||
|
||||
Private Sub SetAxisValue(VarName As String, VarValue As String)
|
||||
Dim Axis As Axis = Map.refAxesPanelVM.AxesList.FirstOrDefault(Function(x) x.sName = VarName)
|
||||
If Not IsNothing(Axis) Then
|
||||
Axis.SetValue(VarValue)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' CALLBACKS
|
||||
|
||||
End Class
|
||||
|
||||
Class Alarm
|
||||
|
||||
Private m_sCode As String
|
||||
Public ReadOnly Property sCode As String
|
||||
Get
|
||||
Return m_sCode
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_sMessage As String
|
||||
Public ReadOnly Property sMessage As String
|
||||
Get
|
||||
Return m_sMessage
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected Sub New()
|
||||
End Sub
|
||||
|
||||
Public Shared Function CreateAlarm(Code As String, Message As String) As Alarm
|
||||
Dim NewAlarm As New Alarm
|
||||
NewAlarm.m_sCode = Code
|
||||
NewAlarm.m_sMessage = Message
|
||||
Return NewAlarm
|
||||
End Function
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,58 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports ISOCNC.Remoting
|
||||
|
||||
Public Class MachCommandPanelVM
|
||||
|
||||
Private m_AxisList As ObservableCollection(Of Axis)
|
||||
|
||||
Public ReadOnly Property AxisList As ObservableCollection(Of Axis)
|
||||
Get
|
||||
Return m_AxisList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_OPState As MachineOperatingState
|
||||
|
||||
'Public ReadOnly Property OPState As MachineOperatingState
|
||||
' Get
|
||||
' Return m_OPState
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
'Public ReadOnly Property sOPState As String
|
||||
' Get
|
||||
' Select Case m_OPState
|
||||
' Case MachineOperatingState.Start
|
||||
' Return "START"
|
||||
' Case MachineOperatingState.Stop
|
||||
' Return "STOP"
|
||||
' Case MachineOperatingState.End
|
||||
' Return "RESET"
|
||||
' Case MachineOperatingState.SetPoint
|
||||
' Return "SETPOINT"
|
||||
' Case MachineOperatingState.Pending
|
||||
' Return "PENDING"
|
||||
' Case Else
|
||||
' Return "UNSPECIFIED"
|
||||
' End Select
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
Public Sub New()
|
||||
Map.SetRefMachCommandMessagePanelVM(Me)
|
||||
'' impostazioni timer degli allarmi
|
||||
'm_AlarmTimer.Interval = TimeSpan.FromMilliseconds(1500)
|
||||
'AddHandler m_AlarmTimer.Tick, AddressOf AlarmTimer_Tick
|
||||
'' impostazione assi (leggerli da conf macchina)
|
||||
'm_AxisList = New ObservableCollection(Of Axis)({New Axis(ASSE_X),
|
||||
' New Axis(ASSE_Y),
|
||||
' New Axis(ASSE_Z),
|
||||
' New Axis(ASSE_C),
|
||||
' New Axis(ASSE_B)})
|
||||
'' connetto stampante etichette
|
||||
'LabelPrinter.ConnectPrinter()
|
||||
|
||||
'NotifyPropertyChanged(NameOf(Connect_Background))
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,57 @@
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class Axis
|
||||
Inherits VMBase
|
||||
|
||||
Private m_Name As String
|
||||
Public ReadOnly Property sName As String
|
||||
Get
|
||||
Return m_Name
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_Value As Double
|
||||
Public ReadOnly Property sValue As Double
|
||||
Get
|
||||
Return m_Value
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Friend Sub SetValue(value As Double)
|
||||
m_Value = value
|
||||
NotifyPropertyChanged(NameOf(sValue))
|
||||
End Sub
|
||||
|
||||
Public Sub New(Name As String)
|
||||
m_Name = Name
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
Class Alarm
|
||||
|
||||
Private m_sCode As String
|
||||
Public ReadOnly Property sCode As String
|
||||
Get
|
||||
Return m_sCode
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_sMessage As String
|
||||
Public ReadOnly Property sMessage As String
|
||||
Get
|
||||
Return m_sMessage
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected Sub New()
|
||||
End Sub
|
||||
|
||||
Public Shared Function CreateAlarm(Code As String, Message As String) As Alarm
|
||||
Dim NewAlarm As New Alarm
|
||||
NewAlarm.m_sCode = Code
|
||||
NewAlarm.m_sMessage = Message
|
||||
Return NewAlarm
|
||||
End Function
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,33 @@
|
||||
Module MachCommConst
|
||||
|
||||
Public Enum PVars As Integer
|
||||
PROD = 0
|
||||
MACHGROUP = 1
|
||||
PART = 2
|
||||
STATE = 3
|
||||
End Enum
|
||||
|
||||
' stati pezzo
|
||||
Public Enum PartState As Integer
|
||||
NULL = 0
|
||||
START = 1
|
||||
END_ = 2
|
||||
End Enum
|
||||
|
||||
Public Delegate Sub ResultCallbackDlg(CommandType As CommandTypes, CommandState As CommandStates, ResultType As ResultTypes, Params As String)
|
||||
Public Delegate Sub CloseCallbackDlg(ByRef bCancel As Boolean)
|
||||
Public Delegate Sub UpdateCallbackDlg(Param As String, Params As String)
|
||||
Public Delegate Sub AlarmCallbackDlg(ByVal AlarmOperation As Integer, ByVal AlarmType As Integer, ByVal AlarmMessage As String, ByVal AlarmCode As String, ByVal AlarmDateTime As String)
|
||||
Public Delegate Sub AxisCoordinatesCallbackDlg(ByVal AxisValue As Double, ByVal AxisIndex As Integer)
|
||||
Public Delegate Sub OpStateCallbackDlg(ByVal newOpState As Integer)
|
||||
Public Delegate Sub ReadVarCallbackDlg(CommandExecutedCorrectly As Boolean, VarAddress As String, VarValue As String, VarType As Integer)
|
||||
|
||||
Friend m_ResultCallbackDlg As ResultCallbackDlg
|
||||
Friend m_CloseCallbackDlg As CloseCallbackDlg
|
||||
Friend m_UpdateCallbackDlg As UpdateCallbackDlg
|
||||
Friend m_AlarmCallbackDlg As AlarmCallbackDlg
|
||||
Friend m_AxisCoordinatesCallbackDlg As AxisCoordinatesCallbackDlg
|
||||
Friend m_OpStateCallbackDlg As OpStateCallbackDlg
|
||||
Friend m_ReadVarCallbackDlg As ReadVarCallbackDlg
|
||||
|
||||
End Module
|
||||
@@ -0,0 +1,518 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.Collections.Specialized
|
||||
Imports ISOCNC.Remoting
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
Imports System.IO
|
||||
Imports EgtCOMMTest.MainWindowVM
|
||||
|
||||
Public Class MachManaging
|
||||
|
||||
Private m_bConnected As Boolean = False
|
||||
Public ReadOnly Property bConnected As Boolean
|
||||
Get
|
||||
Return m_bConnected
|
||||
End Get
|
||||
End Property
|
||||
Friend Sub SetConnected(value As Boolean)
|
||||
m_bConnected = value
|
||||
End Sub
|
||||
|
||||
Private m_CN As Object = Nothing
|
||||
Public ReadOnly Property CN As Object
|
||||
Get
|
||||
Return m_CN
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property Tpa As TPAComm
|
||||
Get
|
||||
Return m_CN
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property Num_Flexium As NUMFlexiumComm
|
||||
Get
|
||||
Return m_CN
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private Shared WithEvents m_CommandList As New ObservableCollection(Of ThreadCommand)
|
||||
Public Shared ReadOnly Property CommandList As ObservableCollection(Of ThreadCommand)
|
||||
Get
|
||||
Return m_CommandList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_bStartPending As Boolean = False
|
||||
Public ReadOnly Property StartPending As Boolean
|
||||
Get
|
||||
Return m_bStartPending
|
||||
End Get
|
||||
End Property
|
||||
Friend Sub ResetStartPending()
|
||||
m_bStartPending = False
|
||||
End Sub
|
||||
Friend Sub SetStartPending(value As Boolean)
|
||||
m_bStartPending = value
|
||||
End Sub
|
||||
|
||||
' prossima barra di cui mando i parametri di carico
|
||||
Private m_NextBarId As Integer
|
||||
|
||||
Sub New()
|
||||
' imposto in Map
|
||||
Map.SetRefMachManaging(Me)
|
||||
AddHandler m_CommandList.CollectionChanged, AddressOf CommandList_CollectionChanged
|
||||
' mi connetto alla macchina
|
||||
Connect()
|
||||
End Sub
|
||||
|
||||
Private Sub OnDispose()
|
||||
RemoveHandler m_CommandList.CollectionChanged, AddressOf CommandList_CollectionChanged
|
||||
End Sub
|
||||
|
||||
Friend Sub Timer_Tick()
|
||||
Select Case Map.refMainWindowVM.SelNCType
|
||||
Case NCTypes.TPA
|
||||
'Dim bCancel As Boolean = False
|
||||
'callback(0, "Init", bCancel)
|
||||
|
||||
' leggo tutte le variabili
|
||||
CN.RWVariableManager.RefreshAllVars()
|
||||
|
||||
' eseguo ciclo principale
|
||||
Dim nReset_State As Integer
|
||||
Dim nP_Prod As Integer
|
||||
Dim nP_Machgroup As Integer
|
||||
Dim nP_Part As Integer
|
||||
Dim nP_State As Integer
|
||||
CN.RWVariableManager.ReadVar(P_PROD, nP_Prod)
|
||||
CN.RWVariableManager.ReadVar(P_MACHGROUP, nP_Machgroup)
|
||||
CN.RWVariableManager.ReadVar(P_PART, nP_Part)
|
||||
CN.RWVariableManager.ReadVar(P_STATE, nP_State)
|
||||
CN.RWVariableManager.ReadVar(RESET_STATE, nReset_State)
|
||||
'' se non ancora fatto, preparo variabili barra successiva
|
||||
'If m_NextBarId = 0 Then
|
||||
' SetNextBarVars()
|
||||
'End If
|
||||
'Dim TestOpState As Integer = Tpa.remObject.MachineOperativeStatus
|
||||
'' verifico se scattato stato reset
|
||||
'If nReset_State <> 0 Then
|
||||
' ' resetto tutti i programmi
|
||||
' If Not IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM) Then Map.refProjectVM.SupervisorMachGroupPanelVM.ResetAllMachGroups()
|
||||
' ' resetto variabili P
|
||||
' Tpa.RWVariableManager.WriteVar(P_PROD, 0)
|
||||
' Tpa.RWVariableManager.WriteVar(P_MACHGROUP, 0)
|
||||
' Tpa.RWVariableManager.WriteVar(P_PART, 0)
|
||||
' Tpa.RWVariableManager.WriteVar(P_STATE, 0)
|
||||
' ' cancello tutti i programmi da memoria CN
|
||||
' 'RemoveAllProgram() toglie programma default per pending
|
||||
' ' azzero variabile reset
|
||||
' Tpa.remObject.SetVariableCommand(CInt(ISOCNC.Remoting.VariableCommands.WriteVar),
|
||||
' RWVariableManager.GetReadVarFromName(RESET_STATE).sAddress, "0")
|
||||
' ' resetto prossima barra e variabili V
|
||||
' m_NextBarId = 0
|
||||
' For Index = 1 To 6
|
||||
' Tpa.RWVariableManager.WriteVar(VPAR & Index.ToString(), 0)
|
||||
' Next
|
||||
|
||||
' Return
|
||||
' ' se macchina pronta e non sta tagliando alcun pezzo
|
||||
'ElseIf (nP_Prod = 0 AndAlso
|
||||
' nP_Machgroup = 0 AndAlso
|
||||
' nP_Part = 0 AndAlso
|
||||
' nP_State = PartState.NULL) AndAlso
|
||||
' Tpa.opState = MachineOperatingState.Pending AndAlso Tpa.remObject.MachineOperativeStatus = MachineOperatingState.Pending Then
|
||||
' ' verifico se c'e' un programma da lanciare
|
||||
' SendNextProgram()
|
||||
' ' attesa per essere sicuro che abbia scritto e riletto variabili
|
||||
' Threading.Thread.Sleep(300)
|
||||
' ' verifico stati inizio e fine pezzi
|
||||
'ElseIf nP_Prod <> 0 AndAlso
|
||||
' nP_Machgroup <> 0 AndAlso
|
||||
' nP_Part <> 0 Then
|
||||
' If nP_State = PartState.START Then
|
||||
' ' scrivo data start su Db pezzo
|
||||
' Dim dtStart As DateTime = DateTime.Now()
|
||||
' DbControllers.m_PartController.UpdateStart(nP_Prod, nP_Machgroup, nP_Part, dtStart)
|
||||
' DbControllers.m_PartController.UpdateStatus(nP_Prod, nP_Machgroup, nP_Part, ItemState.WIP)
|
||||
' ' recupero gruppo di lavorazione del pezzo
|
||||
' Dim MachGroup As MyMachGroupVM = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.FirstOrDefault(Function(x) x.Id = nP_Machgroup)
|
||||
' ' recupero pezzo
|
||||
' Dim Part As PartVM = MachGroup.PartVMList.FirstOrDefault(Function(x) x.nPartId = nP_Part)
|
||||
' ' scrivo stato start
|
||||
' Part.nProduction_State = 1
|
||||
' Part.dtStartTime = dtStart
|
||||
' Part.NotifyPropertyChanged(NameOf(Part.nCALC_State))
|
||||
' ' azzero variabile per far ripartire macchina
|
||||
' Tpa.RWVariableManager.WriteVar(P_STATE, 0)
|
||||
' ' se nessun pezzo della barra diverso da quello corrente e' in start
|
||||
' If Not MachGroup.PartVMList.Any(Function(x) x.nPartId <> nP_Part AndAlso x.nCALC_State = 1) Then
|
||||
' ' scrivo data start su Db barra
|
||||
' DbControllers.m_MachGroupController.UpdateStart(nP_Prod, nP_Machgroup, dtStart)
|
||||
' DbControllers.m_MachGroupController.UpdateStatus(nP_Prod, nP_Machgroup, ItemState.WIP)
|
||||
' ' scrivo stato start
|
||||
' MachGroup.MyMachGroupM.SetProductionState(1)
|
||||
' MachGroup.dtStartTime = dtStart
|
||||
' MachGroup.NotifyPropertyChanged(NameOf(MachGroup.nCALC_State))
|
||||
' End If
|
||||
' ' attesa per essere sicuro che abbia scritto e riletto variabili
|
||||
' Threading.Thread.Sleep(300)
|
||||
' ElseIf nP_State = PartState.END_ Then
|
||||
' ' scrivo data end su Db pezzo
|
||||
' Dim dtEnd As DateTime = DateTime.Now()
|
||||
' DbControllers.m_PartController.UpdateEnd(nP_Prod, nP_Machgroup, nP_Part, dtEnd)
|
||||
' DbControllers.m_PartController.UpdateStatus(nP_Prod, nP_Machgroup, nP_Part, ItemState.Produced)
|
||||
' ' recupero gruppo di lavorazione del pezzo
|
||||
' Dim MachGroup As MyMachGroupVM = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.FirstOrDefault(Function(x) x.Id = nP_Machgroup)
|
||||
' ' recupero pezzo
|
||||
' Dim Part As PartVM = MachGroup.PartVMList.FirstOrDefault(Function(x) x.nPartId = nP_Part)
|
||||
' ' scrivo stato end
|
||||
' Part.nProduction_State = 2
|
||||
' Part.dtEndTime = dtEnd
|
||||
' Part.NotifyPropertyChanged(NameOf(Part.nCALC_State))
|
||||
' ' resetto stato redo
|
||||
' Part.bRedo = False
|
||||
' ' azzero variabile per far ripartire macchina
|
||||
' Tpa.RWVariableManager.WriteVar(P_STATE, 0)
|
||||
' ' se tutti i pezzi della barra sono in end
|
||||
' If MachGroup.PartVMList.All(Function(x) x.nCALC_State >= 2) Then
|
||||
' ' scrivo data end su Db barra
|
||||
' DbControllers.m_MachGroupController.UpdateEnd(nP_Prod, nP_Machgroup, dtEnd)
|
||||
' DbControllers.m_MachGroupController.UpdateStatus(nP_Prod, nP_Machgroup, ItemState.Produced)
|
||||
' ' scrivo stato end
|
||||
' MachGroup.MyMachGroupM.SetProductionState(2)
|
||||
' MachGroup.dtEndTime = dtEnd
|
||||
' MachGroup.NotifyPropertyChanged(NameOf(MachGroup.nCALC_State))
|
||||
' ' azzero tutte le variabilli per iniziare barra successiva
|
||||
' Tpa.RWVariableManager.WriteVar(P_PROD, 0)
|
||||
' Tpa.RWVariableManager.WriteVar(P_MACHGROUP, 0)
|
||||
' Tpa.RWVariableManager.WriteVar(P_PART, 0)
|
||||
' Tpa.RWVariableManager.WriteVar(P_STATE, 0)
|
||||
' End If
|
||||
' If Map.refMachCommandMessagePanelVM.bPrinterLink Then
|
||||
' LabelPrinter.SetTestPrintVariables(nP_Prod, nP_Machgroup, nP_Part)
|
||||
' LabelPrinter.Print()
|
||||
' End If
|
||||
' ' attesa per essere sicuro che abbia scritto e riletto variabili
|
||||
' Threading.Thread.Sleep(300)
|
||||
' End If
|
||||
'End If
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
|
||||
End Select
|
||||
|
||||
End Sub
|
||||
|
||||
Private m_Lock_SendProgram As New Object
|
||||
|
||||
Private Function SetNextBarVars() As Boolean
|
||||
'' verifico se c'e' un programma da lanciare
|
||||
'If Not IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM) Then
|
||||
' For Each MyMachGroup As MyMachGroupVM In Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList
|
||||
' If Not MyMachGroup.bSentToMachine AndAlso MyMachGroup.dtStartTime = DateTime.MinValue AndAlso MyMachGroup.bReadyForMachining Then
|
||||
' ' leggo valori parametri V da file
|
||||
' Dim dVPars(10) As Double
|
||||
' Dim Lines() As String = File.ReadAllLines(MyMachGroup.CnFilePath())
|
||||
' Dim sVs() As String = Lines(0).Split(";"c)
|
||||
' For VParIndex = 1 To sVs.Length - 1
|
||||
' Dim VPar() As String = sVs(VParIndex).Split("="c)
|
||||
' VPar(1) = VPar(1).Trim
|
||||
' StringToDouble(VPar(1), dVPars(VParIndex))
|
||||
' Next
|
||||
' ' li scrivo nel CN
|
||||
' For Index = 1 To 10
|
||||
' Tpa.RWVariableManager.WriteVar(VPAR & Index.ToString(), dVPars(Index))
|
||||
' Next
|
||||
' m_NextBarId = MyMachGroup.Id
|
||||
' Return True
|
||||
' End If
|
||||
' Next
|
||||
'End If
|
||||
'Return False
|
||||
End Function
|
||||
|
||||
Private Function SendNextProgram() As Boolean
|
||||
'Dim bSent As Boolean = False
|
||||
'If Not m_bStartPending AndAlso Tpa.opState = MachineOperatingState.Pending Then ' Or Tpa.opState = MachineOperatingState.Start) Then
|
||||
' ' verifico se c'e' un programma da lanciare
|
||||
' If Not IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM) Then
|
||||
' EgtOutLog("Start " & DateTime.Now())
|
||||
' SyncLock m_Lock_SendProgram
|
||||
' For Each MyMachGroup As MyMachGroupVM In Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList
|
||||
' If Not MyMachGroup.bSentToMachine AndAlso MyMachGroup.dtStartTime = DateTime.MinValue AndAlso MyMachGroup.bReadyForMachining Then
|
||||
' ' lo lancio
|
||||
' bSent = SendProgram(MyMachGroup.CnFilePath())
|
||||
' EgtOutLog("Mandato " & DateTime.Now() & " " & MyMachGroup.Name & " " & bSent.ToString())
|
||||
' MyMachGroup.SetSentToMachine(bSent)
|
||||
' m_NextBarId = 0
|
||||
' Exit For
|
||||
' End If
|
||||
' Next
|
||||
' End SyncLock
|
||||
' EgtOutLog("End " & DateTime.Now())
|
||||
' End If
|
||||
'End If
|
||||
'Return bSent
|
||||
End Function
|
||||
|
||||
Private Sub CommandList_CollectionChanged(sender As Object, e As NotifyCollectionChangedEventArgs)
|
||||
If Not IsNothing(e.NewItems) Then
|
||||
For Each Command In e.NewItems
|
||||
ExecuteCommand(DirectCast(Command, ThreadCommand))
|
||||
m_CommandList.Remove(Command)
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub ExecuteCommand(Command As ThreadCommand)
|
||||
Select Case Command.CommandType
|
||||
Case CommandTypes.CONNECT
|
||||
Connect()
|
||||
Case CommandTypes.DISCONNECT
|
||||
Disconnect()
|
||||
Case CommandTypes.START
|
||||
Start()
|
||||
Case CommandTypes.STOP_
|
||||
Stop
|
||||
Case CommandTypes.RESET
|
||||
Reset()
|
||||
Case CommandTypes.STEP_
|
||||
Step_()
|
||||
Case CommandTypes.SETPOINT
|
||||
SetPoint()
|
||||
Case CommandTypes.SENDPROG
|
||||
SendProgram(Command.sVariable, Command.sVariables(1))
|
||||
Case CommandTypes.REMOVEPROG
|
||||
RemoveProgram(Command.nVariable, Command.sVariable, Command.sVariables(1))
|
||||
Case CommandTypes.REMOVEALLPROG
|
||||
RemoveAllProgram()
|
||||
Case CommandTypes.READ_TPA
|
||||
Tpa.RWVariableManager.RefreshVar(Command.sVariable)
|
||||
Case CommandTypes.WRITE
|
||||
WriteVar(Command.sVariable, Command.sVariables(1), Command.nVariable)
|
||||
Case CommandTypes.DELETEALARMS
|
||||
DeleteAlarms()
|
||||
Case CommandTypes.SETOP
|
||||
SetOPState(Command.nVariable)
|
||||
Case CommandTypes.READ_NUMFLEXIUM
|
||||
Num_Flexium.StartReadList()
|
||||
Num_Flexium.StartReadELS()
|
||||
Case CommandTypes.STOPREAD_NUMFLEXIUM
|
||||
Num_Flexium.CloseReadList()
|
||||
Num_Flexium.CloseReadELS()
|
||||
Case CommandTypes.MDI
|
||||
Num_Flexium.MDI_Execute(Command.sVariable)
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Public Sub Connect()
|
||||
Select Case Map.refMainWindowVM.SelNCType
|
||||
Case NCTypes.TPA
|
||||
Try
|
||||
m_CN = New TPAComm(Me)
|
||||
m_bConnected = Tpa.remObject.OnConnect()
|
||||
m_ResultCallbackDlg(CommandTypes.CONNECT, CommandStates.OK, ResultTypes.EXECUTED, "")
|
||||
' creo classe di gestione variabili
|
||||
Catch ex As Exception
|
||||
m_ResultCallbackDlg(CommandTypes.CONNECT, CommandStates.ERROR_, ResultTypes.EXECUTED, "Errore: impossibile connettersi!")
|
||||
Return
|
||||
End Try
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
Try
|
||||
m_CN = New NUMFlexiumComm(Me)
|
||||
Num_Flexium.InitFxServer()
|
||||
m_ResultCallbackDlg(CommandTypes.CONNECT, CommandStates.OK, ResultTypes.EXECUTED, "")
|
||||
' creo classe di gestione variabili
|
||||
Catch ex As Exception
|
||||
m_ResultCallbackDlg(CommandTypes.CONNECT, CommandStates.ERROR_, ResultTypes.EXECUTED, "Errore: impossibile connettersi!")
|
||||
Return
|
||||
End Try
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Public Sub Disconnect()
|
||||
Select Case Map.refMainWindowVM.SelNCType
|
||||
Case NCTypes.TPA
|
||||
Dim bOk As Boolean = Tpa.remObject.OnClose()
|
||||
m_bConnected = Not bOk
|
||||
m_ResultCallbackDlg(CommandTypes.DISCONNECT, If(bOk, CommandStates.OK, CommandStates.ERROR_), ResultTypes.EXECUTED, "")
|
||||
' chiudo classe Tpa
|
||||
Me.OnDispose()
|
||||
Tpa.OnDispose()
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
m_bConnected = False
|
||||
m_ResultCallbackDlg(CommandTypes.DISCONNECT, CommandStates.OK, ResultTypes.EXECUTED, "")
|
||||
' chiudo classe Num_Flexium
|
||||
Me.OnDispose()
|
||||
'Num_Flexium.OnDispose()
|
||||
End Select
|
||||
' termino thread di comunicazione
|
||||
MachineCommThread.StopThread()
|
||||
End Sub
|
||||
|
||||
Public Sub SetOPState(CNMode As NUMFlexiumComm.CNMode)
|
||||
Select Case Map.refMainWindowVM.SelNCType
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
Num_Flexium.SetMode(CNMode)
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Public Sub Start()
|
||||
Select Case Map.refMainWindowVM.SelNCType
|
||||
Case NCTypes.TPA
|
||||
Dim bOk As Boolean = Tpa.remObject.SetCommand(CInt(ISOCNC.Remoting.Commands.Start))
|
||||
m_bStartPending = bOk
|
||||
m_ResultCallbackDlg(CommandTypes.START, If(bOk, CommandStates.OK, CommandStates.ERROR_), ResultTypes.EXECUTED, "")
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
Num_Flexium.Start()
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Public Sub [Stop]()
|
||||
Select Case Map.refMainWindowVM.SelNCType
|
||||
Case NCTypes.TPA
|
||||
Dim bOk As Boolean = Tpa.remObject.SetCommand(CInt(ISOCNC.Remoting.Commands.[Stop]))
|
||||
m_ResultCallbackDlg(CommandTypes.STOP_, If(bOk, CommandStates.OK, CommandStates.ERROR_), ResultTypes.EXECUTED, "")
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
Num_Flexium.Stop_()
|
||||
End Select
|
||||
|
||||
End Sub
|
||||
|
||||
Public Sub Reset()
|
||||
Select Case Map.refMainWindowVM.SelNCType
|
||||
Case NCTypes.TPA
|
||||
Dim bOk As Boolean = Tpa.remObject.SetCommand(CInt(ISOCNC.Remoting.Commands.[End]))
|
||||
m_ResultCallbackDlg(CommandTypes.RESET, If(bOk, CommandStates.OK, CommandStates.ERROR_), ResultTypes.EXECUTED, "")
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
Num_Flexium.Reset()
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Public Sub Step_()
|
||||
Select Case Map.refMainWindowVM.SelNCType
|
||||
Case NCTypes.TPA
|
||||
Dim bOk As Boolean = Tpa.remObject.SetCommand(CInt(ISOCNC.Remoting.Commands.Step))
|
||||
m_ResultCallbackDlg(CommandTypes.STEP_, If(bOk, CommandStates.OK, CommandStates.ERROR_), ResultTypes.EXECUTED, "")
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
''
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Public Sub SetPoint()
|
||||
Select Case Map.refMainWindowVM.SelNCType
|
||||
Case NCTypes.TPA
|
||||
Dim bOk As Boolean = Tpa.remObject.SetCommand(CInt(ISOCNC.Remoting.Commands.SetPoint))
|
||||
m_ResultCallbackDlg(CommandTypes.SETPOINT, If(bOk, CommandStates.OK, CommandStates.ERROR_), ResultTypes.EXECUTED, "")
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
''
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Public Function SendProgram(ProgramPath As String, ProgramType As String) As Boolean
|
||||
Select Case Map.refMainWindowVM.SelNCType
|
||||
Case NCTypes.TPA
|
||||
If Tpa.opState = MachineOperatingState.Pending Then
|
||||
Tpa.remObject.RemoveAllProgramsFromList()
|
||||
Dim bOk As Boolean = False
|
||||
ProgramPath = ProgramPath.Replace("\\", "\")
|
||||
bOk = Tpa.remObject.AddProgramToList(ProgramPath)
|
||||
Threading.Thread.Sleep(1000)
|
||||
bOk = Tpa.remObject.SetCommand(CInt(ISOCNC.Remoting.Commands.Start_Program_Soft))
|
||||
m_ResultCallbackDlg(CommandTypes.SENDPROG, If(bOk, CommandStates.OK, CommandStates.ERROR_), ResultTypes.EXECUTED, "")
|
||||
Return bOk
|
||||
End If
|
||||
Return False
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
Num_Flexium.FileDownload(ProgramType, ProgramPath)
|
||||
Num_Flexium.StartTransfer()
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Public Sub RemoveProgram(ProgramIndex As Integer, ProgramPath As String, ProgramType As String)
|
||||
Select Case Map.refMainWindowVM.SelNCType
|
||||
Case NCTypes.TPA
|
||||
Dim bOk As Boolean
|
||||
Dim sError As String = ""
|
||||
If ProgramIndex > 0 Then
|
||||
bOk = CN.remObject.RemoveProgramFromListAtIndex(ProgramIndex)
|
||||
ElseIf Not String.IsNullOrEmpty(ProgramPath) Then
|
||||
bOk = CN.remObject.RemoveProgramFromList(ProgramPath)
|
||||
Else
|
||||
bOk = False
|
||||
sError = "Errore: nessun parametro passato"
|
||||
End If
|
||||
m_ResultCallbackDlg(CommandTypes.REMOVEPROG, If(bOk, CommandStates.OK, CommandStates.ERROR_), ResultTypes.EXECUTED, sError)
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
Num_Flexium.FileDelete(ProgramType, ProgramPath)
|
||||
Num_Flexium.StartTransfer()
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Public Sub RemoveAllProgram()
|
||||
Dim bOk As Boolean = CN.remObject.RemoveAllProgramsFromList()
|
||||
m_ResultCallbackDlg(CommandTypes.REMOVEALLPROG, If(bOk, CommandStates.OK, CommandStates.ERROR_), ResultTypes.EXECUTED, "")
|
||||
End Sub
|
||||
|
||||
Public Sub DeleteAlarms()
|
||||
Dim bOk As Boolean = CN.remObject.DeleteAlarms(CInt(AlarmType.ISO))
|
||||
bOk = CN.remObject.DeleteAlarms(CInt(AlarmType.Message))
|
||||
bOk = CN.remObject.DeleteAlarms(CInt(AlarmType.Cycle))
|
||||
bOk = CN.remObject.DeleteAlarms(CInt(AlarmType.System))
|
||||
m_ResultCallbackDlg(CommandTypes.DELETEALARMS, If(bOk, CommandStates.OK, CommandStates.ERROR_), ResultTypes.EXECUTED, "")
|
||||
End Sub
|
||||
|
||||
Public Sub WriteVar(Address As String, Value As String, Type As CommVar.Types)
|
||||
Select Case Map.refMainWindowVM.SelNCType
|
||||
Case NCTypes.TPA
|
||||
CN.RWVariableManager.WriteVar(Address, Value)
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
Select Case Type
|
||||
Case CommVar.Types.PLC
|
||||
Num_Flexium.WritePlcVariables(Address, Value)
|
||||
Case CommVar.Types.CN
|
||||
Num_Flexium.WriteNCVariables(Address, Value)
|
||||
End Select
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Public Shared Function InitVar(nIndex As Integer) As CommVar
|
||||
Dim NewVar As CommVar = GetPrivateProfileVariable(S_VARIABLES, nIndex, Map.refMainWindowVM.MainWindowM.sMachIniFile)
|
||||
Select Case Map.refMainWindowVM.SelNCType
|
||||
Case NCTypes.TPA
|
||||
Return RWVariableManager.InitVar(NewVar)
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
Return NUMFlexiumComm.InitVar(NewVar)
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Private Shared Function GetPrivateProfileVariable(IpAppName As String, IpKeyName As String, IpFileName As String) As CommVar
|
||||
Dim sVariable As String = ""
|
||||
EgtUILib.GetPrivateProfileString(IpAppName, IpKeyName, "", sVariable, IpFileName)
|
||||
Dim sVariableValues() As String = sVariable.Split(","c)
|
||||
If Not sVariableValues.Count >= 4 Then Return Nothing
|
||||
For Index = 0 To sVariableValues.Count - 1
|
||||
sVariableValues(Index) = sVariableValues(Index).Trim()
|
||||
Next
|
||||
Dim ReadType As CommVar.ReadTypes
|
||||
Select Case sVariableValues(2).ToLower()
|
||||
Case "o"
|
||||
ReadType = CommVar.ReadTypes.ONETIME
|
||||
Case "c"
|
||||
ReadType = CommVar.ReadTypes.CONTINUOUS
|
||||
Case Else
|
||||
ReadType = CommVar.ReadTypes.NULL
|
||||
End Select
|
||||
Dim Type As CommVar.Types
|
||||
Select Case sVariableValues(3).ToLower()
|
||||
Case "plc"
|
||||
Type = CommVar.Types.PLC
|
||||
Case "cn"
|
||||
Type = CommVar.Types.CN
|
||||
Case Else
|
||||
Type = CommVar.ReadTypes.NULL
|
||||
End Select
|
||||
Return New CommVar(sVariableValues(0), sVariableValues(1), ReadType, Type)
|
||||
End Function
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,127 @@
|
||||
Class MachineCommThread
|
||||
|
||||
' variabile che ferma il ciclo
|
||||
Private Shared m_Stop As Boolean = False
|
||||
|
||||
Friend Shared Sub StopThread()
|
||||
m_Stop = True
|
||||
End Sub
|
||||
|
||||
' variabile in cui ci sono stati inizio e fine pezzo
|
||||
Private Shared sP1VarName As String = "0.FUNM.E81295"
|
||||
Private Shared sP2VarName As String = "0.FUNM.E81296"
|
||||
Private Shared sP3VarName As String = "0.FUNM.E81297"
|
||||
Private Shared sP4VarName As String = "0.FUNM.E81298"
|
||||
Private Shared sResetVarName As String = "0.FUNM.E80048"
|
||||
|
||||
Public Shared Sub MachManagingThreadFunction(ResultCallbackDlg As ResultCallbackDlg, CloseCallbackDlg As CloseCallbackDlg, UpdateCallbackDlg As UpdateCallbackDlg,
|
||||
AlarmCallbackDlg As AlarmCallbackDlg, AxisCoordinatesCallbackDlg As AxisCoordinatesCallbackDlg,
|
||||
OpStateCallbackDlg As OpStateCallbackDlg, ReadVarCallbackDlg As ReadVarCallbackDlg)
|
||||
' inizializzo callback
|
||||
m_ResultCallbackDlg = ResultCallbackDlg
|
||||
m_CloseCallbackDlg = CloseCallbackDlg
|
||||
m_UpdateCallbackDlg = UpdateCallbackDlg
|
||||
m_AlarmCallbackDlg = AlarmCallbackDlg
|
||||
m_AxisCoordinatesCallbackDlg = AxisCoordinatesCallbackDlg
|
||||
m_OpStateCallbackDlg = OpStateCallbackDlg
|
||||
m_ReadVarCallbackDlg = ReadVarCallbackDlg
|
||||
|
||||
' creo classe di comunicazione
|
||||
Dim m_MachManaging As MachManaging = New MachManaging()
|
||||
|
||||
While Not m_Stop
|
||||
' eseguo ciclo principale che tiene vivo il thread
|
||||
m_MachManaging.Timer_Tick()
|
||||
Threading.Thread.Sleep(TimeSpan.FromMilliseconds(1000))
|
||||
End While
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
Public Class ThreadCommand
|
||||
|
||||
Private m_CommandType As CommandTypes
|
||||
Public ReadOnly Property CommandType As CommandTypes
|
||||
Get
|
||||
Return m_CommandType
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_nVariables(5) As Integer
|
||||
Public ReadOnly Property nVariable As Integer
|
||||
Get
|
||||
Return m_nVariables(0)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property nVariables As Integer()
|
||||
Get
|
||||
Return m_nVariables
|
||||
End Get
|
||||
End Property
|
||||
Private m_dVariables(5) As Double
|
||||
Public ReadOnly Property dVariable As Double
|
||||
Get
|
||||
Return m_dVariables(0)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property dVariables As Double()
|
||||
Get
|
||||
Return m_dVariables
|
||||
End Get
|
||||
End Property
|
||||
Private m_sVariables(5) As String
|
||||
Public ReadOnly Property sVariable As String
|
||||
Get
|
||||
Return m_sVariables(0)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property sVariables As String()
|
||||
Get
|
||||
Return m_sVariables
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected Sub New()
|
||||
End Sub
|
||||
|
||||
Public Shared Function CreateCommand(CommandType As CommandTypes) As ThreadCommand
|
||||
Dim NewCommand As ThreadCommand = New ThreadCommand
|
||||
NewCommand.m_CommandType = CommandType
|
||||
Return NewCommand
|
||||
End Function
|
||||
Public Shared Function CreateCommand(CommandType As CommandTypes, Variable As Integer) As ThreadCommand
|
||||
Dim NewCommand As ThreadCommand = New ThreadCommand
|
||||
NewCommand.m_CommandType = CommandType
|
||||
NewCommand.m_nVariables(0) = Variable
|
||||
Return NewCommand
|
||||
End Function
|
||||
Public Shared Function CreateCommand(CommandType As CommandTypes, Variable As Double) As ThreadCommand
|
||||
Dim NewCommand As ThreadCommand = New ThreadCommand
|
||||
NewCommand.m_CommandType = CommandType
|
||||
NewCommand.m_dVariables(0) = Variable
|
||||
Return NewCommand
|
||||
End Function
|
||||
Public Shared Function CreateCommand(CommandType As CommandTypes, Variable As String) As ThreadCommand
|
||||
Dim NewCommand As ThreadCommand = New ThreadCommand
|
||||
NewCommand.m_CommandType = CommandType
|
||||
NewCommand.m_sVariables(0) = Variable
|
||||
Return NewCommand
|
||||
End Function
|
||||
Public Shared Function CreateCommand(CommandType As CommandTypes, nVariables() As Integer, dVariables() As Double, sVariables() As String) As ThreadCommand
|
||||
Dim NewCommand As ThreadCommand = New ThreadCommand
|
||||
NewCommand.m_CommandType = CommandType
|
||||
NewCommand.m_nVariables = nVariables
|
||||
NewCommand.m_dVariables = dVariables
|
||||
NewCommand.m_sVariables = sVariables
|
||||
Return NewCommand
|
||||
End Function
|
||||
Public Shared Function CreateReadCommand(sVariable As String) As ThreadCommand
|
||||
Dim NewCommand As ThreadCommand = New ThreadCommand
|
||||
NewCommand.m_CommandType = CommandTypes.READ_TPA
|
||||
NewCommand.m_sVariables(0) = sVariable
|
||||
Return NewCommand
|
||||
End Function
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,18 @@
|
||||
Public Class NewValueEventArgs
|
||||
Inherits EventArgs
|
||||
|
||||
Public m_NewValue As String
|
||||
Public Property NewValue As String
|
||||
Get
|
||||
Return m_NewValue
|
||||
End Get
|
||||
Private Set(value As String)
|
||||
m_NewValue = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Sub New(NewValue As String)
|
||||
m_NewValue = NewValue
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,274 @@
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
Imports ISOCNC.Remoting
|
||||
|
||||
Public Class RWVariableManager
|
||||
|
||||
Private m_Tpa As TPAComm = Nothing
|
||||
Friend ReadOnly Property Tpa As TPAComm
|
||||
Get
|
||||
Return m_Tpa
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_Proxy_VariableCommandExecutedEventHandler As New VariableCommandExecutedEventHandler(AddressOf RemoteObject_VariableCommandExecuted)
|
||||
|
||||
' lock per Synclock
|
||||
Private m_CopyLock As New Object
|
||||
Private m_ReadLock As New Object
|
||||
' lista variabili in lettura
|
||||
Private Shared m_ReadingVars(19) As CommVar
|
||||
Public Shared ReadOnly Property ReadingVars As CommVar()
|
||||
Get
|
||||
Return m_ReadingVars
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' lista variabili lette
|
||||
Public Shared m_ReadedVars(19) As String
|
||||
|
||||
Protected Sub New()
|
||||
End Sub
|
||||
|
||||
Friend Sub OnDispose()
|
||||
RemoveHandler m_Tpa.eventProxy.VariableCommandExecuted, m_Proxy_VariableCommandExecutedEventHandler
|
||||
'RemoveHandler m_Tpa.MachManaging.Timer.Tick, AddressOf Timer_Tick
|
||||
End Sub
|
||||
|
||||
'Friend Sub Timer_Tick(sender As Object, e As EventArgs)
|
||||
' ' leggo tutte le variabili
|
||||
' RefreshAllVars()
|
||||
'End Sub
|
||||
|
||||
Friend Shared Function CreateRWVariableManager(Tpa As TPAComm)
|
||||
Dim NewRWVariableManager As New RWVariableManager
|
||||
NewRWVariableManager.m_Tpa = Tpa
|
||||
AddHandler NewRWVariableManager.m_Tpa.eventProxy.VariableCommandExecuted, NewRWVariableManager.m_Proxy_VariableCommandExecutedEventHandler
|
||||
Return NewRWVariableManager
|
||||
End Function
|
||||
|
||||
Public Sub RefreshAllVars()
|
||||
For Each Var In m_ReadingVars
|
||||
' rileggo solo variabili continue
|
||||
If Not IsNothing(Var) AndAlso Var.nReadType = CommVar.ReadTypes.CONTINUOUS Then IntRefreshVar(Var.sAddress)
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Public Shared Function InitVar(Name As String, Address As String, Type As CommVar.ReadTypes) As Integer
|
||||
Dim Index As Integer = Array.IndexOf(m_ReadingVars, Nothing)
|
||||
m_ReadingVars(Index) = New CommVar(Name, Address, Type, CommVar.Types.NULL)
|
||||
Return Index
|
||||
End Function
|
||||
|
||||
Public Shared Function InitVar(nIndex As Integer) As CommVar
|
||||
Dim Index As Integer = Array.IndexOf(m_ReadingVars, Nothing)
|
||||
m_ReadingVars(Index) = GetPrivateProfileVariable(S_VARIABLES, nIndex, Map.refMainWindowVM.MainWindowM.sMachIniFile)
|
||||
Return m_ReadingVars(Index)
|
||||
End Function
|
||||
|
||||
Public Shared Function InitVar(Variable As CommVar) As CommVar
|
||||
Dim Index As Integer = Array.IndexOf(m_ReadingVars, Nothing)
|
||||
m_ReadingVars(Index) = Variable
|
||||
Return m_ReadingVars(Index)
|
||||
End Function
|
||||
|
||||
Private Shared Function GetPrivateProfileVariable(IpAppName As String, IpKeyName As String, IpFileName As String) As CommVar
|
||||
Dim sVariable As String = ""
|
||||
EgtUILib.GetPrivateProfileString(IpAppName, IpKeyName, "", sVariable, IpFileName)
|
||||
Dim sVariableValues() As String = sVariable.Split(","c)
|
||||
If Not sVariableValues.Count >= 3 Then Return Nothing
|
||||
For Index = 0 To sVariableValues.Count - 1
|
||||
sVariableValues(Index) = sVariableValues(Index).Trim()
|
||||
Next
|
||||
Dim Type As CommVar.ReadTypes
|
||||
Select Case sVariableValues(2).ToLower()
|
||||
Case "o"
|
||||
Type = CommVar.ReadTypes.ONETIME
|
||||
Case "c"
|
||||
Type = CommVar.ReadTypes.CONTINUOUS
|
||||
Case Else
|
||||
Type = CommVar.ReadTypes.NULL
|
||||
End Select
|
||||
Return New CommVar(sVariableValues(0), sVariableValues(1), Type, CommVar.Types.NULL)
|
||||
End Function
|
||||
|
||||
Public Sub RefreshVar(Name As String)
|
||||
Dim Var As CommVar = GetReadVarFromName(Name)
|
||||
Var.ResetReading()
|
||||
IntRefreshVar(Var.sAddress)
|
||||
End Sub
|
||||
|
||||
Public Sub WriteVar(Name As String, Value As String)
|
||||
IntWriteVar(GetReadVarFromName(Name).sAddress, Value)
|
||||
End Sub
|
||||
|
||||
Private Sub IntRefreshVar(Address As String)
|
||||
Tpa.remObject.SetVariableCommand(ISOCNC.Remoting.VariableCommands.ReadVar, Address, "")
|
||||
End Sub
|
||||
|
||||
Private Sub IntWriteVar(Address As String, Value As String)
|
||||
Tpa.remObject.SetVariableCommand(ISOCNC.Remoting.VariableCommands.WriteVar, Address, Value)
|
||||
End Sub
|
||||
|
||||
Public Sub ReadVar(Name As String, ByRef Value As String)
|
||||
Value = m_ReadedVars(GetIndexFromName(Name))
|
||||
End Sub
|
||||
Public Sub ReadVar(Name As String, ByRef Value As Integer)
|
||||
Integer.TryParse(m_ReadedVars(GetIndexFromName(Name)), Value)
|
||||
End Sub
|
||||
Public Sub ReadVar(Name As String, ByRef Value As Double)
|
||||
Value = StringToDouble(m_ReadedVars(GetIndexFromName(Name)), 5)
|
||||
End Sub
|
||||
|
||||
Private Shared Function GetIndexFromName(Name As String) As Integer
|
||||
Dim t = Array.FindIndex(m_ReadingVars, Function(x) If(Not IsNothing(x), x.sName = Name, False))
|
||||
Return Array.FindIndex(m_ReadingVars, Function(x) If(Not IsNothing(x), x.sName = Name, False))
|
||||
End Function
|
||||
Friend Shared Function GetReadVarFromName(Name As String) As CommVar
|
||||
Return m_ReadingVars(GetIndexFromName(Name))
|
||||
End Function
|
||||
Private Shared Function GetIndexFromAddress(Address As String) As Integer
|
||||
Return Array.FindIndex(m_ReadingVars, Function(x) If(Not IsNothing(x), x.sAddress = Address, False))
|
||||
End Function
|
||||
Friend Shared Function GetReadVarFromAddress(Address As String) As CommVar
|
||||
Return m_ReadingVars(GetIndexFromAddress(Address))
|
||||
End Function
|
||||
Friend Shared Function GetReadVarNameFromAddress(Address As String) As String
|
||||
Dim Var As CommVar = m_ReadingVars.FirstOrDefault(Function(x) If(Not IsNothing(x), x.sAddress = Address, False))
|
||||
Return If(Not IsNothing(Var), Var.sName, "")
|
||||
End Function
|
||||
|
||||
Private Sub UpdateContinuousVars()
|
||||
Dim bReaded As Boolean = True
|
||||
For Each Var In m_ReadingVars
|
||||
If Not IsNothing(Var) AndAlso Var.nReadType = CommVar.ReadTypes.CONTINUOUS AndAlso Not Var.bReaded Then
|
||||
bReaded = False
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
' se lette tutte
|
||||
If bReaded Then
|
||||
' aggiorno variabili
|
||||
SyncLock m_CopyLock
|
||||
For VarIndex = 0 To m_ReadingVars.Count - 1
|
||||
If Not IsNothing(m_ReadingVars(VarIndex)) Then
|
||||
m_ReadedVars(VarIndex) = m_ReadingVars(VarIndex).sValue
|
||||
End If
|
||||
Next
|
||||
End SyncLock
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Friend Sub UpdateVar(CommandExecutedCorrectly As Boolean, VarName As String, VarValue As String, VarType As Integer)
|
||||
If CommandExecutedCorrectly Then
|
||||
Dim Var As CommVar = GetReadVarFromAddress(VarName)
|
||||
If Not IsNothing(Var) Then
|
||||
'Dim bChangedVal As Boolean = ()
|
||||
Var.SetValue(VarValue)
|
||||
' se variabile ripetitiva lancio update variabili ripetitive
|
||||
If Var.nReadType = CommVar.ReadTypes.CONTINUOUS Then
|
||||
EgtOutLog(CommandExecutedCorrectly & " . " & VarName & " . " & VarValue)
|
||||
EgtOutLog(Var.sName & " . " & Var.sAddress & " . " & Var.sValue & " . " & Var.bReaded)
|
||||
UpdateContinuousVars()
|
||||
Else
|
||||
m_ReadVarCallbackDlg(CommandExecutedCorrectly, VarName, VarValue, VarType)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub RemoteObject_VariableCommandExecuted(ByVal executedCommand As Integer, ByVal commandExecutedCorrectly As Boolean, ByVal varName As String, ByVal varValue As String, ByVal varType As Integer)
|
||||
' riporto valore variabile su array
|
||||
Select Case executedCommand
|
||||
Case VariableCommands.Error
|
||||
Case VariableCommands.NotExecuted
|
||||
Case VariableCommands.ReadVar
|
||||
UpdateVar(commandExecutedCorrectly, varName, varValue, varType)
|
||||
Case VariableCommands.WriteVar
|
||||
m_ResultCallbackDlg(CommandTypes.WRITE, CommandStates.OK, ResultTypes.RESULT, "")
|
||||
Case VariableCommands.ReadAxis
|
||||
Case VariableCommands.ReadAny
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
Public Class CommVar
|
||||
|
||||
Public Event NewValue As EventHandler(Of NewValueEventArgs)
|
||||
|
||||
Public Enum ReadTypes As Integer
|
||||
NULL = 0
|
||||
ONETIME = 1
|
||||
CONTINUOUS = 2
|
||||
End Enum
|
||||
|
||||
Public Enum Types As Integer
|
||||
NULL = 0
|
||||
PLC = 1
|
||||
CN = 2
|
||||
End Enum
|
||||
|
||||
Private m_sName As String
|
||||
Public Property sName As String
|
||||
Get
|
||||
Return m_sName
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_sName = value
|
||||
End Set
|
||||
End Property
|
||||
Private m_sAddress As String
|
||||
Public Property sAddress As String
|
||||
Get
|
||||
Return m_sAddress
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_sAddress = value
|
||||
End Set
|
||||
End Property
|
||||
Private m_nReadType As ReadTypes
|
||||
Public ReadOnly Property nReadType As ReadTypes
|
||||
Get
|
||||
Return m_nReadType
|
||||
End Get
|
||||
End Property
|
||||
Private m_nType As Types
|
||||
Public ReadOnly Property nType As Types
|
||||
Get
|
||||
Return m_nType
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_sValue As String
|
||||
Public ReadOnly Property sValue As String
|
||||
Get
|
||||
Return m_sValue
|
||||
End Get
|
||||
End Property
|
||||
Public Sub SetValue(value As String)
|
||||
Dim bNewValue As Boolean = m_sValue <> value
|
||||
m_sValue = value
|
||||
m_bReaded = True
|
||||
If bNewValue Then RaiseEvent NewValue(Me, New NewValueEventArgs(value))
|
||||
End Sub
|
||||
|
||||
Private m_bReaded As Boolean
|
||||
Public ReadOnly Property bReaded As Boolean
|
||||
Get
|
||||
Return m_bReaded
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Sub New(Name As String, Address As String, ReadType As ReadTypes, Type As Types)
|
||||
m_sName = Name
|
||||
m_sAddress = Address
|
||||
m_nReadType = ReadType
|
||||
m_nType = Type
|
||||
End Sub
|
||||
|
||||
Friend Sub ResetReading()
|
||||
m_bReaded = False
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,74 @@
|
||||
<Window x:Class="EgtCNCPLCComm.MainWindowV"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="MainWindow" Height="800" Width="400">
|
||||
|
||||
<StackPanel>
|
||||
<Button Content="CONNECT"
|
||||
Command="{Binding Connect_Command}"
|
||||
Background="{Binding Connect_Background}"/>
|
||||
<Button Content="DISCONNECT"
|
||||
Command="{Binding Disconnect_Command}"/>
|
||||
<Button Content="START"
|
||||
Command="{Binding Start_Command}"/>
|
||||
<Button Content="PAUSE"
|
||||
Command="{Binding Stop_Command}"/>
|
||||
<Button Content="END"
|
||||
Command="{Binding Step_Command}"/>
|
||||
<Button Content="SET POINT"
|
||||
Command="{Binding SetPoint_Command}"/>
|
||||
<Button Content="PRINT LABEL"
|
||||
Command="{Binding PrintLabel_Command}"/>
|
||||
<TextBlock Text="{Binding ErrCycle}"/>
|
||||
<TextBlock Text="{Binding Iso}"/>
|
||||
<TextBlock Text="{Binding Message}"/>
|
||||
<TextBlock Text="{Binding ErrSystem}"/>
|
||||
<Button Content="CANCELLA ALLARMI"
|
||||
Command="{Binding DeleteAlarms_Command}"/>
|
||||
<GroupBox Header="CNC files manager">
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding ProgramPath}"/>
|
||||
<Button Content="..."
|
||||
Command="{Binding SearchFilePath_Command}"/>
|
||||
<TextBox Text="{Binding ProgramIndex}"/>
|
||||
<Button Content="Add"
|
||||
Command="{Binding AddProgram_Command}"/>
|
||||
<Button Content="Remove"
|
||||
Command="{Binding RemoveProgram_Command}"/>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
<GroupBox Header="Read/Write variables">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Name:"/>
|
||||
<TextBox Text="{Binding VarName}"/>
|
||||
<TextBlock Text="Value:"/>
|
||||
<TextBox Text="{Binding VarValue}"/>
|
||||
<Button Content="Read"
|
||||
Command="{Binding ReadVar_Command}"/>
|
||||
<Button Content="Write"
|
||||
Command="{Binding WriteVar_Command}"/>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
<GroupBox Header="Read axis">
|
||||
<ItemsControl ItemsSource="{Binding AxisList}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<UniformGrid Columns="2">
|
||||
<TextBlock Text="{Binding Name}"/>
|
||||
<TextBlock Text="{Binding Value}"/>
|
||||
</UniformGrid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</GroupBox>
|
||||
<GroupBox Header="OPState">
|
||||
<ComboBox ItemsSource="{Binding OPStateList}"
|
||||
SelectedItem="{Binding SelOPState}"/>
|
||||
</GroupBox>
|
||||
|
||||
<StackPanel>
|
||||
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
</Window>
|
||||
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace EgtCNCPLCComm
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindowV.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindowV : Window
|
||||
{
|
||||
MainWindowVM _MainWindowVM;
|
||||
public MainWindowV()
|
||||
{
|
||||
InitializeComponent();
|
||||
_MainWindowVM = new MainWindowVM();
|
||||
this.DataContext = _MainWindowVM;
|
||||
this.Closing += MainWindowV_Closing;
|
||||
}
|
||||
|
||||
public void MainWindowV_Closing(object sender, CancelEventArgs e)
|
||||
{
|
||||
// Handle closing logic, set e.Cancel as needed
|
||||
if (_MainWindowVM.Connected)
|
||||
_MainWindowVM.Tpa.remObject.OnClose();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,603 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows.Media;
|
||||
using System.Windows;
|
||||
using ISOCNC.Remoting;
|
||||
using Zebra.Sdk.Comm;
|
||||
using Zebra.Sdk.Device;
|
||||
using Zebra.Sdk.Printer;
|
||||
|
||||
namespace EgtCNCPLCComm
|
||||
{
|
||||
class MainWindowVM : VMBase
|
||||
{
|
||||
|
||||
#region FIELDS & PROPERTIES
|
||||
|
||||
// connesso
|
||||
private bool _Connected = false;
|
||||
public bool Connected
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Connected;
|
||||
}
|
||||
}
|
||||
public SolidColorBrush Connect_Background
|
||||
{
|
||||
get
|
||||
{
|
||||
return (_Connected ? Brushes.Green : Brushes.Red);
|
||||
}
|
||||
}
|
||||
|
||||
// istanza della classe di comunicazione del controllo
|
||||
private TPAComm _Tpa = null;
|
||||
public TPAComm Tpa
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Tpa;
|
||||
}
|
||||
}
|
||||
// path corrent
|
||||
private string _ProgramPath;
|
||||
public string ProgramPath
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ProgramPath;
|
||||
}
|
||||
}
|
||||
// indice a cui inserire o togliere il programma CNC
|
||||
private int _ProgramIndex = 0;
|
||||
public int ProgramIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ProgramIndex;
|
||||
}
|
||||
set
|
||||
{
|
||||
_ProgramIndex = value;
|
||||
}
|
||||
}
|
||||
// nome della variabile
|
||||
private string _VarName;
|
||||
public string VarName
|
||||
{
|
||||
get
|
||||
{
|
||||
return _VarName;
|
||||
}
|
||||
set
|
||||
{
|
||||
_VarName = value;
|
||||
}
|
||||
}
|
||||
// valore della variabile
|
||||
private string _VarValue = "";
|
||||
public string VarValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return _VarValue;
|
||||
}
|
||||
set
|
||||
{
|
||||
_VarValue = value;
|
||||
}
|
||||
}
|
||||
public void SetVarValue( object value)
|
||||
{
|
||||
_VarValue = (string)value;
|
||||
NotifyPropertyChanged(nameof(VarValue));
|
||||
}
|
||||
|
||||
// lista assi
|
||||
private ObservableCollection<Axis> _AxisList;
|
||||
public ObservableCollection<Axis> AxisList
|
||||
{
|
||||
get
|
||||
{
|
||||
return _AxisList;
|
||||
}
|
||||
}
|
||||
private List<ISOCNC.Remoting.MachineOperatingState> _OPStateList;
|
||||
public List<ISOCNC.Remoting.MachineOperatingState> OPStateList
|
||||
{
|
||||
get
|
||||
{
|
||||
return _OPStateList;
|
||||
}
|
||||
set
|
||||
{
|
||||
_OPStateList = value;
|
||||
}
|
||||
}
|
||||
|
||||
private ISOCNC.Remoting.MachineOperatingState _SelOPState;
|
||||
public ISOCNC.Remoting.MachineOperatingState SelOPState
|
||||
{
|
||||
get
|
||||
{
|
||||
return _SelOPState;
|
||||
}
|
||||
set
|
||||
{
|
||||
_SelOPState = value;
|
||||
}
|
||||
}
|
||||
|
||||
private string _ErrCycle;
|
||||
public string ErrCycle
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ErrCycle;
|
||||
}
|
||||
}
|
||||
public void UpdateErrCycle(string msg)
|
||||
{
|
||||
_ErrCycle = msg;
|
||||
NotifyPropertyChanged(nameof(ErrCycle));
|
||||
}
|
||||
|
||||
private string _Iso;
|
||||
public string Iso
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Iso;
|
||||
}
|
||||
}
|
||||
public void UpdateIso(string msg)
|
||||
{
|
||||
_Iso = msg;
|
||||
NotifyPropertyChanged(nameof(Iso));
|
||||
}
|
||||
|
||||
private string _Message;
|
||||
public string Message
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Message;
|
||||
}
|
||||
}
|
||||
public void UpdateMessage(string msg)
|
||||
{
|
||||
_Message = msg;
|
||||
NotifyPropertyChanged(nameof(Message));
|
||||
}
|
||||
|
||||
private string _ErrSystem;
|
||||
public string ErrSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ErrSystem;
|
||||
}
|
||||
}
|
||||
public void UpdateErrSystem(string msg)
|
||||
{
|
||||
_ErrSystem = msg;
|
||||
NotifyPropertyChanged(nameof(ErrSystem));
|
||||
}
|
||||
|
||||
// definizione comandi
|
||||
ICommand m_cmdConnect;
|
||||
ICommand m_cmdDisconnect;
|
||||
ICommand m_cmdStart;
|
||||
ICommand m_cmdStop;
|
||||
ICommand m_cmdStep;
|
||||
ICommand m_cmdSearchFilePath;
|
||||
ICommand m_cmdAddProgram;
|
||||
ICommand m_cmdRemoveProgram;
|
||||
ICommand m_cmdReadVar;
|
||||
ICommand m_cmdWriteVar;
|
||||
ICommand m_cmdDeleteAlarms;
|
||||
ICommand m_cmdSetPoint;
|
||||
ICommand m_cmdPrintLabel;
|
||||
|
||||
#endregion FIELDS & PROPERTIES
|
||||
|
||||
#region CONSTRUCTOR
|
||||
|
||||
public MainWindowVM()
|
||||
{
|
||||
_AxisList = new ObservableCollection<Axis> { new Axis("X"), new Axis("Y"), new Axis("Z"), new Axis("C"), new Axis("B") };
|
||||
_OPStateList = new List<MachineOperatingState> { MachineOperatingState.Start, MachineOperatingState.Stop, MachineOperatingState.End,
|
||||
MachineOperatingState.SetPoint, MachineOperatingState.Pending, MachineOperatingState.Unspecified};
|
||||
NotifyPropertyChanged(nameof(Connect_Background));
|
||||
}
|
||||
|
||||
#endregion CONSTRUCTOR
|
||||
|
||||
#region COMMANDS
|
||||
|
||||
#region Connect
|
||||
|
||||
// Returns a command that manage the MainWindow_Unloaded command
|
||||
public ICommand Connect_Command
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_cmdConnect == null)
|
||||
m_cmdConnect = new Command(Connect);
|
||||
return m_cmdConnect;
|
||||
}
|
||||
}
|
||||
|
||||
// Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
||||
public void Connect(Object param)
|
||||
{
|
||||
_Tpa = new TPAComm(this);
|
||||
_Connected = Tpa.remObject.OnConnect();
|
||||
NotifyPropertyChanged(nameof(Connect_Background));
|
||||
if (_Connected)
|
||||
Init();
|
||||
}
|
||||
|
||||
private void Init()
|
||||
{
|
||||
_SelOPState = (MachineOperatingState)Tpa.remObject.MachineOperativeStatus;
|
||||
NotifyPropertyChanged(nameof(SelOPState));
|
||||
string sAxesValue = "";
|
||||
double dAxesValue = 0;
|
||||
// Tpa.remObject.SetVariableCommand((int)VariableCommands.ReadAxis, null, sAxesVal);
|
||||
string sAxesName = "0.TESTA.AsseX.X";
|
||||
Tpa.remObject.SetVariableCommand((int)ISOCNC.Remoting.VariableCommands.ReadVar, sAxesName, sAxesValue);
|
||||
double.TryParse(sAxesValue, out dAxesValue);
|
||||
_AxisList[0].Value = dAxesValue;
|
||||
sAxesName = "0.TESTA.AsseY.Y";
|
||||
Tpa.remObject.SetVariableCommand((int)ISOCNC.Remoting.VariableCommands.ReadVar, sAxesName, sAxesValue);
|
||||
double.TryParse(sAxesValue, out dAxesValue);
|
||||
_AxisList[1].Value = dAxesValue;
|
||||
sAxesName = "0.TESTA.AsseZ.Z";
|
||||
Tpa.remObject.SetVariableCommand((int)ISOCNC.Remoting.VariableCommands.ReadVar, sAxesName, sAxesValue);
|
||||
double.TryParse(sAxesValue, out dAxesValue);
|
||||
_AxisList[2].Value = dAxesValue;
|
||||
sAxesName = "0.TESTA.AsseC.C";
|
||||
Tpa.remObject.SetVariableCommand((int)ISOCNC.Remoting.VariableCommands.ReadVar, sAxesName, sAxesValue);
|
||||
double.TryParse(sAxesValue, out dAxesValue);
|
||||
_AxisList[3].Value = dAxesValue;
|
||||
sAxesName = "0.TESTA.AsseB.B";
|
||||
Tpa.remObject.SetVariableCommand((int)ISOCNC.Remoting.VariableCommands.ReadVar, sAxesName, sAxesValue);
|
||||
double.TryParse(sAxesValue, out dAxesValue);
|
||||
_AxisList[4].Value = dAxesValue;
|
||||
}
|
||||
#endregion Connect
|
||||
|
||||
#region Disconnect
|
||||
|
||||
// Returns a command that manage the MainWindow_Unloaded command
|
||||
public ICommand Disconnect_Command
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_cmdDisconnect == null)
|
||||
m_cmdDisconnect = new Command(Disconnect);
|
||||
return m_cmdDisconnect;
|
||||
}
|
||||
}
|
||||
|
||||
// Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
||||
public void Disconnect(Object param)
|
||||
{
|
||||
_Connected = !Tpa.remObject.OnClose();
|
||||
NotifyPropertyChanged(nameof(Connect_Background));
|
||||
}
|
||||
|
||||
#endregion Disconnect
|
||||
|
||||
#region Start
|
||||
|
||||
// Returns a command that manage the MainWindow_Unloaded command
|
||||
public ICommand Start_Command
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_cmdStart == null)
|
||||
m_cmdStart = new Command(Start);
|
||||
return m_cmdStart;
|
||||
}
|
||||
}
|
||||
|
||||
// Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
||||
public void Start(Object param)
|
||||
{
|
||||
//int StartCommand;
|
||||
//if (SelOPState == MachineOperatingState.Pending)
|
||||
//{
|
||||
// StartCommand = (int)ISOCNC.Remoting.Commands.Start_Program_Soft;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// StartCommand = (int)ISOCNC.Remoting.Commands.Start;
|
||||
//}
|
||||
//Tpa.remObject.SetCommand(StartCommand);
|
||||
Tpa.remObject.SetCommand((int)ISOCNC.Remoting.Commands.Start);
|
||||
Tpa.remObject.SetVariableCommand((int)ISOCNC.Remoting.VariableCommands.WriteVar, "0.FUNM.E80048", "0");
|
||||
|
||||
}
|
||||
|
||||
#endregion Start
|
||||
|
||||
#region Stop
|
||||
|
||||
// Returns a command that manage the MainWindow_Unloaded command
|
||||
public ICommand Stop_Command
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_cmdStop == null)
|
||||
m_cmdStop = new Command(Stop);
|
||||
return m_cmdStop;
|
||||
}
|
||||
}
|
||||
|
||||
// Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
||||
public void Stop(Object param)
|
||||
{
|
||||
Tpa.remObject.SetCommand((int)ISOCNC.Remoting.Commands.Stop);
|
||||
}
|
||||
|
||||
#endregion Stop
|
||||
|
||||
#region Step
|
||||
|
||||
// Returns a command that manage the MainWindow_Unloaded command
|
||||
public ICommand Step_Command
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_cmdStep == null)
|
||||
m_cmdStep = new Command(Step);
|
||||
return m_cmdStep;
|
||||
}
|
||||
}
|
||||
|
||||
// Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
||||
public void Step(Object param)
|
||||
{
|
||||
Tpa.remObject.SetCommand((int)ISOCNC.Remoting.Commands.End);
|
||||
Tpa.remObject.RemoveAllProgramsFromList();
|
||||
}
|
||||
|
||||
#endregion Step
|
||||
|
||||
#region SetPoint
|
||||
|
||||
// Returns a command that manage the MainWindow_Unloaded command
|
||||
public ICommand SetPoint_Command
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_cmdSetPoint == null)
|
||||
m_cmdSetPoint = new Command(SetPoint);
|
||||
return m_cmdSetPoint;
|
||||
}
|
||||
}
|
||||
|
||||
// Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
||||
public void SetPoint(Object param)
|
||||
{
|
||||
Tpa.remObject.SetCommand((int)ISOCNC.Remoting.Commands.SetPoint);
|
||||
}
|
||||
|
||||
#endregion SetPoint
|
||||
|
||||
#region PrintLabel
|
||||
|
||||
// Returns a command that manage the MainWindow_Unloaded command
|
||||
public ICommand PrintLabel_Command
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_cmdPrintLabel == null)
|
||||
m_cmdPrintLabel = new Command(PrintLabel);
|
||||
return m_cmdPrintLabel;
|
||||
}
|
||||
}
|
||||
|
||||
// Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
||||
public void PrintLabel(Object param)
|
||||
{
|
||||
EgtCNCPLCComm.ZebraPrinter.ZebraPrinter Test = new EgtCNCPLCComm.ZebraPrinter.ZebraPrinter();
|
||||
Test.Print();
|
||||
}
|
||||
|
||||
#endregion PrintLabel
|
||||
|
||||
#region SearchFilePath
|
||||
|
||||
// Returns a command that manage the MainWindow_Unloaded command
|
||||
public ICommand SearchFilePath_Command
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_cmdSearchFilePath == null)
|
||||
m_cmdSearchFilePath = new Command(SearchFilePath);
|
||||
return m_cmdSearchFilePath;
|
||||
}
|
||||
}
|
||||
|
||||
// Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
||||
public void SearchFilePath(Object param)
|
||||
{
|
||||
Microsoft.Win32.OpenFileDialog OpenFileDialog = new Microsoft.Win32.OpenFileDialog();
|
||||
if (OpenFileDialog.ShowDialog() == true)
|
||||
_ProgramPath = OpenFileDialog.FileName;
|
||||
NotifyPropertyChanged(nameof(ProgramPath));
|
||||
}
|
||||
|
||||
#endregion SearchFilePath
|
||||
|
||||
#region AddProgram
|
||||
|
||||
// Returns a command that manage the MainWindow_Unloaded command
|
||||
public ICommand AddProgram_Command
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_cmdAddProgram == null)
|
||||
m_cmdAddProgram = new Command(AddProgram);
|
||||
return m_cmdAddProgram;
|
||||
}
|
||||
}
|
||||
|
||||
// Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
||||
public void AddProgram(Object param)
|
||||
{
|
||||
//if (_ProgramIndex < 0)
|
||||
//{
|
||||
// string Path = _ProgramPath.Replace("\\\\", "\\");
|
||||
// bool x = Tpa.remObject.AddProgramToList(Path);
|
||||
//}
|
||||
//else
|
||||
// Tpa.remObject.AddProgramToListAtIndex(_ProgramPath, _ProgramIndex);
|
||||
if (SelOPState == MachineOperatingState.Pending)
|
||||
{
|
||||
string Path = _ProgramPath.Replace("\\\\", "\\");
|
||||
bool x = Tpa.remObject.AddProgramToList(Path);
|
||||
Tpa.remObject.SetCommand((int)ISOCNC.Remoting.Commands.Start_Program_Soft);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endregion AddProgram
|
||||
|
||||
#region RemoveProgram
|
||||
|
||||
// Returns a command that manage the MainWindow_Unloaded command
|
||||
public ICommand RemoveProgram_Command
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_cmdRemoveProgram == null)
|
||||
m_cmdRemoveProgram = new Command(RemoveProgram);
|
||||
return m_cmdRemoveProgram;
|
||||
}
|
||||
}
|
||||
|
||||
// Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
||||
public void RemoveProgram(Object param)
|
||||
{
|
||||
if ((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift)
|
||||
Tpa.remObject.RemoveAllProgramsFromList();
|
||||
else if (_ProgramIndex < 0)
|
||||
Tpa.remObject.RemoveProgramFromList(_ProgramPath);
|
||||
else
|
||||
Tpa.remObject.RemoveProgramFromListAtIndex(_ProgramIndex);
|
||||
}
|
||||
|
||||
#endregion RemoveProgram
|
||||
|
||||
#region ReadVar
|
||||
|
||||
// Returns a command that manage the MainWindow_Unloaded command
|
||||
public ICommand ReadVar_Command
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_cmdReadVar == null)
|
||||
m_cmdReadVar = new Command(ReadVar);
|
||||
return m_cmdReadVar;
|
||||
}
|
||||
}
|
||||
|
||||
// Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
||||
public void ReadVar(Object param)
|
||||
{
|
||||
Tpa.remObject.SetVariableCommand((int)ISOCNC.Remoting.VariableCommands.ReadVar, _VarName, _VarValue);
|
||||
}
|
||||
|
||||
#endregion ReadVar
|
||||
|
||||
#region WriteVar
|
||||
|
||||
// Returns a command that manage the MainWindow_Unloaded command
|
||||
public ICommand WriteVar_Command
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_cmdWriteVar == null)
|
||||
m_cmdWriteVar = new Command(WriteVar);
|
||||
return m_cmdWriteVar;
|
||||
}
|
||||
}
|
||||
|
||||
// Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
||||
public void WriteVar(Object param)
|
||||
{
|
||||
Tpa.remObject.SetVariableCommand((int)ISOCNC.Remoting.VariableCommands.WriteVar, _VarName, _VarValue);
|
||||
}
|
||||
|
||||
#endregion WriteVar
|
||||
|
||||
#region DeleteAlarms
|
||||
|
||||
// Returns a command that manage the MainWindow_Unloaded command
|
||||
public ICommand DeleteAlarms_Command
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_cmdDeleteAlarms == null)
|
||||
m_cmdDeleteAlarms = new Command(DeleteAlarms);
|
||||
return m_cmdDeleteAlarms;
|
||||
}
|
||||
}
|
||||
|
||||
// Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
||||
public void DeleteAlarms(Object param)
|
||||
{
|
||||
Tpa.remObject.DeleteAlarms((int)ISOCNC.Remoting.AlarmType.ISO);
|
||||
//Tpa.remObject.GetListInfo(ISOCNC.Remoting.ListInfoRequested.ProgramList, -1);
|
||||
}
|
||||
|
||||
#endregion DeleteAlarms
|
||||
|
||||
#endregion COMMANDS
|
||||
|
||||
}
|
||||
|
||||
class Axis : VMBase
|
||||
{
|
||||
private string _Name;
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Name;
|
||||
}
|
||||
set
|
||||
{
|
||||
_Name = value;
|
||||
}
|
||||
}
|
||||
|
||||
private double _Value;
|
||||
public double Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
_Value = value;
|
||||
}
|
||||
}
|
||||
public Axis(string Name)
|
||||
{
|
||||
_Name = Name;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,348 @@
|
||||
Imports System.Threading
|
||||
Imports System.Math
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
Imports EgtBEAMWALL.Core
|
||||
|
||||
Public Class MainWindowM
|
||||
|
||||
#Region "FIELDS"
|
||||
|
||||
' massimo numero di istanze del programma ammesse
|
||||
Const MAX_INST As Integer = 1
|
||||
|
||||
Private m_sDataRoot As String = String.Empty
|
||||
Friend ReadOnly Property sDataRoot As String
|
||||
Get
|
||||
Return m_sDataRoot
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_sConfigDir As String = String.Empty
|
||||
Public ReadOnly Property sConfigDir As String
|
||||
Get
|
||||
Return m_sConfigDir
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_nDebug As Integer = 0
|
||||
|
||||
Private m_objMutex As Mutex
|
||||
|
||||
Private m_bFirstInstance As Boolean = False
|
||||
Friend ReadOnly Property bFirstInstance As Boolean
|
||||
Get
|
||||
Return m_bFirstInstance
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_nInstance As Integer = 0
|
||||
Friend ReadOnly Property nInstance As Integer
|
||||
Get
|
||||
Return m_nInstance
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_nUserLevel As Integer = 1
|
||||
Friend ReadOnly Property nUserLevel As Integer
|
||||
Get
|
||||
Return m_nUserLevel
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_nKeyLevel As Integer = 0
|
||||
Friend ReadOnly Property nKeyLevel As Integer
|
||||
Get
|
||||
Return m_nKeyLevel
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_nKeyOptions As UInteger = 0
|
||||
Friend ReadOnly Property nKeyOptions As Integer
|
||||
Get
|
||||
Return m_nKeyOptions
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_bAutoNestOption As Boolean = False
|
||||
Friend ReadOnly Property AutoNestOption As Boolean
|
||||
Get
|
||||
Return m_bAutoNestOption
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Friend ReadOnly Property sVersion As String
|
||||
Get
|
||||
Return My.Application.Info.Version.Major.ToString() & "." &
|
||||
My.Application.Info.Version.Minor.ToString() &
|
||||
(ChrW(97 - 1 + My.Application.Info.Version.Build)).ToString() &
|
||||
My.Application.Info.Version.Revision.ToString()
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_sTempDir As String
|
||||
Friend ReadOnly Property sTempDir As String
|
||||
Get
|
||||
Return m_sTempDir
|
||||
End Get
|
||||
End Property
|
||||
Private m_sMachinesRoot As String
|
||||
Friend ReadOnly Property sMachinesRoot As String
|
||||
Get
|
||||
Return m_sMachinesRoot
|
||||
End Get
|
||||
End Property
|
||||
Private m_sBeamRoot As String
|
||||
Friend ReadOnly Property sBeamRoot As String
|
||||
Get
|
||||
Return m_sBeamRoot
|
||||
End Get
|
||||
End Property
|
||||
Private m_sWallRoot As String
|
||||
Friend ReadOnly Property sWallRoot As String
|
||||
Get
|
||||
Return m_sWallRoot
|
||||
End Get
|
||||
End Property
|
||||
Private m_sWarehouseRoot As String
|
||||
Friend ReadOnly Property sWarehouseRoot As String
|
||||
Get
|
||||
Return m_sWarehouseRoot
|
||||
End Get
|
||||
End Property
|
||||
Private m_sToolMakersDir As String
|
||||
Friend ReadOnly Property sToolMakersDir As String
|
||||
Get
|
||||
Return m_sToolMakersDir
|
||||
End Get
|
||||
End Property
|
||||
Private m_sResourcesRoot As String
|
||||
Friend ReadOnly Property sResourcesRoot As String
|
||||
Get
|
||||
Return m_sResourcesRoot
|
||||
End Get
|
||||
End Property
|
||||
Private m_sLogFile As String
|
||||
Friend ReadOnly Property sLogFile As String
|
||||
Get
|
||||
Return m_sLogFile
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Friend ReadOnly Property sProjsDir As String
|
||||
Get
|
||||
Return m_sDataRoot & "\" & PROJS_DIR
|
||||
End Get
|
||||
End Property
|
||||
Friend ReadOnly Property sProdsDir As String
|
||||
Get
|
||||
Return m_sDataRoot & "\" & PRODS_DIR
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' File ini della macchina
|
||||
Private m_sMachIniFile As String = String.Empty
|
||||
Public ReadOnly Property sMachIniFile As String
|
||||
Get
|
||||
Return m_sMachIniFile
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region ' FIELDS
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New()
|
||||
InitializeEgtEnvironment()
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTOR
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Private Sub InitializeEgtEnvironment()
|
||||
'' Abilito drag and drop
|
||||
'Me.AllowDrop = True
|
||||
' Impostazione path radice per i dati
|
||||
m_sDataRoot = System.AppDomain.CurrentDomain.BaseDirectory
|
||||
If EgtUILib.GetPrivateProfileString(S_DATA, K_DATAROOT, "", m_sDataRoot, m_sDataRoot & "\" & DAT_FILE_NAME) = 0 Then
|
||||
m_sDataRoot = System.AppDomain.CurrentDomain.BaseDirectory
|
||||
End If
|
||||
' Impostazione direttorio di configurazione
|
||||
m_sConfigDir = m_sDataRoot & "\" & CONF_DIR
|
||||
' Impostazione direttorio per file temporanei
|
||||
m_sTempDir = m_sDataRoot & "\" & TEMP_DIR
|
||||
' Impostazione path Ini file
|
||||
IniFile.m_sIniFile = m_sConfigDir & "\" & INI_FILE_NAME
|
||||
' Impostazione path resources dir
|
||||
m_sResourcesRoot = m_sDataRoot & "\" & RES_DIR
|
||||
' Impostazione direttorio per le macchine
|
||||
If GetMainPrivateProfileString(S_MACH, K_MACHINESDIR, "", m_sMachinesRoot) = 0 Then
|
||||
m_sMachinesRoot = m_sDataRoot & "\" & MACHINES_DFL_DIR
|
||||
End If
|
||||
' Impostazione direttorio per toolmakers
|
||||
If GetMainPrivateProfileString(S_MACH, K_TOOLMAKERSDIR, "", m_sToolMakersDir) = 0 Then
|
||||
m_sToolMakersDir = m_sDataRoot & "\" & TOOLMAKERS_DFL_DIR
|
||||
End If
|
||||
' Verifico indice di istanza
|
||||
'ManageInstance()
|
||||
'' Imposto tipo di chiave
|
||||
'EgtSetLockType(KEY_TYPE.HW)
|
||||
'' Leggo e imposto chiave di protezione
|
||||
'Dim sLicFileName As String = String.Empty
|
||||
'GetMainPrivateProfileString(S_GENERAL, K_LICENCE, LIC_FILE_NAME, sLicFileName)
|
||||
'Dim sLicFile As String = m_sConfigDir & "\" & sLicFileName
|
||||
'Dim sKey As String = String.Empty
|
||||
'EgtUILib.GetPrivateProfileString(S_LICENCE, K_KEY, "", sKey, sLicFile)
|
||||
'EgtSetKey(sKey)
|
||||
'Dim sNestKey As String = ""
|
||||
'EgtUILib.GetPrivateProfileString(S_LICENCE, K_NESTKEY, "", sNestKey, sLicFile)
|
||||
'EgtSetNestKey(sNestKey)
|
||||
'' Verifico abilitazione nesting automatico
|
||||
'm_bAutoNestOption = Not String.IsNullOrWhiteSpace(sNestKey)
|
||||
'' Recupero livello e opzioni della chiave
|
||||
'Dim bKey As Boolean = EgtGetKeyLevel(5327, 2308, 1, m_nKeyLevel) And
|
||||
' EgtGetKeyOptions(5327, 2308, 1, m_nKeyOptions)
|
||||
'' Inizializzazione generale di EgtInterface
|
||||
'm_nDebug = GetMainPrivateProfileInt(S_GENERAL, K_DEBUG, 0)
|
||||
'm_sLogFile = m_sTempDir & "\" & GENLOG_FILE_NAME.Replace("#", m_nInstance.ToString())
|
||||
'Dim sLogMsg As String = "User " & Environment.MachineName & "\" & Environment.UserName & " (" & m_nInstance.ToString() & ")" & vbLf &
|
||||
' My.Application.Info.Title.ToString() & " ver. " &
|
||||
' My.Application.Info.Version.Major.ToString() &
|
||||
' "." & My.Application.Info.Version.Minor.ToString() &
|
||||
' (ChrW(97 - 1 + My.Application.Info.Version.Build)).ToString() &
|
||||
' My.Application.Info.Version.Revision.ToString()
|
||||
'EgtInit(m_nDebug, m_sLogFile, sLogMsg)
|
||||
'EgtSetTempDir(m_sTempDir)
|
||||
'EgtSetIniFile(IniFile.m_sIniFile)
|
||||
'' Leggo direttorio dei messaggi (se manca uso direttorio di configurazione)
|
||||
'Dim sMsgDir As String = String.Empty
|
||||
'If GetMainPrivateProfileString(S_GENERAL, K_MESSAGESDIR, "", sMsgDir) = 0 Then
|
||||
' sMsgDir = m_sConfigDir
|
||||
'End If
|
||||
'' Leggo lingua corrente
|
||||
'Dim sLanguage As String = String.Empty
|
||||
'GetMainPrivateProfileString(S_GENERAL, K_MESSAGES, "", sLanguage)
|
||||
'' Recupero nome file dei messaggi della lingua corrente
|
||||
'Dim sMsgName As String = "EgalTechIta.txt"
|
||||
'Dim nIndex As Integer = 1
|
||||
'While True
|
||||
' Dim ReadLanguage As Language = GetMainPrivateProfileLanguage(S_LANGUAGES, K_LANGUAGE & nIndex)
|
||||
' If IsNothing(ReadLanguage) Then Exit While
|
||||
' If String.Compare(ReadLanguage.Name, sLanguage, True) = 0 Then
|
||||
' sMsgName = ReadLanguage.FilePath
|
||||
' Exit While
|
||||
' End If
|
||||
' nIndex += 1
|
||||
'End While
|
||||
'' Leggo file messaggi
|
||||
'Dim sMsgFilePath As String = sMsgDir & "\" & sMsgName
|
||||
'If Not EgtLoadMessages(sMsgFilePath) Then
|
||||
' EgtOutLog("Error in EgtLoadMessages")
|
||||
'End If
|
||||
'' Leggo e imposto unità di misura per interfaccia utente
|
||||
'EgtSetUiUnits(GetMainPrivateProfileInt(S_SCENE, K_MMUNITS, 1) <> 0)
|
||||
' Leggo e imposto livello utilizzatore
|
||||
m_nUserLevel = Math.Min(m_nKeyLevel, GetMainPrivateProfileInt(S_GENERAL, K_USERLEVEL, 1))
|
||||
' Imposto dir font Nfe e font default
|
||||
Dim sNfeDir As String = String.Empty
|
||||
GetMainPrivateProfileString(S_GEOMDB, K_NFEFONTDIR, "", sNfeDir)
|
||||
Dim sDefFont As String = String.Empty
|
||||
GetMainPrivateProfileString(S_GEOMDB, K_DEFAULTFONT, "", sDefFont)
|
||||
EgtSetFont(sNfeDir, sDefFont)
|
||||
' imposto dir di default per libreria Lua e lancio libreria di base
|
||||
Dim sLuaLibsDir As String = String.Empty
|
||||
GetMainPrivateProfileString(S_LUA, K_LIBSDIR, "", sLuaLibsDir)
|
||||
EgtSetLuaLibs(sLuaLibsDir)
|
||||
Dim sLuaBaseLib As String = String.Empty
|
||||
GetMainPrivateProfileString(S_LUA, K_BASELIB, "EgtBase", sLuaBaseLib)
|
||||
EgtLuaRequire(sLuaBaseLib)
|
||||
'' Info su opzioni chiave
|
||||
'EgtOutLog("KeyOptions : " & bKey.ToString() & " " & m_nKeyOptions.ToString())
|
||||
End Sub
|
||||
|
||||
Friend Sub SetMachIniFile(sPath As String)
|
||||
m_sMachIniFile = sPath
|
||||
End Sub
|
||||
|
||||
'Private Sub ManageInstance()
|
||||
' Dim bCreated As Boolean
|
||||
' Try
|
||||
' m_objMutex = New Mutex(False, "Global\OmagOFFICE", bCreated)
|
||||
' Catch
|
||||
' bCreated = False
|
||||
' End Try
|
||||
' m_bFirstInstance = bCreated
|
||||
' If bCreated Then
|
||||
' ' Prima istanza
|
||||
' m_nInstance = 1
|
||||
' ' Aggiorno stato istanze attive
|
||||
' WriteMainPrivateProfileString(S_GENERAL, K_INSTANCES, m_nInstance.ToString())
|
||||
' Else
|
||||
' ' Leggo il massimo numero di istanze ammesse
|
||||
' Dim nMaxInst As Integer = GetMaxInstances()
|
||||
' ' Cerco il primo indice di istanza libero
|
||||
' Dim nTmp As Integer = GetMainPrivateProfileInt(S_GENERAL, K_INSTANCES, 0)
|
||||
' m_nInstance = 1
|
||||
' Dim nMask As Integer = 1
|
||||
' While (nTmp And nMask) <> 0 And m_nInstance < MAX_INST
|
||||
' m_nInstance += 1
|
||||
' nMask *= 2
|
||||
' End While
|
||||
' ' Se l'indice supera il massimo
|
||||
' If m_nInstance > nMaxInst Then
|
||||
' ' porto in primo piano la prima istanza
|
||||
' Dim bFound As Boolean = False
|
||||
' ' processi del programma a 32 bit
|
||||
' Dim localProc As Process() = Process.GetProcessesByName("OmagOFFICER32")
|
||||
' For Each p As Process In localProc
|
||||
' If p.Id <> Process.GetCurrentProcess().Id Then
|
||||
' bFound = True
|
||||
' ShowWindow(p.MainWindowHandle, 1)
|
||||
' Exit For
|
||||
' End If
|
||||
' Next
|
||||
' ' se non trovati processi a 32 bit provo a 64 bit
|
||||
' If Not bFound Then
|
||||
' localProc = Process.GetProcessesByName("OmagOFFICER64")
|
||||
' For Each p As Process In localProc
|
||||
' If p.Id <> Process.GetCurrentProcess().Id Then
|
||||
' bFound = True
|
||||
' ShowWindow(p.MainWindowHandle, SW.RESTORE)
|
||||
' Exit For
|
||||
' End If
|
||||
' Next
|
||||
' End If
|
||||
' ' esco dal programma
|
||||
' End
|
||||
' End If
|
||||
' ' Aggiorno stato istanze attive
|
||||
' nTmp += (1 << (m_nInstance - 1))
|
||||
' WriteMainPrivateProfileString(S_GENERAL, K_INSTANCES, nTmp.ToString())
|
||||
' End If
|
||||
'End Sub
|
||||
|
||||
'Friend Function GetKeyOption(nKeyOpt As KEY_OPT) As Boolean
|
||||
' Return ((m_nKeyOptions And nKeyOpt) <> 0)
|
||||
'End Function
|
||||
|
||||
'Friend Function GetMaxInstances() As Integer
|
||||
' ' Leggo il massimo numero di istanze ammesse
|
||||
' Dim nMaxInst As Integer = GetMainPrivateProfileInt(S_GENERAL, K_MAXINST, 1)
|
||||
' Return Max(1, Min(nMaxInst, MAX_INST))
|
||||
'End Function
|
||||
|
||||
Friend Sub Close()
|
||||
' Terminazione generale di EgtInterface
|
||||
EgtExit()
|
||||
' Rilascio mutex
|
||||
If Not IsNothing(m_objMutex) Then m_objMutex.Close()
|
||||
' Aggiorno istanze usate
|
||||
Dim nTmp As Integer = GetMainPrivateProfileInt(S_GENERAL, K_INSTANCES, 0)
|
||||
nTmp -= (1 << (m_nInstance - 1))
|
||||
WriteMainPrivateProfileString(S_GENERAL, K_INSTANCES, nTmp.ToString())
|
||||
End Sub
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,89 @@
|
||||
<EgtWPFLib5:EgtCustomWindow x:Class="MainWindowV"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
|
||||
xmlns:EgtCOMMTest="clr-namespace:EgtCOMMTest"
|
||||
DataContext="{StaticResource MainWindowVM}"
|
||||
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
|
||||
Title="{Binding Title}" Icon="/Resources/EgtCOMMTest.ico"
|
||||
MinHeight="800" MinWidth="800"
|
||||
AboutBoxCommand="{Binding AboutBox_Command}"
|
||||
CloseCommand="{Binding CloseApplication_Command,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}">
|
||||
|
||||
<StackPanel>
|
||||
<UniformGrid Rows="1">
|
||||
<RadioButton Content="Tpa"
|
||||
IsChecked="{Binding Tpa_IsChecked}"
|
||||
Style="{StaticResource MainMenu_ToggleButton}"/>
|
||||
<RadioButton Content="Num"
|
||||
IsChecked="{Binding Num_Flexium_IsChecked}"
|
||||
Style="{StaticResource MainMenu_ToggleButton}"/>
|
||||
</UniformGrid>
|
||||
<GroupBox Header="MachCommandMessagePanel">
|
||||
<EgtCOMMTest:MachCommandMessagePanelV DataContext="{StaticResource MachCommandMessagePanelVM}"/>
|
||||
</GroupBox>
|
||||
<!--<Button Content="CANCELLA ALLARMI"
|
||||
Command="{Binding DeleteAlarms_Command}"/>-->
|
||||
<GroupBox Header="CNC files manager">
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding ProgramPath}"/>
|
||||
<Button Content="..."
|
||||
Command="{Binding SearchFilePath_Command}"/>
|
||||
<TextBox Text="{Binding ProgramIndex}"/>
|
||||
<Button Content="Add"
|
||||
Command="{Binding AddProgram_Command}"/>
|
||||
<Button Content="Remove"
|
||||
Command="{Binding RemoveProgram_Command}"/>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
<GroupBox Header="Read/Write variables">
|
||||
<EgtCOMMTest:VariablesListV DataContext="{StaticResource VariablesListVM}"/>
|
||||
<!--<StackPanel>
|
||||
<TextBlock Text="Name:"/>
|
||||
<TextBox Text="{Binding VarName}"/>
|
||||
<TextBlock Text="Value:"/>
|
||||
<TextBox Text="{Binding VarValue}"/>
|
||||
<Button Content="Read"
|
||||
Command="{Binding ReadVar_Command}"/>
|
||||
<Button Content="Write"
|
||||
Command="{Binding WriteVar_Command}"/>
|
||||
</StackPanel>-->
|
||||
</GroupBox>
|
||||
<GroupBox Header="Axis">
|
||||
<!--<ItemsControl ItemsSource="{Binding AxisList}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<UniformGrid Columns="2">
|
||||
<TextBlock Text="{Binding sName}"/>
|
||||
<TextBlock Text="{Binding sValue}"/>
|
||||
</UniformGrid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>-->
|
||||
<EgtCOMMTest:AxesPanelV DataContext="{StaticResource AxesPanelVM}"/>
|
||||
</GroupBox>
|
||||
<GroupBox Header="OPState">
|
||||
<ComboBox ItemsSource="{Binding OPStateList}"
|
||||
SelectedItem="{Binding SelOPState}"
|
||||
DisplayMemberPath="Name"/>
|
||||
</GroupBox>
|
||||
|
||||
<GroupBox Header="Channel">
|
||||
<ComboBox ItemsSource="{Binding ChannelList}"
|
||||
SelectedItem="{Binding SelChannel}"/>
|
||||
</GroupBox>
|
||||
<GroupBox Header="MDI">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox Text="{Binding MDI_Text}"/>
|
||||
<Button Grid.Column="1"
|
||||
Content="OK"
|
||||
Command="{Binding MDI_Command}"/>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
</StackPanel>
|
||||
|
||||
</EgtWPFLib5:EgtCustomWindow>
|
||||
@@ -0,0 +1,46 @@
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Class MainWindowV
|
||||
|
||||
Private m_MainWindowVM As MainWindowVM
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New()
|
||||
' Funzione che interpreta l'xaml
|
||||
InitializeComponent()
|
||||
' Assegno al riferimento locale al VM il VM preso dal DataContext
|
||||
m_MainWindowVM = DirectCast(Me.DataContext, MainWindowVM)
|
||||
'AddHandler Me.Loaded, AddressOf MainWindowV_Loaded
|
||||
AddHandler Me.ContentRendered, AddressOf MainWindowV_ContentRendered
|
||||
'AddHandler Me.Closing, AddressOf MainWindowV_Closing
|
||||
'AddHandler Me.KeyDown, AddressOf MainWindowV_KeyDown
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTOR
|
||||
|
||||
#Region "EVENTS"
|
||||
|
||||
'Private Sub MainWindowV_Loaded(sender As Object, e As RoutedEventArgs)
|
||||
' ' Carico e imposto posizione finestra
|
||||
' WinPosFromIniToWindow(S_GENERAL, K_WINPLACE, Me)
|
||||
'End Sub
|
||||
|
||||
Private Sub MainWindowV_ContentRendered(sender As Object, e As EventArgs)
|
||||
m_MainWindowVM.ContentRendered()
|
||||
End Sub
|
||||
|
||||
'Private Sub MainWindowV_Closing(sender As Object, e As System.ComponentModel.CancelEventArgs)
|
||||
' ' Salvo posizione finestra (se non minimizzata)
|
||||
' If WindowState <> WindowState.Minimized Then
|
||||
' WinPosFromWindowToIni(Me, S_GENERAL, K_WINPLACE)
|
||||
' End If
|
||||
'End Sub
|
||||
|
||||
'Private Sub MainWindowV_KeyDown(sender As Object, e As KeyEventArgs)
|
||||
' m_MainWindowVM.KeyDown(e.Key)
|
||||
'End Sub
|
||||
|
||||
#End Region ' EVENTS
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,388 @@
|
||||
Imports System.Threading
|
||||
Imports EgtCOMMTest.MachCommandMessagePanelVM
|
||||
Imports EgtWPFLib5
|
||||
Imports EgtUILib
|
||||
|
||||
Public Class MainWindowVM
|
||||
Inherits VMBase
|
||||
|
||||
Public Enum NCTypes As Integer
|
||||
NULL = 0
|
||||
TPA = 1
|
||||
NUM_FLEXIUM = 2
|
||||
End Enum
|
||||
|
||||
' Riferimento al Model della MainWindow
|
||||
Private m_MainWindowM As MainWindowM
|
||||
Friend ReadOnly Property MainWindowM As MainWindowM
|
||||
Get
|
||||
Return m_MainWindowM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' Titolo
|
||||
Private m_Title As String
|
||||
Public ReadOnly Property Title As String
|
||||
Get
|
||||
Return m_Title
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Property Num_Flexium_IsChecked As Boolean
|
||||
Get
|
||||
Return m_SelNCType = NCTypes.NUM_FLEXIUM
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
If value Then m_SelNCType = NCTypes.NUM_FLEXIUM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property Tpa_IsChecked As Boolean
|
||||
Get
|
||||
Return m_SelNCType = NCTypes.TPA
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
If value Then m_SelNCType = NCTypes.TPA
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_SelNCType As NCTypes = NCTypes.NULL
|
||||
Public Property SelNCType As Integer
|
||||
Get
|
||||
Return m_SelNCType
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_SelNCType = value
|
||||
NotifyPropertyChanged(NameOf(Tpa_IsChecked))
|
||||
NotifyPropertyChanged(NameOf(Num_Flexium_IsChecked))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_ChannelList As List(Of String)
|
||||
Public ReadOnly Property ChannelList As List(Of String)
|
||||
Get
|
||||
Return m_ChannelList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_SelChannel As String
|
||||
Public Property SelChannel As String
|
||||
Get
|
||||
Return m_SelChannel
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_SelChannel = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_CurrMachineName As String
|
||||
|
||||
Private m_ProgramPath As String
|
||||
|
||||
Public ReadOnly Property ProgramPath As String
|
||||
Get
|
||||
Return m_ProgramPath
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_ProgramIndex As Integer = 0
|
||||
|
||||
Public Property ProgramIndex As Integer
|
||||
Get
|
||||
Return m_ProgramIndex
|
||||
End Get
|
||||
Set(ByVal value As Integer)
|
||||
m_ProgramIndex = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'Private m_OPState As MachineOperatingState
|
||||
|
||||
'Public ReadOnly Property OPState As MachineOperatingState
|
||||
' Get
|
||||
' Return m_OPState
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
'Public ReadOnly Property sOPState As String
|
||||
' Get
|
||||
' Select Case m_OPState
|
||||
' Case MachineOperatingState.Start
|
||||
' Return "START"
|
||||
' Case MachineOperatingState.Stop
|
||||
' Return "STOP"
|
||||
' Case MachineOperatingState.End
|
||||
' Return "RESET"
|
||||
' Case MachineOperatingState.SetPoint
|
||||
' Return "SETPOINT"
|
||||
' Case MachineOperatingState.Pending
|
||||
' Return "PENDING"
|
||||
' Case Else
|
||||
' Return "UNSPECIFIED"
|
||||
' End Select
|
||||
' End Get
|
||||
'End Property
|
||||
'Public Sub SetOPState(value As MachineOperatingState)
|
||||
' m_OPState = value
|
||||
' NotifyPropertyChanged(NameOf(OPState))
|
||||
' NotifyPropertyChanged(NameOf(sOPState))
|
||||
'End Sub
|
||||
|
||||
Private _OPStateList As List(Of OPState)
|
||||
|
||||
Public Property OPStateList As List(Of OPState)
|
||||
Get
|
||||
Return _OPStateList
|
||||
End Get
|
||||
Set(ByVal value As List(Of OPState))
|
||||
_OPStateList = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private _SelOPState As OPState
|
||||
|
||||
Public Property SelOPState As OPState
|
||||
Get
|
||||
Return _SelOPState
|
||||
End Get
|
||||
Set(ByVal value As OPState)
|
||||
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.SETOP, value.Id))
|
||||
_SelOPState = value
|
||||
End Set
|
||||
End Property
|
||||
Friend Sub SetOPState(value As OPState)
|
||||
_SelOPState = value
|
||||
NotifyPropertyChanged(NameOf(SelOPState))
|
||||
End Sub
|
||||
|
||||
Private m_MDI_Text As String
|
||||
Public Property MDI_Text As String
|
||||
Get
|
||||
Return m_MDI_Text
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_MDI_Text = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' Definizione comandi
|
||||
Private m_cmdAboutBox As ICommand
|
||||
Private m_cmdCloseApplication As ICommand
|
||||
Private m_cmdSearchFilePath As ICommand
|
||||
Private m_cmdAddProgram As ICommand
|
||||
Private m_cmdRemoveProgram As ICommand
|
||||
Private m_cmdReadVar As ICommand
|
||||
Private m_cmdWriteVar As ICommand
|
||||
Private m_cmdMDI As ICommand
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New()
|
||||
' Avvio l'inizializzazione della mappa passandogli il riferimento al MainWindowVM
|
||||
Map.BeginInit(Me)
|
||||
' Creo Model della MainWindow
|
||||
m_MainWindowM = New MainWindowM
|
||||
' leggo macchina corrente
|
||||
GetMainPrivateProfileString(S_MACH, K_CURRMACH, "", m_CurrMachineName)
|
||||
' Impostazione path MachIni file
|
||||
MainWindowM.SetMachIniFile(MainWindowM.sMachinesRoot & "\" & m_CurrMachineName & "\" & m_CurrMachineName & ".ini")
|
||||
' recupero tipo di controllo
|
||||
SelNCType = GetPrivateProfileInt(S_GENERAL, K_NCTYPE, 0, Map.refMainWindowVM.MainWindowM.sMachIniFile)
|
||||
' carico stati della macchina
|
||||
Select Case SelNCType
|
||||
Case NCTypes.TPA
|
||||
_OPStateList = New List(Of OPState) From {
|
||||
New OPState("Start", 1),
|
||||
New OPState("Stop", 2),
|
||||
New OPState("End", 3),
|
||||
New OPState("SetPoint", 4),
|
||||
New OPState("Pending", 5),
|
||||
New OPState("Unspecified", 100)
|
||||
}
|
||||
Case NCTypes.NUM_FLEXIUM
|
||||
_OPStateList = New List(Of OPState) From {
|
||||
New OPState("Auto", 0),
|
||||
New OPState("Single", 1),
|
||||
New OPState("Mdi", 2),
|
||||
New OPState("Manual", 7),
|
||||
New OPState("Home", 8)
|
||||
}
|
||||
End Select
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTOR
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Friend Sub SetTitle(sTitle As String)
|
||||
m_Title = sTitle
|
||||
NotifyPropertyChanged(NameOf(Title))
|
||||
End Sub
|
||||
Public Sub UpdateTitle()
|
||||
m_Title = "EgtCOMMTest"
|
||||
NotifyPropertyChanged(NameOf(Title))
|
||||
End Sub
|
||||
|
||||
Friend Sub ContentRendered()
|
||||
|
||||
'' inizializzo thread di aggiornamento e comunicazione con DB
|
||||
'' creo thread gestione macchina
|
||||
'm_ViewerOptimizerCommThread = New Thread(Sub()
|
||||
' ViewerOptimizerCommThread.ViewerOptimizerCommThreadFunction()
|
||||
' End Sub)
|
||||
'm_ViewerOptimizerCommThread.SetApartmentState(ApartmentState.STA)
|
||||
'' avvio thread di gestione della macchina che avvia la connessione
|
||||
'm_ViewerOptimizerCommThread.Start()
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
#Region "COMMANDS"
|
||||
|
||||
#Region "AboutBoxCommand"
|
||||
|
||||
' Returns a command that manage the MainWindow_Unloaded command
|
||||
Public ReadOnly Property AboutBox_Command As ICommand
|
||||
Get
|
||||
If m_cmdAboutBox Is Nothing Then
|
||||
m_cmdAboutBox = New Command(AddressOf AboutBox)
|
||||
End If
|
||||
Return m_cmdAboutBox
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
||||
Public Sub AboutBox(ByVal param As Object)
|
||||
'Dim AboutBoxWindow As New AboutBoxV
|
||||
'AboutBoxWindow.Owner = Application.Current.MainWindow
|
||||
'AboutBoxWindow.ShowDialog()
|
||||
End Sub
|
||||
|
||||
#End Region ' AboutBoxCommand
|
||||
|
||||
#Region "CloseApplication"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Exec.
|
||||
''' </summary>
|
||||
Public ReadOnly Property CloseApplication_Command As ICommand
|
||||
Get
|
||||
If m_cmdCloseApplication Is Nothing Then
|
||||
m_cmdCloseApplication = New Command(AddressOf CloseApplication)
|
||||
End If
|
||||
Return m_cmdCloseApplication
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Exec. This method is invoked by the ExecCommand.
|
||||
''' </summary>
|
||||
Public Sub CloseApplication()
|
||||
' disconnetto comunicazione con macchina
|
||||
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.DISCONNECT))
|
||||
'' termino thread di comunicazione con Db ed altri programmi
|
||||
'ViewerOptimizerCommThread.StopThread()
|
||||
'' Verifico modifica parametri in Configurazione e chiedo il salvataggio
|
||||
'If Map.refMainMenuVM.SelPage = Pages.CONFIG Then Map.refConfigurationPageVM.VerifyConfigPageModification()
|
||||
' Chiudo la finestra principale del programma
|
||||
Application.Current.MainWindow.Close()
|
||||
End Sub
|
||||
|
||||
#End Region ' CloseApplication
|
||||
|
||||
Public ReadOnly Property SearchFilePath_Command As ICommand
|
||||
Get
|
||||
If m_cmdSearchFilePath Is Nothing Then m_cmdSearchFilePath = New Command(AddressOf SearchFilePath)
|
||||
Return m_cmdSearchFilePath
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub SearchFilePath(ByVal param As Object)
|
||||
Dim OpenFileDialog As Microsoft.Win32.OpenFileDialog = New Microsoft.Win32.OpenFileDialog()
|
||||
If OpenFileDialog.ShowDialog() = True Then m_ProgramPath = OpenFileDialog.FileName
|
||||
NotifyPropertyChanged(NameOf(ProgramPath))
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property AddProgram_Command As ICommand
|
||||
Get
|
||||
If m_cmdAddProgram Is Nothing Then m_cmdAddProgram = New Command(AddressOf AddProgram)
|
||||
Return m_cmdAddProgram
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub AddProgram(ByVal param As Object)
|
||||
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.SENDPROG, {}, {}, {m_ProgramPath, "%770"}))
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property RemoveProgram_Command As ICommand
|
||||
Get
|
||||
If m_cmdRemoveProgram Is Nothing Then m_cmdRemoveProgram = New Command(AddressOf RemoveProgram)
|
||||
Return m_cmdRemoveProgram
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub RemoveProgram(ByVal param As Object)
|
||||
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.REMOVEPROG))
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property ReadVar_Command As ICommand
|
||||
Get
|
||||
If m_cmdReadVar Is Nothing Then m_cmdReadVar = New Command(AddressOf ReadVar)
|
||||
Return m_cmdReadVar
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub ReadVar(ByVal param As Object)
|
||||
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.READ_TPA))
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property WriteVar_Command As ICommand
|
||||
Get
|
||||
If m_cmdWriteVar Is Nothing Then m_cmdWriteVar = New Command(AddressOf WriteVar)
|
||||
Return m_cmdWriteVar
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub WriteVar(ByVal param As Object)
|
||||
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.WRITE))
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property MDI_Command As ICommand
|
||||
Get
|
||||
If m_cmdMDI Is Nothing Then m_cmdMDI = New Command(AddressOf MDI)
|
||||
Return m_cmdMDI
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub MDI(ByVal param As Object)
|
||||
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.MDI, m_MDI_Text))
|
||||
End Sub
|
||||
|
||||
#End Region ' COMMANDS
|
||||
|
||||
End Class
|
||||
|
||||
Public Class OPState
|
||||
|
||||
Private m_Name As String
|
||||
Public ReadOnly Property Name As String
|
||||
Get
|
||||
Return m_Name
|
||||
End Get
|
||||
End Property
|
||||
Private m_Id As Integer
|
||||
Public ReadOnly Property Id As Integer
|
||||
Get
|
||||
Return m_Id
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Sub New(Name As String, Id As Integer)
|
||||
m_Name = Name
|
||||
m_Id = Id
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,59 @@
|
||||
Imports System
|
||||
Imports System.Globalization
|
||||
Imports System.Reflection
|
||||
Imports System.Resources
|
||||
Imports System.Runtime.InteropServices
|
||||
Imports System.Windows
|
||||
|
||||
' General Information about an assembly is controlled through the following
|
||||
' set of attributes. Change these attribute values to modify the information
|
||||
' associated with an assembly.
|
||||
|
||||
' Review the values of the assembly attributes
|
||||
|
||||
<Assembly: AssemblyTitle("EgtCOMMTest")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("")>
|
||||
<Assembly: AssemblyProduct("EgtCOMMTest")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2021")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
<Assembly: ComVisible(false)>
|
||||
|
||||
'In order to begin building localizable applications, set
|
||||
'<UICulture>CultureYouAreCodingWith</UICulture> in your .vbproj file
|
||||
'inside a <PropertyGroup>. For example, if you are using US english
|
||||
'in your source files, set the <UICulture> to "en-US". Then uncomment the
|
||||
'NeutralResourceLanguage attribute below. Update the "en-US" in the line
|
||||
'below to match the UICulture setting in the project file.
|
||||
|
||||
'<Assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)>
|
||||
|
||||
|
||||
'The ThemeInfo attribute describes where any theme specific and generic resource dictionaries can be found.
|
||||
'1st parameter: where theme specific resource dictionaries are located
|
||||
'(used if a resource is not found in the page,
|
||||
' or application resource dictionaries)
|
||||
|
||||
'2nd parameter: where the generic resource dictionary is located
|
||||
'(used if a resource is not found in the page,
|
||||
'app, and any theme specific resource dictionaries)
|
||||
<Assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)>
|
||||
|
||||
|
||||
|
||||
'The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
<Assembly: Guid("7fc899b0-a8ad-4288-a660-f097fe959cef")>
|
||||
|
||||
' Version information for an assembly consists of the following four values:
|
||||
'
|
||||
' Major Version
|
||||
' Minor Version
|
||||
' Build Number
|
||||
' Revision
|
||||
'
|
||||
' You can specify all the values or you can default the Build and Revision Numbers
|
||||
' by using the '*' as shown below:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.0.0.0")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||
@@ -0,0 +1,121 @@
|
||||
#If _MyType <> "Empty" Then
|
||||
|
||||
Namespace My
|
||||
''' <summary>
|
||||
''' Module used to define the properties that are available in the My Namespace for WPF
|
||||
''' </summary>
|
||||
''' <remarks></remarks>
|
||||
<Global.Microsoft.VisualBasic.HideModuleName()> _
|
||||
Module MyWpfExtension
|
||||
Private s_Computer As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.Devices.Computer)
|
||||
Private s_User As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.ApplicationServices.User)
|
||||
Private s_Windows As New ThreadSafeObjectProvider(Of MyWindows)
|
||||
Private s_Log As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.Logging.Log)
|
||||
''' <summary>
|
||||
''' Returns the application object for the running application
|
||||
''' </summary>
|
||||
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
|
||||
Friend ReadOnly Property Application() As Application
|
||||
Get
|
||||
Return CType(Global.System.Windows.Application.Current, Application)
|
||||
End Get
|
||||
End Property
|
||||
''' <summary>
|
||||
''' Returns information about the host computer.
|
||||
''' </summary>
|
||||
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
|
||||
Friend ReadOnly Property Computer() As Global.Microsoft.VisualBasic.Devices.Computer
|
||||
Get
|
||||
Return s_Computer.GetInstance()
|
||||
End Get
|
||||
End Property
|
||||
''' <summary>
|
||||
''' Returns information for the current user. If you wish to run the application with the current
|
||||
''' Windows user credentials, call My.User.InitializeWithWindowsUser().
|
||||
''' </summary>
|
||||
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
|
||||
Friend ReadOnly Property User() As Global.Microsoft.VisualBasic.ApplicationServices.User
|
||||
Get
|
||||
Return s_User.GetInstance()
|
||||
End Get
|
||||
End Property
|
||||
''' <summary>
|
||||
''' Returns the application log. The listeners can be configured by the application's configuration file.
|
||||
''' </summary>
|
||||
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
|
||||
Friend ReadOnly Property Log() As Global.Microsoft.VisualBasic.Logging.Log
|
||||
Get
|
||||
Return s_Log.GetInstance()
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Returns the collection of Windows defined in the project.
|
||||
''' </summary>
|
||||
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
|
||||
Friend ReadOnly Property Windows() As MyWindows
|
||||
<Global.System.Diagnostics.DebuggerHidden()> _
|
||||
Get
|
||||
Return s_Windows.GetInstance()
|
||||
End Get
|
||||
End Property
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Never)> _
|
||||
<Global.Microsoft.VisualBasic.MyGroupCollection("System.Windows.Window", "Create__Instance__", "Dispose__Instance__", "My.MyWpfExtenstionModule.Windows")> _
|
||||
Friend NotInheritable Class MyWindows
|
||||
<Global.System.Diagnostics.DebuggerHidden()> _
|
||||
Private Shared Function Create__Instance__(Of T As {New, Global.System.Windows.Window})(ByVal Instance As T) As T
|
||||
If Instance Is Nothing Then
|
||||
If s_WindowBeingCreated IsNot Nothing Then
|
||||
If s_WindowBeingCreated.ContainsKey(GetType(T)) = True Then
|
||||
Throw New Global.System.InvalidOperationException("The window cannot be accessed via My.Windows from the Window constructor.")
|
||||
End If
|
||||
Else
|
||||
s_WindowBeingCreated = New Global.System.Collections.Hashtable()
|
||||
End If
|
||||
s_WindowBeingCreated.Add(GetType(T), Nothing)
|
||||
Return New T()
|
||||
s_WindowBeingCreated.Remove(GetType(T))
|
||||
Else
|
||||
Return Instance
|
||||
End If
|
||||
End Function
|
||||
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1822:MarkMembersAsStatic")> _
|
||||
<Global.System.Diagnostics.DebuggerHidden()> _
|
||||
Private Sub Dispose__Instance__(Of T As Global.System.Windows.Window)(ByRef instance As T)
|
||||
instance = Nothing
|
||||
End Sub
|
||||
<Global.System.Diagnostics.DebuggerHidden()> _
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Never)> _
|
||||
Public Sub New()
|
||||
MyBase.New()
|
||||
End Sub
|
||||
<Global.System.ThreadStatic()> Private Shared s_WindowBeingCreated As Global.System.Collections.Hashtable
|
||||
<Global.System.ComponentModel.EditorBrowsable(Global.System.ComponentModel.EditorBrowsableState.Never)> Public Overrides Function Equals(ByVal o As Object) As Boolean
|
||||
Return MyBase.Equals(o)
|
||||
End Function
|
||||
<Global.System.ComponentModel.EditorBrowsable(Global.System.ComponentModel.EditorBrowsableState.Never)> Public Overrides Function GetHashCode() As Integer
|
||||
Return MyBase.GetHashCode
|
||||
End Function
|
||||
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1822:MarkMembersAsStatic")> _
|
||||
<Global.System.ComponentModel.EditorBrowsable(Global.System.ComponentModel.EditorBrowsableState.Never)> _
|
||||
Friend Overloads Function [GetType]() As Global.System.Type
|
||||
Return GetType(MyWindows)
|
||||
End Function
|
||||
<Global.System.ComponentModel.EditorBrowsable(Global.System.ComponentModel.EditorBrowsableState.Never)> Public Overrides Function ToString() As String
|
||||
Return MyBase.ToString
|
||||
End Function
|
||||
End Class
|
||||
End Module
|
||||
End Namespace
|
||||
Partial Class Application
|
||||
Inherits Global.System.Windows.Application
|
||||
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
|
||||
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1822:MarkMembersAsStatic")> _
|
||||
Friend ReadOnly Property Info() As Global.Microsoft.VisualBasic.ApplicationServices.AssemblyInfo
|
||||
<Global.System.Diagnostics.DebuggerHidden()> _
|
||||
Get
|
||||
Return New Global.Microsoft.VisualBasic.ApplicationServices.AssemblyInfo(Global.System.Reflection.Assembly.GetExecutingAssembly())
|
||||
End Get
|
||||
End Property
|
||||
End Class
|
||||
#End If
|
||||
Generated
+62
@@ -0,0 +1,62 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:$clrversion$
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
|
||||
Namespace My.Resources
|
||||
|
||||
'This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
'class via a tool like ResGen or Visual Studio.
|
||||
'To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
'with the /str option, or rebuild your VS project.
|
||||
'''<summary>
|
||||
''' A strongly-typed resource class, for looking up localized strings, etc.
|
||||
'''</summary>
|
||||
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
|
||||
Friend Module Resources
|
||||
|
||||
Private resourceMan As Global.System.Resources.ResourceManager
|
||||
|
||||
Private resourceCulture As Global.System.Globalization.CultureInfo
|
||||
|
||||
'''<summary>
|
||||
''' Returns the cached ResourceManager instance used by this class.
|
||||
'''</summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
|
||||
Get
|
||||
If Object.ReferenceEquals(resourceMan, Nothing) Then
|
||||
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("$safeprojectname$.Resources", GetType(Resources).Assembly)
|
||||
resourceMan = temp
|
||||
End If
|
||||
Return resourceMan
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Overrides the current thread's CurrentUICulture property for all
|
||||
''' resource lookups using this strongly typed resource class.
|
||||
'''</summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Friend Property Culture() As Global.System.Globalization.CultureInfo
|
||||
Get
|
||||
Return resourceCulture
|
||||
End Get
|
||||
Set(ByVal value As Global.System.Globalization.CultureInfo)
|
||||
resourceCulture = value
|
||||
End Set
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
||||
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
Generated
+73
@@ -0,0 +1,73 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:4.0.30319.42000
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
|
||||
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
|
||||
|
||||
#Region "My.Settings Auto-Save Functionality"
|
||||
#If _MyType = "WindowsForms" Then
|
||||
Private Shared addedHandler As Boolean
|
||||
|
||||
Private Shared addedHandlerLockObject As New Object
|
||||
|
||||
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
|
||||
If My.Application.SaveMySettingsOnExit Then
|
||||
My.Settings.Save()
|
||||
End If
|
||||
End Sub
|
||||
#End If
|
||||
#End Region
|
||||
|
||||
Public Shared ReadOnly Property [Default]() As MySettings
|
||||
Get
|
||||
|
||||
#If _MyType = "WindowsForms" Then
|
||||
If Not addedHandler Then
|
||||
SyncLock addedHandlerLockObject
|
||||
If Not addedHandler Then
|
||||
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
|
||||
addedHandler = True
|
||||
End If
|
||||
End SyncLock
|
||||
End If
|
||||
#End If
|
||||
Return defaultInstance
|
||||
End Get
|
||||
End Property
|
||||
End Class
|
||||
End Namespace
|
||||
|
||||
Namespace My
|
||||
|
||||
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
|
||||
Friend Module MySettingsProperty
|
||||
|
||||
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
|
||||
Friend ReadOnly Property Settings() As Global.EgtCOMMTest.My.MySettings
|
||||
Get
|
||||
Return Global.EgtCOMMTest.My.MySettings.Default
|
||||
End Get
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 8.9 KiB |
@@ -0,0 +1,392 @@
|
||||
Imports System
|
||||
Imports System.Collections.Generic
|
||||
Imports System.Linq
|
||||
Imports System.Text
|
||||
Imports System.Threading.Tasks
|
||||
Imports System.Windows.Input
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.Windows.Media
|
||||
Imports System.Windows
|
||||
Imports ISOCNC.Remoting
|
||||
Imports Zebra.Sdk.Comm
|
||||
Imports Zebra.Sdk.Device
|
||||
Imports Zebra.Sdk.Printer
|
||||
|
||||
Namespace EgtCNCPLCComm
|
||||
Class MainWindowVM
|
||||
Inherits VMBase
|
||||
|
||||
Private _Connected As Boolean = False
|
||||
|
||||
Public ReadOnly Property Connected As Boolean
|
||||
Get
|
||||
Return _Connected
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Connect_Background As SolidColorBrush
|
||||
Get
|
||||
Return (If(_Connected, Brushes.Green, Brushes.Red))
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private _Tpa As TPAComm = Nothing
|
||||
|
||||
Public ReadOnly Property Tpa As TPAComm
|
||||
Get
|
||||
Return _Tpa
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private _ProgramPath As String
|
||||
|
||||
Public ReadOnly Property ProgramPath As String
|
||||
Get
|
||||
Return _ProgramPath
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private _ProgramIndex As Integer = 0
|
||||
|
||||
Public Property ProgramIndex As Integer
|
||||
Get
|
||||
Return _ProgramIndex
|
||||
End Get
|
||||
Set(ByVal value As Integer)
|
||||
_ProgramIndex = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private _VarName As String
|
||||
|
||||
Public Property VarName As String
|
||||
Get
|
||||
Return _VarName
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
_VarName = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private _VarValue As String = ""
|
||||
|
||||
Public Property VarValue As String
|
||||
Get
|
||||
Return _VarValue
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
_VarValue = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Sub SetVarValue(ByVal value As Object)
|
||||
_VarValue = CStr(value)
|
||||
NotifyPropertyChanged(NameOf(VarValue))
|
||||
End Sub
|
||||
|
||||
Private _AxisList As ObservableCollection(Of Axis)
|
||||
|
||||
Public ReadOnly Property AxisList As ObservableCollection(Of Axis)
|
||||
Get
|
||||
Return _AxisList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private _OPStateList As List(Of ISOCNC.Remoting.MachineOperatingState)
|
||||
|
||||
Public Property OPStateList As List(Of ISOCNC.Remoting.MachineOperatingState)
|
||||
Get
|
||||
Return _OPStateList
|
||||
End Get
|
||||
Set(ByVal value As List(Of ISOCNC.Remoting.MachineOperatingState))
|
||||
_OPStateList = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private _SelOPState As ISOCNC.Remoting.MachineOperatingState
|
||||
|
||||
Public Property SelOPState As ISOCNC.Remoting.MachineOperatingState
|
||||
Get
|
||||
Return _SelOPState
|
||||
End Get
|
||||
Set(ByVal value As ISOCNC.Remoting.MachineOperatingState)
|
||||
_SelOPState = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private _ErrCycle As String
|
||||
|
||||
Public ReadOnly Property ErrCycle As String
|
||||
Get
|
||||
Return _ErrCycle
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub UpdateErrCycle(ByVal msg As String)
|
||||
_ErrCycle = msg
|
||||
NotifyPropertyChanged(NameOf(ErrCycle))
|
||||
End Sub
|
||||
|
||||
Private _Iso As String
|
||||
|
||||
Public ReadOnly Property Iso As String
|
||||
Get
|
||||
Return _Iso
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub UpdateIso(ByVal msg As String)
|
||||
_Iso = msg
|
||||
NotifyPropertyChanged(NameOf(Iso))
|
||||
End Sub
|
||||
|
||||
Private _Message As String
|
||||
|
||||
Public ReadOnly Property Message As String
|
||||
Get
|
||||
Return _Message
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub UpdateMessage(ByVal msg As String)
|
||||
_Message = msg
|
||||
NotifyPropertyChanged(NameOf(Message))
|
||||
End Sub
|
||||
|
||||
Private _ErrSystem As String
|
||||
|
||||
Public ReadOnly Property ErrSystem As String
|
||||
Get
|
||||
Return _ErrSystem
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub UpdateErrSystem(ByVal msg As String)
|
||||
_ErrSystem = msg
|
||||
NotifyPropertyChanged(NameOf(ErrSystem))
|
||||
End Sub
|
||||
|
||||
Private m_cmdConnect As ICommand
|
||||
Private m_cmdDisconnect As ICommand
|
||||
Private m_cmdStart As ICommand
|
||||
Private m_cmdStop As ICommand
|
||||
Private m_cmdStep As ICommand
|
||||
Private m_cmdSearchFilePath As ICommand
|
||||
Private m_cmdAddProgram As ICommand
|
||||
Private m_cmdRemoveProgram As ICommand
|
||||
Private m_cmdReadVar As ICommand
|
||||
Private m_cmdWriteVar As ICommand
|
||||
Private m_cmdDeleteAlarms As ICommand
|
||||
Private m_cmdSetPoint As ICommand
|
||||
Private m_cmdPrintLabel As ICommand
|
||||
|
||||
Public Sub New()
|
||||
_AxisList = New ObservableCollection(Of Axis) From {
|
||||
New Axis("X"),
|
||||
New Axis("Y"),
|
||||
New Axis("Z"),
|
||||
New Axis("C"),
|
||||
New Axis("B")
|
||||
}
|
||||
_OPStateList = New List(Of MachineOperatingState) From {
|
||||
MachineOperatingState.Start,
|
||||
MachineOperatingState.[Stop],
|
||||
MachineOperatingState.[End],
|
||||
MachineOperatingState.SetPoint,
|
||||
MachineOperatingState.Pending,
|
||||
MachineOperatingState.Unspecified
|
||||
}
|
||||
NotifyPropertyChanged(NameOf(Connect_Background))
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property Connect_Command As ICommand
|
||||
Get
|
||||
If m_cmdConnect Is Nothing Then m_cmdConnect = New Command(AddressOf Connect)
|
||||
Return m_cmdConnect
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub Connect(ByVal param As Object)
|
||||
_Tpa = New TPAComm(Me)
|
||||
_Connected = Tpa.remObject.OnConnect()
|
||||
NotifyPropertyChanged(NameOf(Connect_Background))
|
||||
If _Connected Then Init()
|
||||
End Sub
|
||||
|
||||
Private Sub Init()
|
||||
_SelOPState = CType(Tpa.remObject.MachineOperativeStatus, MachineOperatingState)
|
||||
NotifyPropertyChanged(NameOf(SelOPState))
|
||||
Dim sAxesValue As String = ""
|
||||
Dim dAxesValue As Double = 0
|
||||
Dim sAxesName As String = "0.TESTA.AsseX.X"
|
||||
Tpa.remObject.SetVariableCommand(CInt(ISOCNC.Remoting.VariableCommands.ReadVar), sAxesName, sAxesValue)
|
||||
Double.TryParse(sAxesValue, dAxesValue)
|
||||
_AxisList(0).Value = dAxesValue
|
||||
sAxesName = "0.TESTA.AsseY.Y"
|
||||
Tpa.remObject.SetVariableCommand(CInt(ISOCNC.Remoting.VariableCommands.ReadVar), sAxesName, sAxesValue)
|
||||
Double.TryParse(sAxesValue, dAxesValue)
|
||||
_AxisList(1).Value = dAxesValue
|
||||
sAxesName = "0.TESTA.AsseZ.Z"
|
||||
Tpa.remObject.SetVariableCommand(CInt(ISOCNC.Remoting.VariableCommands.ReadVar), sAxesName, sAxesValue)
|
||||
Double.TryParse(sAxesValue, dAxesValue)
|
||||
_AxisList(2).Value = dAxesValue
|
||||
sAxesName = "0.TESTA.AsseC.C"
|
||||
Tpa.remObject.SetVariableCommand(CInt(ISOCNC.Remoting.VariableCommands.ReadVar), sAxesName, sAxesValue)
|
||||
Double.TryParse(sAxesValue, dAxesValue)
|
||||
_AxisList(3).Value = dAxesValue
|
||||
sAxesName = "0.TESTA.AsseB.B"
|
||||
Tpa.remObject.SetVariableCommand(CInt(ISOCNC.Remoting.VariableCommands.ReadVar), sAxesName, sAxesValue)
|
||||
Double.TryParse(sAxesValue, dAxesValue)
|
||||
_AxisList(4).Value = dAxesValue
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property Disconnect_Command As ICommand
|
||||
Get
|
||||
If m_cmdDisconnect Is Nothing Then m_cmdDisconnect = New Command(AddressOf Disconnect)
|
||||
Return m_cmdDisconnect
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub Disconnect(ByVal param As Object)
|
||||
_Connected = Not Tpa.remObject.OnClose()
|
||||
NotifyPropertyChanged(NameOf(Connect_Background))
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property Start_Command As ICommand
|
||||
Get
|
||||
If m_cmdStart Is Nothing Then m_cmdStart = New Command(AddressOf Start)
|
||||
Return m_cmdStart
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub Start(ByVal param As Object)
|
||||
Tpa.remObject.SetCommand(CInt(ISOCNC.Remoting.Commands.Start))
|
||||
Tpa.remObject.SetVariableCommand(CInt(ISOCNC.Remoting.VariableCommands.WriteVar), "0.FUNM.E80048", "0")
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property Stop_Command As ICommand
|
||||
Get
|
||||
If m_cmdStop Is Nothing Then m_cmdStop = New Command(AddressOf [Stop])
|
||||
Return m_cmdStop
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub [Stop](ByVal param As Object)
|
||||
Tpa.remObject.SetCommand(CInt(ISOCNC.Remoting.Commands.[Stop]))
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property Step_Command As ICommand
|
||||
Get
|
||||
If m_cmdStep Is Nothing Then m_cmdStep = New Command(AddressOf [Step])
|
||||
Return m_cmdStep
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub [Step](ByVal param As Object)
|
||||
Tpa.remObject.SetCommand(CInt(ISOCNC.Remoting.Commands.[End]))
|
||||
Tpa.remObject.RemoveAllProgramsFromList()
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property SetPoint_Command As ICommand
|
||||
Get
|
||||
If m_cmdSetPoint Is Nothing Then m_cmdSetPoint = New Command(AddressOf SetPoint)
|
||||
Return m_cmdSetPoint
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub SetPoint(ByVal param As Object)
|
||||
Tpa.remObject.SetCommand(CInt(ISOCNC.Remoting.Commands.SetPoint))
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property PrintLabel_Command As ICommand
|
||||
Get
|
||||
If m_cmdPrintLabel Is Nothing Then m_cmdPrintLabel = New Command(AddressOf PrintLabel)
|
||||
Return m_cmdPrintLabel
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub PrintLabel(ByVal param As Object)
|
||||
Dim Test As EgtCNCPLCComm.ZebraPrinter.ZebraPrinter = New EgtCNCPLCComm.ZebraPrinter.ZebraPrinter()
|
||||
Test.Print()
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property SearchFilePath_Command As ICommand
|
||||
Get
|
||||
If m_cmdSearchFilePath Is Nothing Then m_cmdSearchFilePath = New Command(AddressOf SearchFilePath)
|
||||
Return m_cmdSearchFilePath
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub SearchFilePath(ByVal param As Object)
|
||||
Dim OpenFileDialog As Microsoft.Win32.OpenFileDialog = New Microsoft.Win32.OpenFileDialog()
|
||||
If OpenFileDialog.ShowDialog() = True Then _ProgramPath = OpenFileDialog.FileName
|
||||
NotifyPropertyChanged(NameOf(ProgramPath))
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property AddProgram_Command As ICommand
|
||||
Get
|
||||
If m_cmdAddProgram Is Nothing Then m_cmdAddProgram = New Command(AddressOf AddProgram)
|
||||
Return m_cmdAddProgram
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub AddProgram(ByVal param As Object)
|
||||
If SelOPState = MachineOperatingState.Pending Then
|
||||
Dim Path As String = _ProgramPath.Replace("\\", "\")
|
||||
Dim x As Boolean = Tpa.remObject.AddProgramToList(Path)
|
||||
Tpa.remObject.SetCommand(CInt(ISOCNC.Remoting.Commands.Start_Program_Soft))
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property RemoveProgram_Command As ICommand
|
||||
Get
|
||||
If m_cmdRemoveProgram Is Nothing Then m_cmdRemoveProgram = New Command(AddressOf RemoveProgram)
|
||||
Return m_cmdRemoveProgram
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub RemoveProgram(ByVal param As Object)
|
||||
If (Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift Then
|
||||
Tpa.remObject.RemoveAllProgramsFromList()
|
||||
ElseIf _ProgramIndex < 0 Then
|
||||
Tpa.remObject.RemoveProgramFromList(_ProgramPath)
|
||||
Else
|
||||
Tpa.remObject.RemoveProgramFromListAtIndex(_ProgramIndex)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property ReadVar_Command As ICommand
|
||||
Get
|
||||
If m_cmdReadVar Is Nothing Then m_cmdReadVar = New Command(AddressOf ReadVar)
|
||||
Return m_cmdReadVar
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub ReadVar(ByVal param As Object)
|
||||
Tpa.remObject.SetVariableCommand(CInt(ISOCNC.Remoting.VariableCommands.ReadVar), _VarName, _VarValue)
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property WriteVar_Command As ICommand
|
||||
Get
|
||||
If m_cmdWriteVar Is Nothing Then m_cmdWriteVar = New Command(AddressOf WriteVar)
|
||||
Return m_cmdWriteVar
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub WriteVar(ByVal param As Object)
|
||||
Tpa.remObject.SetVariableCommand(CInt(ISOCNC.Remoting.VariableCommands.WriteVar), _VarName, _VarValue)
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property DeleteAlarms_Command As ICommand
|
||||
Get
|
||||
If m_cmdDeleteAlarms Is Nothing Then m_cmdDeleteAlarms = New Command(AddressOf DeleteAlarms)
|
||||
Return m_cmdDeleteAlarms
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub DeleteAlarms(ByVal param As Object)
|
||||
Tpa.remObject.DeleteAlarms(CInt(ISOCNC.Remoting.AlarmType.ISO))
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
@@ -0,0 +1,253 @@
|
||||
Imports System
|
||||
Imports System.Collections.Generic
|
||||
Imports System.ComponentModel
|
||||
Imports System.Data
|
||||
Imports System.Drawing
|
||||
Imports System.Linq
|
||||
Imports System.Text
|
||||
Imports System.Windows.Forms
|
||||
|
||||
Namespace fx_DGeneralFunctions
|
||||
Partial Public Class MainForm
|
||||
Inherits Form
|
||||
|
||||
Private objDRunTimeSystem As FXServer.DRunTimeSystem
|
||||
Private objDGroupManager As FXServer.DGroupManager
|
||||
Private objDGeneralFunction As FXServer.DGeneralFunctions
|
||||
Private objDMainCncData As FXServer.DMainCncData
|
||||
Private IsFlexiumPlus As Boolean = False
|
||||
Private _PartProgramNumber As Single
|
||||
Private _CNCAxisChannelArray As String() = New String() {"Channel 1", "Channel 2"}
|
||||
|
||||
Public Sub New()
|
||||
InitializeComponent()
|
||||
End Sub
|
||||
|
||||
Private Sub MainForm_Load(ByVal sender As Object, ByVal e As EventArgs)
|
||||
_comboCncAxisChannel.Items.AddRange(_CNCAxisChannelArray)
|
||||
End Sub
|
||||
|
||||
Private Sub InitFxServer()
|
||||
objDRunTimeSystem = New FXServer.DRunTimeSystem()
|
||||
objDRunTimeSystem.ServerInitializationFinished += New FXServer.IDRunTimeSystemEvents_ServerInitializationFinishedEventHandler(AddressOf objDRunTimeSystem_ServerInitializationFinished)
|
||||
objDRunTimeSystem.ServerReinitializationStarted += New FXServer.IDRunTimeSystemEvents_ServerReinitializationStartedEventHandler(AddressOf objDRunTimeSystem_ServerReinitializationStarted)
|
||||
objDRunTimeSystem.Init()
|
||||
End Sub
|
||||
|
||||
Private Sub InitFxObjects()
|
||||
objDGroupManager = New FXServer.DGroupManager()
|
||||
objDGroupManager.ErrorHandler += New FXServer.IDGroupManagerEvents_ErrorHandlerEventHandler(AddressOf objDGroupManager_ErrorHandler)
|
||||
objDGroupManager.CncNumber = 0
|
||||
objDGeneralFunction = New FXServer.DGeneralFunctions()
|
||||
objDGeneralFunction.ProgramActivated += New FXServer.IDGeneralFunctionsEvents_ProgramActivatedEventHandler(AddressOf objDGeneralFunction_ProgramActivated)
|
||||
objDGeneralFunction.OnCncStart += New FXServer.IDGeneralFunctionsEvents_OnCncStartEventHandler(AddressOf objDGeneralFunction_OnCncStart)
|
||||
objDGeneralFunction.OnCncStop += New FXServer.IDGeneralFunctionsEvents_OnCncStopEventHandler(AddressOf objDGeneralFunction_OnCncStop)
|
||||
objDGeneralFunction.OnCncReset += New FXServer.IDGeneralFunctionsEvents_OnCncResetEventHandler(AddressOf objDGeneralFunction_OnCncReset)
|
||||
objDGeneralFunction.CncModeWritten += New FXServer.IDGeneralFunctionsEvents_CncModeWrittenEventHandler(AddressOf objDGeneralFunction_CncModeWritten)
|
||||
objDGeneralFunction.VariableWritten += New FXServer.IDGeneralFunctionsEvents_VariableWrittenEventHandler(AddressOf objDGeneralFunction_VariableWritten)
|
||||
objDGeneralFunction.OnSkipLevelWritten += New FXServer.IDGeneralFunctionsEvents_OnSkipLevelWrittenEventHandler(AddressOf objDGeneralFunction_OnSkipLevelWritten)
|
||||
objDGeneralFunction.Init(objDGroupManager.Handle)
|
||||
objDMainCncData = New FXServer.DMainCncData()
|
||||
objDMainCncData.Init(objDGroupManager.Handle)
|
||||
Dim CncFxIdentifier As String = objDMainCncData.GetCncIdentifier()
|
||||
_txtGetCncIdentification.Invoke(CType(Function()
|
||||
_txtGetCncIdentification.Text = CncFxIdentifier
|
||||
End Function, MethodInvoker))
|
||||
|
||||
If CncFxIdentifier = "Flexium 6" OrElse CncFxIdentifier = "Flexium 8" OrElse CncFxIdentifier = "Flexium 68" Then
|
||||
IsFlexiumPlus = False
|
||||
Else
|
||||
IsFlexiumPlus = True
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CloseFxObjects()
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(objDGroupManager)
|
||||
objDGroupManager = Nothing
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(objDGeneralFunction)
|
||||
objDGeneralFunction = Nothing
|
||||
MessageBox.Show("CloseFxObjects")
|
||||
End Sub
|
||||
|
||||
Private Sub GetGeneralFunctions()
|
||||
Dim _GetConnectState As Int16 = objDGeneralFunction.ConnectionStatus
|
||||
|
||||
Select Case _GetConnectState
|
||||
Case 0
|
||||
_txtConnectionState.Text = "Not connected"
|
||||
Case 1
|
||||
_txtConnectionState.Text = " Connection error"
|
||||
Case 2
|
||||
_txtConnectionState.Text = "Connected"
|
||||
Case Else
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Private Sub _btnRuntimeSystemStart_Click(ByVal sender As Object, ByVal e As EventArgs)
|
||||
InitFxServer()
|
||||
End Sub
|
||||
|
||||
Private Sub _btnCycleStartCommon_Click(ByVal sender As Object, ByVal e As EventArgs)
|
||||
objDGeneralFunction.CncStart()
|
||||
End Sub
|
||||
|
||||
Private Sub _BtnFeedHoldCommon_Click(ByVal sender As Object, ByVal e As EventArgs)
|
||||
objDGeneralFunction.CncStop()
|
||||
End Sub
|
||||
|
||||
Private Sub _btnCNCResetCommon_Click(ByVal sender As Object, ByVal e As EventArgs)
|
||||
objDGeneralFunction.CncReset()
|
||||
End Sub
|
||||
|
||||
Private Sub _btnCncModeAuto_Click(ByVal sender As Object, ByVal e As EventArgs)
|
||||
objDGeneralFunction.WriteCncMode(0, 0)
|
||||
End Sub
|
||||
|
||||
Private Sub _btnCncModeMDI_Click(ByVal sender As Object, ByVal e As EventArgs)
|
||||
objDGeneralFunction.WriteCncMode(2, 0)
|
||||
End Sub
|
||||
|
||||
Private Sub _btnCncModeManual_Click(ByVal sender As Object, ByVal e As EventArgs)
|
||||
objDGeneralFunction.WriteCncMode(7, 0)
|
||||
End Sub
|
||||
|
||||
Private Sub _btnWriteVariable_Click(ByVal sender As Object, ByVal e As EventArgs)
|
||||
Dim _E80011FxStd As Int32 = 88888
|
||||
Dim _FXReturn As Short = objDGeneralFunction.WriteVariable("E80011", _E80011FxStd)
|
||||
|
||||
If _FXReturn <> 0 Then
|
||||
MessageBox.Show("Error from WriteVariable:" & " " & _FXReturn.ToString())
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub _btnWriteVariable2_Click(ByVal sender As Object, ByVal e As EventArgs)
|
||||
Dim _E80010FxPlus As Double = 51515.6161
|
||||
Dim _FXReturn As Short = objDGeneralFunction.WriteVariable2("E80010", _E80010FxPlus)
|
||||
|
||||
If _FXReturn <> 0 Then
|
||||
MessageBox.Show("Error from WriteVariable2:" & " " & _FXReturn.ToString())
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub objDRunTimeSystem_ServerInitializationFinished()
|
||||
InitFxObjects()
|
||||
GetGeneralFunctions()
|
||||
|
||||
If IsFlexiumPlus = True Then
|
||||
_txtBlockSkipLevel.Text = "100"
|
||||
_txtBlockSkipLevel.Enabled = True
|
||||
Else
|
||||
_txtBlockSkipLevel.Text = ""
|
||||
_txtBlockSkipLevel.Enabled = True
|
||||
End If
|
||||
|
||||
_txtServerInitStatus.Invoke(CType(Function()
|
||||
_txtServerInitStatus.ForeColor = Color.DarkBlue
|
||||
_txtServerInitStatus.Text = "FXServer objects initialized !"
|
||||
End Function, MethodInvoker))
|
||||
_txtServerReinitStatus.Invoke(CType(Function()
|
||||
_txtServerReinitStatus.ForeColor = Color.DarkGreen
|
||||
_txtServerReinitStatus.Text = "FXServer no objects closed !"
|
||||
End Function, MethodInvoker))
|
||||
End Sub
|
||||
|
||||
Private Sub objDRunTimeSystem_ServerReinitializationStarted()
|
||||
CloseFxObjects()
|
||||
_txtServerReinitStatus.Invoke(CType(Function()
|
||||
_txtServerReinitStatus.ForeColor = Color.Red
|
||||
_txtServerReinitStatus.Text = "FXServer objects closed !"
|
||||
End Function, MethodInvoker))
|
||||
_txtServerInitStatus.Invoke(CType(Function()
|
||||
_txtServerInitStatus.ForeColor = Color.DarkOrange
|
||||
_txtServerInitStatus.Text = "FXServer objects not initialized !"
|
||||
End Function, MethodInvoker))
|
||||
End Sub
|
||||
|
||||
Private Sub objDGeneralFunction_ProgramActivated(ByVal nerrorCode As Short)
|
||||
MessageBox.Show("Part program activated:" & " " & nerrorCode)
|
||||
End Sub
|
||||
|
||||
Private Sub objDGeneralFunction_OnCncReset(ByVal errorCode As Short)
|
||||
If errorCode <> 0 Then
|
||||
MessageBox.Show("Error CNC Reset:" & " " & errorCode.ToString())
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub objDGeneralFunction_OnCncStop(ByVal errorCode As Short)
|
||||
If errorCode <> 0 Then
|
||||
MessageBox.Show("Error Feed Hold:" & " " & errorCode.ToString())
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub objDGeneralFunction_OnCncStart(ByVal errorCode As Short)
|
||||
If errorCode <> 0 Then
|
||||
MessageBox.Show("Error Cycle Start:" & " " & errorCode.ToString())
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub objDGeneralFunction_CncModeWritten(ByVal errorCode As Short)
|
||||
MessageBox.Show("Error CNC Mode selection completed:" & " " & errorCode.ToString())
|
||||
End Sub
|
||||
|
||||
Private Sub _txtPartProgramNumber_KeyPress(ByVal sender As Object, ByVal e As KeyPressEventArgs)
|
||||
If e.KeyChar = CChar(Keys.[Return]) Then
|
||||
e.Handled = True
|
||||
Dim _CncAxisChannelIndependent As Int16
|
||||
_PartProgramNumber = Single.Parse(_txtPartProgramNumber.Text)
|
||||
MessageBox.Show("PartProgNumber:" & " " & _PartProgramNumber.ToString())
|
||||
Dim _PartProgramNumberActivate As Int32 = Convert.ToInt32(_PartProgramNumber * 10)
|
||||
MessageBox.Show("PartProgNumberActivate:" & " " & _PartProgramNumberActivate.ToString())
|
||||
|
||||
If _checkChannelTypeState.Checked = True Then
|
||||
_CncAxisChannelIndependent = 1
|
||||
Else
|
||||
_CncAxisChannelIndependent = 0
|
||||
End If
|
||||
|
||||
Dim _FXReturn As Int16 = objDGeneralFunction.ActivateProgram(_PartProgramNumberActivate, _CncAxisChannelIndependent)
|
||||
|
||||
If _FXReturn <> 0 Then
|
||||
MessageBox.Show("Error Activate Program:" & " " & _FXReturn.ToString())
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub objDGroupManager_ErrorHandler(ByVal sError As String, ByVal nTextNumber As Short)
|
||||
MessageBox.Show("ErrorHandler message:" & " " & sError & " " & "ErrorHandler number:" & " " & nTextNumber.ToString())
|
||||
End Sub
|
||||
|
||||
Private Sub _comboCncAxisChannel_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
|
||||
Select Case _comboCncAxisChannel.SelectedItem.ToString()
|
||||
Case "Channel 1"
|
||||
objDGroupManager.AxisGroup = 0
|
||||
Case "Channel 2"
|
||||
objDGroupManager.AxisGroup = 1
|
||||
Case Else
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Private Sub objDGeneralFunction_VariableWritten(ByVal errorCode As Short)
|
||||
If errorCode <> 0 Then
|
||||
MessageBox.Show("Error from VariableWritten:" & " " & errorCode.ToString())
|
||||
Else
|
||||
MessageBox.Show("VariableWritten successfully")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub _txtBlockSkipLevel_KeyPress(ByVal sender As Object, ByVal e As KeyPressEventArgs)
|
||||
If e.KeyChar = CChar(Keys.[Return]) Then
|
||||
e.Handled = True
|
||||
Dim _GetBlockSkipLevelDecimalValue As UInt32 = Convert.ToUInt32(_txtBlockSkipLevel.Text)
|
||||
Dim _FXReturn As Int16 = objDGeneralFunction.WriteSkipLevel(20, _GetBlockSkipLevelDecimalValue)
|
||||
|
||||
If _FXReturn <> 0 Then
|
||||
MessageBox.Show("Error from WriteSkipLevel:" & " " & _FXReturn.ToString())
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub objDGeneralFunction_OnSkipLevelWritten(ByVal lHandle As Integer, ByVal errorCode As Short)
|
||||
MessageBox.Show("OnSkipLevelWritten:" & "" & "Handle:" & lHandle & " " & "errorCode:" & errorCode)
|
||||
End Sub
|
||||
End Class
|
||||
End Namespace
|
||||
@@ -0,0 +1,630 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:EgtCOMMTest="clr-namespace:EgtCOMMTest"
|
||||
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
|
||||
xmlns:EgtFloating="clr-namespace:EgtWPFLib5.EgtFloating;assembly=EgtWPFLib5">
|
||||
|
||||
<!--
|
||||
Assign a Key to every Panel ViewModel to use
|
||||
it in xaml file(ProjectView.xaml).
|
||||
-->
|
||||
<EgtCOMMTest:MainWindowVM x:Key="MainWindowVM"/>
|
||||
<EgtCOMMTest:MachCommandMessagePanelVM x:Key="MachCommandMessagePanelVM"/>
|
||||
<EgtCOMMTest:AxesPanelVM x:Key="AxesPanelVM"/>
|
||||
<EgtCOMMTest:VariablesListVM x:Key="VariablesListVM"/>
|
||||
<!--<EgtCOMMTest:ProjManagerVM x:Key="ProjManagerVM"/>-->
|
||||
<!--<EgtCOMMTest:MainMenuVM x:Key="MainMenuVM"/>
|
||||
<EgtCOMMTest:MyStatusBarVM x:Key="StatusBarVM"/>-->
|
||||
<!--<EgtCOMMTest:ShowBeamPanelVM x:Key="ShowBeamPanelVM"/>-->
|
||||
<!--<EgtCOMMTest:MyInstrumentPanelVM x:Key="InstrumentPanelVM"/>-->
|
||||
<!--<EgtCOMMTest:PartParametersVM x:Key="PartParametersVM"/>-->
|
||||
|
||||
<!--Colori predefiniti-->
|
||||
<SolidColorBrush x:Key="Omag_Blue" Color="#FF095CA8" />
|
||||
<SolidColorBrush x:Key="Omag_Yellow" Color="#FFFFCE5B" />
|
||||
<SolidColorBrush x:Key="Omag_Red" Color="Red" />
|
||||
<SolidColorBrush x:Key="Omag_Green" Color="LawnGreen" />
|
||||
<SolidColorBrush x:Key="Omag_VeryLightGray" Color="#FFF2F2F2" />
|
||||
<SolidColorBrush x:Key="Omag_LightGray" Color="LightGray" />
|
||||
<SolidColorBrush x:Key="Omag_Gray" Color="#FF9E9E9E" />
|
||||
<SolidColorBrush x:Key="Omag_DarkGray" Color="#FF444444" />
|
||||
<SolidColorBrush x:Key="Omag_White" Color="#FFFFFFFF" />
|
||||
<SolidColorBrush x:Key="Omag_Black" Color="#FF000000" />
|
||||
|
||||
<!--Colori per EgtWPFLib5-->
|
||||
<SolidColorBrush x:Key="TextBox.Static.Border" Color="#FFABAdB3"/>
|
||||
<!--Colori per TabHeader-->
|
||||
<LinearGradientBrush x:Key="TabItem.Static.Background" EndPoint="0,1" StartPoint="0,0">
|
||||
<GradientStop Color="#F0F0F0" Offset="0.0"/>
|
||||
<GradientStop Color="#E5E5E5" Offset="1.0"/>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!--Risorsa che toglie le animazioni dai menù popup per evitare che i menù mru di scelta dei file rimangano aperti se il file è grosso -->
|
||||
<!--o viene eseguito un lua che non aggiorna l'interfaccia-->
|
||||
<PopupAnimation x:Key="{x:Static SystemParameters.MenuPopupAnimationKey}">None</PopupAnimation>
|
||||
|
||||
<!-- ______________________________________________________________________________________________________________________________________________ -->
|
||||
|
||||
<!-- FocusVisual standard-->
|
||||
<Style x:Key="FocusVisual">
|
||||
<Setter Property="Control.Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate>
|
||||
<Rectangle Margin="2" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- ______________________________________________________________________________________________________________________________________________ -->
|
||||
|
||||
<!-- Button Style -->
|
||||
|
||||
<SolidColorBrush x:Key="Button.Static.Background" Color="#FFDDDDDD"/>
|
||||
<SolidColorBrush x:Key="Button.Static.Border" Color="#FF707070"/>
|
||||
<SolidColorBrush x:Key="Button.MouseOver.Background" Color="#FFBEE6FD"/>
|
||||
<SolidColorBrush x:Key="Button.MouseOver.Border" Color="#FF3C7FB1"/>
|
||||
<SolidColorBrush x:Key="Button.Pressed.Background" Color="#FFC4E5F6"/>
|
||||
<SolidColorBrush x:Key="Button.Pressed.Border" Color="#FF2C628B"/>
|
||||
<SolidColorBrush x:Key="Button.Disabled.Background" Color="#FFF4F4F4"/>
|
||||
<SolidColorBrush x:Key="Button.Disabled.Border" Color="#FFADB2B5"/>
|
||||
<SolidColorBrush x:Key="Button.Disabled.Foreground" Color="#FF838383"/>
|
||||
<Style TargetType="{x:Type Button}">
|
||||
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
|
||||
<Setter Property="Background" Value="{StaticResource Button.Static.Background}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="Padding" Value="1"/>
|
||||
<Setter Property="Margin" Value="1"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border x:Name="border" CornerRadius="3" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
|
||||
<ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsDefaulted" Value="true">
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="true">
|
||||
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.MouseOver.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.MouseOver.Border}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="true">
|
||||
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.Pressed.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Pressed.Border}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.Disabled.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Disabled.Border}"/>
|
||||
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{StaticResource Button.Disabled.Foreground}"/>
|
||||
<Setter Property="OpacityMask" Value="#54707070"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!--Template che permette di andare a capo-->
|
||||
<DataTemplate x:Key="WrapButton_DataTemplate">
|
||||
<TextBlock TextWrapping="WrapWithOverflow" Text="{Binding}"/>
|
||||
</DataTemplate>
|
||||
|
||||
<Style x:Key="ToolBar_Button" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
|
||||
<Setter Property="Height" Value="30"/>
|
||||
<Setter Property="Width" Value="30"/>
|
||||
</Style>
|
||||
<Style x:Key="ToolBar_SmallButton" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
|
||||
<Setter Property="Height" Value="20"/>
|
||||
<Setter Property="Width" Value="20"/>
|
||||
</Style>
|
||||
<Style x:Key="ToolBar_TextButton" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
|
||||
<Setter Property="Height" Value="30"/>
|
||||
<Setter Property="Width" Value="80"/>
|
||||
</Style>
|
||||
<Style x:Key="OptionPanel_Button" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
|
||||
<Setter Property="Height" Value="60"/>
|
||||
<Setter Property="Width" Value="60"/>
|
||||
</Style>
|
||||
<Style x:Key="OptionPanel_TextButton" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
|
||||
<Setter Property="Height" Value="30"/>
|
||||
</Style>
|
||||
<Style x:Key="OptionPanel_TextWrapButton" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
|
||||
<Setter Property="ContentTemplate" Value="{StaticResource WrapButton_DataTemplate}" />
|
||||
<Setter Property="TextBlock.TextAlignment" Value="Center"/>
|
||||
<Setter Property="Height" Value="45"/>
|
||||
</Style>
|
||||
<Style x:Key="OptionPanel_NestingButton" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
|
||||
<Setter Property="Height" Value="60"/>
|
||||
<Setter Property="Width" Value="60"/>
|
||||
</Style>
|
||||
<Style x:Key="CompoWindow_Button" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
|
||||
<Setter Property="Height" Value="40"/>
|
||||
</Style>
|
||||
<Style x:Key="EgtWPFLib5_InputButton" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
|
||||
<Setter Property="Height" Value="30"/>
|
||||
<Setter Property="Width" Value="60"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="LeftPanel_SmallButton" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
|
||||
<Setter Property="Height" Value="20"/>
|
||||
<Setter Property="Width" Value="20"/>
|
||||
</Style>
|
||||
|
||||
<!-- ______________________________________________________________________________________________________________________________________________ -->
|
||||
|
||||
<!-- ToggleButton Style -->
|
||||
|
||||
<Style TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
|
||||
<Setter Property="Background" Value="{StaticResource Button.Static.Background}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="Padding" Value="1"/>
|
||||
<Setter Property="Margin" Value="1"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
||||
<Border x:Name="border" CornerRadius="3" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
|
||||
<ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="Button.IsDefaulted" Value="true">
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="true">
|
||||
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.MouseOver.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.MouseOver.Border}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="true">
|
||||
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.Pressed.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Pressed.Border}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsChecked" Value="true">
|
||||
<Setter Property="Background" TargetName="border" Value="{StaticResource Omag_Yellow}"/>
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Pressed.Border}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.Disabled.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Disabled.Border}"/>
|
||||
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{StaticResource Button.Disabled.Foreground}"/>
|
||||
<Setter Property="OpacityMask" Value="#54707070"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ToolBar_ToggleButton" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource {x:Type ToggleButton}}">
|
||||
<Setter Property="Height" Value="30"/>
|
||||
<Setter Property="Width" Value="30"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ToolBar_TextToggleButton" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource {x:Type ToggleButton}}">
|
||||
<Setter Property="Height" Value="30"/>
|
||||
<Setter Property="Width" Value="70"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="OptionPanel_ToggleButton" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource {x:Type ToggleButton}}">
|
||||
<Setter Property="Height" Value="30"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="OptionPanel_NestingToggleButton" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource {x:Type ToggleButton}}">
|
||||
<Setter Property="Height" Value="60"/>
|
||||
<Setter Property="Width" Value="60"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="CompoWindow_ToggleButton" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource {x:Type ToggleButton}}">
|
||||
<Setter Property="Height" Value="40"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="MainMenu_ToggleButton" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource {x:Type ToggleButton}}">
|
||||
<Setter Property="Background" Value="{StaticResource Omag_White}"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource Omag_DarkGray}"/>
|
||||
<Setter Property="TextBlock.FontWeight" Value="Normal"/>
|
||||
<Setter Property="Height" Value="30"/>
|
||||
<Setter Property="Width" Value="90"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsChecked" Value="true">
|
||||
<Setter Property="TextBlock.FontWeight" Value="ExtraBold"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="Option_ColorButton" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
|
||||
<Setter Property="Padding" Value="5"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="TextBlock.TextAlignment" Value="Center"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="#FFB8C3CD"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="OpacityMask" Value="#33FF0000"/>
|
||||
</Trigger>
|
||||
<Trigger Property="ToggleButton.IsChecked" Value="True">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Background" Value="#FFF4F4F4"/>
|
||||
<Setter Property="BorderBrush" Value="#FFADB2B5"/>
|
||||
<Setter Property="TextElement.Foreground" Value="#FF838383"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<!-- ______________________________________________________________________________________________________________________________________________ -->
|
||||
|
||||
<!-- TextBlock -->
|
||||
|
||||
<Style x:Key="ToolsTextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
|
||||
<Setter Property="Margin" Value="10,0,0,0"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="MachiningsTextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
|
||||
<Setter Property="Margin" Value="10,0,0,0"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="MachiningsToolTextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
|
||||
<Setter Property="Margin" Value="10,5,0,0"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ValidationErrorTextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
|
||||
<Setter Property="FontStyle" Value="Italic"/>
|
||||
<Setter Property="TextWrapping" Value="Wrap"/>
|
||||
<Setter Property="Foreground" Value="Red"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Right"/>
|
||||
<Setter Property="Margin" Value="0,1"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="OptionTextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="Margin" Value="10,0,10,0"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="PartParam_TextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="Margin" Value="10,0,10,0"/>
|
||||
</Style>
|
||||
|
||||
<!-- ______________________________________________________________________________________________________________________________________________ -->
|
||||
|
||||
<!-- TextBox -->
|
||||
|
||||
<Style TargetType="{x:Type EgtWPFLib5:EgtTextBox}" BasedOn="{StaticResource {x:Type EgtWPFLib5:EgtTextBox}}">
|
||||
<Setter Property="Height" Value="22"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Right"/>
|
||||
<Setter Property="ExplicitUpdateSource" Value="EnterKeyPress"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ToolsTextBox" TargetType="{x:Type EgtWPFLib5:EgtTextBox}" BasedOn="{StaticResource {x:Type EgtWPFLib5:EgtTextBox}}">
|
||||
<Setter Property="Margin" Value="0,0,5,0"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="MachiningsTextBox" TargetType="{x:Type EgtWPFLib5:EgtTextBox}" BasedOn="{StaticResource {x:Type EgtWPFLib5:EgtTextBox}}">
|
||||
<Setter Property="Margin" Value="0,0,0,10"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="MachiningsToolTextBox" TargetType="{x:Type EgtWPFLib5:EgtTextBox}" BasedOn="{StaticResource {x:Type EgtWPFLib5:EgtTextBox}}">
|
||||
<Setter Property="Margin" Value="0,0,5,0"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="OptionTextBox" TargetType="{x:Type EgtWPFLib5:EgtTextBox}" BasedOn="{StaticResource {x:Type EgtWPFLib5:EgtTextBox}}">
|
||||
<Setter Property="Margin" Value="0,0,5,0"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="PartParam_TextBox" TargetType="{x:Type EgtWPFLib5:EgtTextBox}" BasedOn="{StaticResource {x:Type EgtWPFLib5:EgtTextBox}}">
|
||||
<Setter Property="Width" Value="150"/>
|
||||
<Setter Property="Margin" Value="5"/>
|
||||
</Style>
|
||||
|
||||
<!-- ______________________________________________________________________________________________________________________________________________ -->
|
||||
|
||||
<!-- MachGroup -->
|
||||
|
||||
<SolidColorBrush x:Key="ScrollBar.Static.Background" Color="#F0F0F0"/>
|
||||
<SolidColorBrush x:Key="ScrollBar.Static.Border" Color="#F0F0F0"/>
|
||||
<SolidColorBrush x:Key="ScrollBar.Pressed.Glyph" Color="#FFFFFF"/>
|
||||
<SolidColorBrush x:Key="ScrollBar.MouseOver.Glyph" Color="#000000"/>
|
||||
<SolidColorBrush x:Key="ScrollBar.Disabled.Glyph" Color="#BFBFBF"/>
|
||||
<SolidColorBrush x:Key="ScrollBar.Static.Glyph" Color="#606060"/>
|
||||
<SolidColorBrush x:Key="ScrollBar.MouseOver.Background" Color="#DADADA"/>
|
||||
<SolidColorBrush x:Key="ScrollBar.MouseOver.Border" Color="#DADADA"/>
|
||||
<SolidColorBrush x:Key="ScrollBar.Pressed.Background" Color="#606060"/>
|
||||
<SolidColorBrush x:Key="ScrollBar.Pressed.Border" Color="#606060"/>
|
||||
<SolidColorBrush x:Key="ScrollBar.Disabled.Background" Color="#F0F0F0"/>
|
||||
<SolidColorBrush x:Key="ScrollBar.Disabled.Border" Color="#F0F0F0"/>
|
||||
<Style x:Key="CustomScrollBarButton" TargetType="{x:Type RepeatButton}">
|
||||
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="Padding" Value="1"/>
|
||||
<Setter Property="Focusable" Value="false"/>
|
||||
<Setter Property="IsTabStop" Value="false"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type RepeatButton}">
|
||||
<Border x:Name="border" CornerRadius="3" BorderBrush="{StaticResource ScrollBar.Static.Border}" BorderThickness="1" Background="{StaticResource ScrollBar.Static.Background}" SnapsToDevicePixels="true">
|
||||
<ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="true">
|
||||
<Setter Property="Background" TargetName="border" Value="{StaticResource ScrollBar.MouseOver.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ScrollBar.MouseOver.Border}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="true">
|
||||
<Setter Property="Background" TargetName="border" Value="{StaticResource ScrollBar.Pressed.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ScrollBar.Pressed.Border}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter Property="Opacity" TargetName="contentPresenter" Value="0.56"/>
|
||||
<Setter Property="Background" TargetName="border" Value="{StaticResource ScrollBar.Disabled.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ScrollBar.Disabled.Border}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- ______________________________________________________________________________________________________________________________________________ -->
|
||||
|
||||
<!-- Border -->
|
||||
|
||||
<Style x:Key="DefaultBorder" TargetType="{x:Type Border}">
|
||||
<Setter Property="BorderBrush" Value="#D5DFE5"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="CornerRadius" Value="3"/>
|
||||
<Setter Property="Padding" Value="3"/>
|
||||
<Setter Property="Margin" Value="1"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="Border" TargetType="{x:Type Border}">
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource Omag_Gray}"/>
|
||||
<Setter Property="CornerRadius" Value="3"/>
|
||||
<Setter Property="Padding" Value="3"/>
|
||||
</Style>
|
||||
|
||||
<!-- ______________________________________________________________________________________________________________________________________________ -->
|
||||
|
||||
<!-- EgtCustomWindow -->
|
||||
|
||||
<Style TargetType="{x:Type EgtWPFLib5:EgtCustomWindow}" BasedOn="{StaticResource {x:Type EgtWPFLib5:EgtCustomWindow}}">
|
||||
<Setter Property="TitleBarHeight" Value="32"/>
|
||||
<Setter Property="TitleBarBrush" Value="{StaticResource Omag_LightGray}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource Omag_Gray}"/>
|
||||
</Style>
|
||||
|
||||
<!-- ______________________________________________________________________________________________________________________________________________ -->
|
||||
|
||||
<!-- EgtFloatingPanel -->
|
||||
|
||||
<Style x:Key="ToolBar_EgtFloatingPanel" TargetType="{x:Type EgtFloating:EgtFloatingPanel}" BasedOn="{StaticResource {x:Type EgtFloating:EgtFloatingPanel}}">
|
||||
<Setter Property="Background" Value="{StaticResource Omag_Gray}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource Omag_Gray}"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="Option_EgtFloatingPanel" TargetType="{x:Type EgtFloating:EgtFloatingPanel}" BasedOn="{StaticResource {x:Type EgtFloating:EgtFloatingPanel}}">
|
||||
<Setter Property="IsToolBar" Value="False"/>
|
||||
<Setter Property="TitleBarOrientation" Value="Vertical"/>
|
||||
<Setter Property="Background" Value="{StaticResource Omag_Gray}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource Omag_Gray}"/>
|
||||
</Style>
|
||||
|
||||
<!-- ______________________________________________________________________________________________________________________________________________ -->
|
||||
|
||||
<!-- CsvTreeViewItem DA CAMBIARE!! -->
|
||||
|
||||
<SolidColorBrush x:Key="TreeViewItem.TreeArrow.Static.Checked.Fill" Color="#FF595959"/>
|
||||
<SolidColorBrush x:Key="TreeViewItem.TreeArrow.Static.Checked.Stroke" Color="#FF262626"/>
|
||||
<SolidColorBrush x:Key="TreeViewItem.TreeArrow.MouseOver.Stroke" Color="#FF1BBBFA"/>
|
||||
<SolidColorBrush x:Key="TreeViewItem.TreeArrow.MouseOver.Fill" Color="Transparent"/>
|
||||
<SolidColorBrush x:Key="TreeViewItem.TreeArrow.MouseOver.Checked.Stroke" Color="#FF262626"/>
|
||||
<SolidColorBrush x:Key="TreeViewItem.TreeArrow.MouseOver.Checked.Fill" Color="#FF595959"/>
|
||||
<PathGeometry x:Key="TreeArrow" Figures="M0,0 L0,6 L6,0 z"/>
|
||||
<SolidColorBrush x:Key="TreeViewItem.TreeArrow.Static.Fill" Color="Transparent"/>
|
||||
<SolidColorBrush x:Key="TreeViewItem.TreeArrow.Static.Stroke" Color="#FF989898"/>
|
||||
<Style x:Key="ExpandCollapseToggleStyle" TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="Focusable" Value="False"/>
|
||||
<Setter Property="Width" Value="16"/>
|
||||
<Setter Property="Height" Value="16"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
||||
<Border Background="Transparent" Height="16" Padding="5,5,5,5" Width="16">
|
||||
<Path x:Name="ExpandPath" Data="{StaticResource TreeArrow}" Fill="{StaticResource TreeViewItem.TreeArrow.Static.Fill}" Stroke="{StaticResource TreeViewItem.TreeArrow.Static.Stroke}">
|
||||
<Path.RenderTransform>
|
||||
<RotateTransform Angle="135" CenterY="3" CenterX="3"/>
|
||||
</Path.RenderTransform>
|
||||
</Path>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter Property="RenderTransform" TargetName="ExpandPath">
|
||||
<Setter.Value>
|
||||
<RotateTransform Angle="180" CenterY="3" CenterX="3"/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Fill" TargetName="ExpandPath" Value="{StaticResource TreeViewItem.TreeArrow.Static.Checked.Fill}"/>
|
||||
<Setter Property="Stroke" TargetName="ExpandPath" Value="{StaticResource TreeViewItem.TreeArrow.Static.Checked.Stroke}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Stroke" TargetName="ExpandPath" Value="{StaticResource TreeViewItem.TreeArrow.MouseOver.Stroke}"/>
|
||||
<Setter Property="Fill" TargetName="ExpandPath" Value="{StaticResource TreeViewItem.TreeArrow.MouseOver.Fill}"/>
|
||||
</Trigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="IsMouseOver" Value="True"/>
|
||||
<Condition Property="IsChecked" Value="True"/>
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter Property="Stroke" TargetName="ExpandPath" Value="{StaticResource TreeViewItem.TreeArrow.MouseOver.Checked.Stroke}"/>
|
||||
<Setter Property="Fill" TargetName="ExpandPath" Value="{StaticResource TreeViewItem.TreeArrow.MouseOver.Checked.Fill}"/>
|
||||
</MultiTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="CsvPartItemStyle" TargetType="{x:Type TreeViewItem}">
|
||||
<Setter Property="IsSelected" Value="{Binding IsSelected}" />
|
||||
<Setter Property="IsExpanded" Value="{Binding IsExpanded}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TreeViewItem}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition MinWidth="19" Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Border x:Name="ExpanderBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
|
||||
<ToggleButton x:Name="Expander" ClickMode="Press" IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource ExpandCollapseToggleStyle}"/>
|
||||
</Border>
|
||||
<Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Grid.Column="1" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
|
||||
<ContentPresenter x:Name="PART_Header" ContentSource="Header" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
</Border>
|
||||
<ItemsPresenter x:Name="ItemsHost" Grid.ColumnSpan="2" Grid.Column="1" Grid.Row="1"/>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsExpanded" Value="false">
|
||||
<Setter Property="Visibility" TargetName="ItemsHost" Value="Collapsed"/>
|
||||
</Trigger>
|
||||
<Trigger Property="HasItems" Value="false">
|
||||
<Setter Property="Visibility" TargetName="Expander" Value="Hidden"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="true">
|
||||
<Setter Property="Background" TargetName="Bd" Value="Transparent"/>
|
||||
<Setter Property="BorderBrush" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
|
||||
<Setter Property="BorderThickness" TargetName="Bd" Value="0,1,1,1"/>
|
||||
<Setter Property="Background" TargetName="ExpanderBorder" Value="Transparent"/>
|
||||
<Setter Property="BorderBrush" TargetName="ExpanderBorder" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
|
||||
<Setter Property="BorderThickness" TargetName="ExpanderBorder" Value="1,1,0,1"/>
|
||||
<!--<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>-->
|
||||
</Trigger>
|
||||
<!--<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="IsSelected" Value="true"/>
|
||||
<Condition Property="IsSelectionActive" Value="false"/>
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
|
||||
</MultiTrigger>-->
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- ______________________________________________________________________________________________________________________________________________ -->
|
||||
|
||||
<!-- ComboBox -->
|
||||
|
||||
<Style x:Key="MachiningsComboBox" TargetType="{x:Type ComboBox}" BasedOn="{StaticResource {x:Type ComboBox}}">
|
||||
<Setter Property="Margin" Value="0,0,0,10"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="MachiningsToolComboBox" TargetType="{x:Type ComboBox}" BasedOn="{StaticResource {x:Type ComboBox}}">
|
||||
<Setter Property="Margin" Value="0,0,5,0"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="FeatureComboBox" TargetType="{x:Type ComboBox}" BasedOn="{StaticResource {x:Type ComboBox}}">
|
||||
<Setter Property="Height" Value="22"/>
|
||||
<Setter Property="Width" Value="55"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="PartParam_ComboBox" TargetType="{x:Type ComboBox}" BasedOn="{StaticResource {x:Type ComboBox}}">
|
||||
<Setter Property="Height" Value="22"/>
|
||||
<Setter Property="Width" Value="150"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="BtlData_ComboBox" TargetType="{x:Type ComboBox}" BasedOn="{StaticResource {x:Type ComboBox}}">
|
||||
<Setter Property="Height" Value="22"/>
|
||||
<Setter Property="Width" Value="150"/>
|
||||
</Style>
|
||||
|
||||
<!-- ______________________________________________________________________________________________________________________________________________ -->
|
||||
|
||||
<!-- CheckBox -->
|
||||
|
||||
<Style x:Key="OptionCheckBox" TargetType="{x:Type CheckBox}" BasedOn="{StaticResource {x:Type CheckBox}}">
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Right"/>
|
||||
<Setter Property="Margin" Value="10,0,0,0"/>
|
||||
</Style>
|
||||
|
||||
<!-- ______________________________________________________________________________________________________________________________________________ -->
|
||||
|
||||
<!-- GroupBox -->
|
||||
|
||||
<Style x:Key="GroupBoxStyle_NoHeader" TargetType="{x:Type GroupBox}">
|
||||
<Setter Property="Margin" Value="1.5,3,3,0"/>
|
||||
<Setter Property="Padding" Value="5,5,0,0"/>
|
||||
<Setter Property="BorderBrush" Value="#FFD5DFE5"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type GroupBox}">
|
||||
<Grid SnapsToDevicePixels="True">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="6"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="6"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="6"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Border BorderBrush="Transparent" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Grid.ColumnSpan="4" Grid.Column="0" CornerRadius="4" Grid.Row="1" Grid.RowSpan="3"/>
|
||||
<Border BorderBrush="White" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="4" CornerRadius="4" Grid.Row="1" Grid.RowSpan="3">
|
||||
<!--<Border.OpacityMask>
|
||||
<MultiBinding ConverterParameter="7" UpdateSourceTrigger="Default">
|
||||
<MultiBinding.Converter>
|
||||
<BorderGapMaskConverter/>
|
||||
</MultiBinding.Converter>
|
||||
<Binding ElementName="Header" Path="ActualWidth"/>
|
||||
<Binding Path="ActualWidth" RelativeSource="{RelativeSource Self}"/>
|
||||
<Binding Path="ActualHeight" RelativeSource="{RelativeSource Self}"/>
|
||||
</MultiBinding>
|
||||
</Border.OpacityMask>-->
|
||||
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3">
|
||||
<Border BorderBrush="White" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2"/>
|
||||
</Border>
|
||||
</Border>
|
||||
<Border x:Name="Header" Grid.Column="1" Padding="3,1,3,0" Grid.Row="0" Grid.RowSpan="2">
|
||||
<ContentPresenter ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentSource="Header" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
</Border>
|
||||
<ContentPresenter Grid.ColumnSpan="2" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="1" ContentStringFormat="{TemplateBinding ContentStringFormat}" Margin="{TemplateBinding Padding}" Grid.Row="2" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- ______________________________________________________________________________________________________________________________________________ -->
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,30 @@
|
||||
Public Class OmagOFFICEDictionary
|
||||
|
||||
Public Shared ReadOnly MySceneHostVM As String = "MySceneHostVM"
|
||||
|
||||
#Region "Colors"
|
||||
|
||||
Private m_Omag_Red As SolidColorBrush = Brushes.Red
|
||||
Public ReadOnly Property Omag_Red As SolidColorBrush
|
||||
Get
|
||||
Return m_Omag_Red
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private Shared m_Button_Static_Background As SolidColorBrush = New BrushConverter().ConvertFrom("#FFDDDDDD")
|
||||
Public Shared ReadOnly Property Button_Static_Background As SolidColorBrush
|
||||
Get
|
||||
Return m_Button_Static_Background
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private Shared m_TabControl_Header_Background As LinearGradientBrush = Application.Current.FindResource("TabItem.Static.Background")
|
||||
Public Shared ReadOnly Property TabControl_Header_Background As LinearGradientBrush
|
||||
Get
|
||||
Return m_TabControl_Header_Background
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region ' Colors
|
||||
|
||||
End Class
|
||||
+393
@@ -0,0 +1,393 @@
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Module Map
|
||||
|
||||
Private m_refMainWindowVM As MainWindowVM
|
||||
'Private m_refMyStatusBarVM As MyStatusBarVM
|
||||
''Private m_refProjManagerVM As ProjManagerVM
|
||||
'Private m_refSupervisorManagerVM As SupervisorManagerVM
|
||||
'Private m_refProjectVM As ProjectVM
|
||||
'Private m_refMainMenuVM As MainMenuVM
|
||||
'Private m_refMachinePanelVM As MachinePanelVM
|
||||
'Private m_refMyMachGroupPanelVM As MyMachGroupPanelVM
|
||||
'Private m_refLeftPanelVM As LeftPanelVM
|
||||
Private m_refMachCommandMessagePanelVM As MachCommandMessagePanelVM
|
||||
Private m_refAxesPanelVM As AxesPanelVM
|
||||
'Private m_refBottomPanelVM As BottomPanelVM
|
||||
''Private m_refShowBeamPanelVM As ShowBeamPanelVM
|
||||
'Private m_refConfigurationPageVM As ConfigurationPageVM
|
||||
'Private m_refRawPartListVM As RawPartListVM
|
||||
''Private m_refWarehouseWndVM As WarehouseWndVM
|
||||
''Private m_refRawPartTabVM As RawPartTabVM
|
||||
''Private m_refNestingTabVM As NestingTabVM
|
||||
''Private m_refMachiningTabVM As MachiningTabVM
|
||||
''Private m_refSplitModeVM As SplitModeVM
|
||||
''Private m_refMoveRawModeVM As MoveRawModeVM
|
||||
''Private m_refSimulTabVM As SimulTabVM
|
||||
Private m_refMachManaging As MachManaging
|
||||
'Private m_refCALCPanelVM As CALCPanelVM
|
||||
'Private m_refSupervisorMachGroupPanelVM As SupervisorMachGroupPanelVM
|
||||
'Private m_refPartInRawPartListVM As PartInRawPartListVM
|
||||
'Private m_refFeatureInPartInRawPartListVM As FeatureInPartInRawPartListVM
|
||||
|
||||
#Region "Get"
|
||||
|
||||
Public ReadOnly Property refMainWindowVM As MainWindowVM
|
||||
Get
|
||||
Return m_refMainWindowVM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'Public ReadOnly Property refMyStatusBarVM As MyStatusBarVM
|
||||
' Get
|
||||
' Return LibMap.refStatusBarVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
''Public ReadOnly Property refProjManagerVM As ProjManagerVM
|
||||
'' Get
|
||||
'' Return m_refProjManagerVM
|
||||
'' End Get
|
||||
''End Property
|
||||
'Public ReadOnly Property refSupervisorManagerVM As SupervisorManagerVM
|
||||
' Get
|
||||
' Return m_refSupervisorManagerVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
'Public ReadOnly Property refProjectVM As ProjectVM
|
||||
' Get
|
||||
' Return m_refProjectVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
'Public ReadOnly Property refSceneHostVM As SceneHostVM
|
||||
' Get
|
||||
' Return LibMap.refSceneHostVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
'Public ReadOnly Property refShowPanelVM As ShowPanelVM
|
||||
' Get
|
||||
' Return LibMap.refShowPanelVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
'Public ReadOnly Property refMainMenuVM As MainMenuVM
|
||||
' Get
|
||||
' Return m_refMainMenuVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
'Public ReadOnly Property refMachinePanelVM As MachinePanelVM
|
||||
' Get
|
||||
' Return m_refMachinePanelVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
'Public ReadOnly Property refLeftPanelVM As LeftPanelVM
|
||||
' Get
|
||||
' Return m_refLeftPanelVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
'Public ReadOnly Property refMachGroupPanelVM As MyMachGroupPanelVM
|
||||
' Get
|
||||
' Return m_refMyMachGroupPanelVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
Public ReadOnly Property refMachCommandMessagePanelVM As MachCommandMessagePanelVM
|
||||
Get
|
||||
Return m_refMachCommandMessagePanelVM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property refAxesPanelVM As AxesPanelVM
|
||||
Get
|
||||
Return m_refAxesPanelVM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'Public ReadOnly Property refCALCPanelVM As CALCPanelVM
|
||||
' Get
|
||||
' Return m_refCALCPanelVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
'Public ReadOnly Property refSupervisorMachGroupPanelVM As SupervisorMachGroupPanelVM
|
||||
' Get
|
||||
' Return m_refSupervisorMachGroupPanelVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
''Public ReadOnly Property refBottomPanelVM As BottomPanelVM
|
||||
'' Get
|
||||
'' Return m_refBottomPanelVM
|
||||
'' End Get
|
||||
''End Property
|
||||
|
||||
''Public ReadOnly Property refShowBeamPanelVM As ShowBeamPanelVM
|
||||
'' Get
|
||||
'' Return m_refShowBeamPanelVM
|
||||
'' End Get
|
||||
''End Property
|
||||
|
||||
'Public ReadOnly Property refConfigurationPageVM As ConfigurationPageVM
|
||||
' Get
|
||||
' Return m_refConfigurationPageVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
'Public ReadOnly Property refRawPartListVM As RawPartListVM
|
||||
' Get
|
||||
' Return m_refRawPartListVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
''Public ReadOnly Property refWarehouseWndVM As WarehouseWndVM
|
||||
'' Get
|
||||
'' Return m_refWarehouseWndVM
|
||||
'' End Get
|
||||
''End Property
|
||||
|
||||
''Public ReadOnly Property refOptionPanelVM As OptionPanelVM
|
||||
'' Get
|
||||
'' Return m_refOptionPanelVM
|
||||
'' End Get
|
||||
''End Property
|
||||
|
||||
''Public ReadOnly Property refRawPartTabVM As RawPartTabVM
|
||||
'' Get
|
||||
'' Return m_refRawPartTabVM
|
||||
'' End Get
|
||||
''End Property
|
||||
|
||||
''Public ReadOnly Property refNestingTabVM As NestingTabVM
|
||||
'' Get
|
||||
'' Return m_refNestingTabVM
|
||||
'' End Get
|
||||
''End Property
|
||||
|
||||
''Public ReadOnly Property refMachiningTabVM As MachiningTabVM
|
||||
'' Get
|
||||
'' Return m_refMachiningTabVM
|
||||
'' End Get
|
||||
''End Property
|
||||
|
||||
''Public ReadOnly Property refSplitModeVM As SplitModeVM
|
||||
'' Get
|
||||
'' Return m_refSplitModeVM
|
||||
'' End Get
|
||||
''End Property
|
||||
|
||||
''Public ReadOnly Property refMoveRawModeVM As MoveRawModeVM
|
||||
'' Get
|
||||
'' Return m_refMoveRawModeVM
|
||||
'' End Get
|
||||
''End Property
|
||||
|
||||
''Public ReadOnly Property refSimulTabVM As SimulTabVM
|
||||
'' Get
|
||||
'' Return m_refSimulTabVM
|
||||
'' End Get
|
||||
''End Property
|
||||
|
||||
'Public ReadOnly Property refFeatureInPartInRawPartListVM As FeatureInPartInRawPartListVM
|
||||
' Get
|
||||
' Return m_refFeatureInPartInRawPartListVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
'Public ReadOnly Property refPartInRawPartListVM As PartInRawPartListVM
|
||||
' Get
|
||||
' Return m_refPartInRawPartListVM
|
||||
' End Get
|
||||
'End Property
|
||||
|
||||
Public ReadOnly Property refMachManaging As MachManaging
|
||||
Get
|
||||
Return m_refMachManaging
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region ' Get
|
||||
|
||||
#Region "Set"
|
||||
|
||||
'Friend Function SetRefMyStatusBarVM(StatusBarVM As StatusBarVM) As Boolean
|
||||
' LibMap.SetRefStatusBarVM(StatusBarVM)
|
||||
' Return Not IsNothing(LibMap.refStatusBarVM)
|
||||
'End Function
|
||||
|
||||
''Friend Function SetRefProjManagerVM(ProjManagerVM As ProjManagerVM) As Boolean
|
||||
'' m_refProjManagerVM = ProjManagerVM
|
||||
'' Return Not IsNothing(m_refProjManagerVM)
|
||||
''End Function
|
||||
|
||||
'Friend Function SetRefSupervisorManagerVM(SupervisorManagerVM As SupervisorManagerVM) As Boolean
|
||||
' m_refSupervisorManagerVM = SupervisorManagerVM
|
||||
' Return Not IsNothing(m_refSupervisorManagerVM)
|
||||
'End Function
|
||||
|
||||
'Friend Function SetRefProjectVM(ProjectVM As ProjectVM) As Boolean
|
||||
' m_refProjectVM = ProjectVM
|
||||
' Return Not IsNothing(m_refProjectVM)
|
||||
'End Function
|
||||
|
||||
'Friend Function SetRefMainMenuVM(MainMenuVM As MainMenuVM) As Boolean
|
||||
' m_refMainMenuVM = MainMenuVM
|
||||
' Return Not IsNothing(m_refMainMenuVM)
|
||||
'End Function
|
||||
|
||||
'Friend Function SetRefSceneHostVM(SceneHostVM As SceneHostVM) As Boolean
|
||||
' LibMap.SetRefSceneHostVM(SceneHostVM)
|
||||
' Return Not IsNothing(LibMap.refSceneHostVM)
|
||||
'End Function
|
||||
|
||||
'Friend Function SetRefShowPanelVM(ShowPanelVM As ShowPanelVM) As Boolean
|
||||
' LibMap.SetRefShowPanelVM(ShowPanelVM)
|
||||
' Return Not IsNothing(LibMap.refShowPanelVM)
|
||||
'End Function
|
||||
|
||||
'Friend Function SetRefMachinePanelVM(MachinePanelVM As MachinePanelVM) As Boolean
|
||||
' m_refMachinePanelVM = MachinePanelVM
|
||||
' Return Not IsNothing(m_refMachinePanelVM)
|
||||
'End Function
|
||||
|
||||
'Friend Function SetRefLeftPanelVM(LeftPanelVM As LeftPanelVM) As Boolean
|
||||
' m_refLeftPanelVM = LeftPanelVM
|
||||
' Return Not IsNothing(m_refLeftPanelVM)
|
||||
'End Function
|
||||
|
||||
'Friend Function SetRefMachGroupPanelVM(MachGroupPanelVM As MyMachGroupPanelVM) As Boolean
|
||||
' m_refMyMachGroupPanelVM = MachGroupPanelVM
|
||||
' Return Not IsNothing(m_refMyMachGroupPanelVM)
|
||||
'End Function
|
||||
|
||||
Friend Function SetRefMachCommandMessagePanelVM(MachCommandMessagePanelVM As MachCommandMessagePanelVM) As Boolean
|
||||
m_refMachCommandMessagePanelVM = MachCommandMessagePanelVM
|
||||
Return Not IsNothing(m_refMachCommandMessagePanelVM)
|
||||
End Function
|
||||
|
||||
Friend Function SetRefAxesPanelVM(AxesPanelVM As AxesPanelVM) As Boolean
|
||||
m_refAxesPanelVM = AxesPanelVM
|
||||
Return Not IsNothing(m_refAxesPanelVM)
|
||||
End Function
|
||||
|
||||
'Friend Function SetRefCALCPanelVM(CALCPanelVM As CALCPanelVM) As Boolean
|
||||
' m_refCALCPanelVM = CALCPanelVM
|
||||
' Return Not IsNothing(m_refCALCPanelVM)
|
||||
'End Function
|
||||
|
||||
'Friend Function SetRefSupervisorMachGroupPanelVM(SupervisorMachGroupPanelVM As SupervisorMachGroupPanelVM) As Boolean
|
||||
' m_refSupervisorMachGroupPanelVM = SupervisorMachGroupPanelVM
|
||||
' Return Not IsNothing(m_refSupervisorMachGroupPanelVM)
|
||||
'End Function
|
||||
|
||||
''Friend Function SetRefBottomPanelVM(BottomPanelVM As BottomPanelVM) As Boolean
|
||||
'' m_refBottomPanelVM = BottomPanelVM
|
||||
'' Return Not IsNothing(m_refBottomPanelVM)
|
||||
''End Function
|
||||
|
||||
''Friend Function SetRefShowBeamPanelVM(ShowBeamPanelVM As ShowBeamPanelVM) As Boolean
|
||||
'' m_refShowBeamPanelVM = ShowBeamPanelVM
|
||||
'' Return Not IsNothing(m_refShowBeamPanelVM)
|
||||
''End Function
|
||||
|
||||
'Friend Function SetRefConfigurationPageVM(ConfigurationPageVM As ConfigurationPageVM) As Boolean
|
||||
' m_refConfigurationPageVM = ConfigurationPageVM
|
||||
' Return Not IsNothing(m_refConfigurationPageVM)
|
||||
'End Function
|
||||
|
||||
'Friend Function SetRefRawPartListVM(RawPartListVM As RawPartListVM) As Boolean
|
||||
' m_refRawPartListVM = RawPartListVM
|
||||
' Return Not IsNothing(m_refRawPartListVM)
|
||||
'End Function
|
||||
|
||||
''Friend Function SetRefWarehouseWndVM(WarehouseWndVM As WarehouseWndVM) As Boolean
|
||||
'' m_refWarehouseWndVM = WarehouseWndVM
|
||||
'' Return Not IsNothing(m_refWarehouseWndVM)
|
||||
''End Function
|
||||
|
||||
''Friend Function SetRefOptionPanelVM(OptionPanelVM As OptionPanelVM) As Boolean
|
||||
'' m_refOptionPanelVM = OptionPanelVM
|
||||
'' Return Not IsNothing(m_refOptionPanelVM)
|
||||
''End Function
|
||||
|
||||
''Friend Function SetRefRawPartTabVM(RawPartTabVM As RawPartTabVM) As Boolean
|
||||
'' m_refRawPartTabVM = RawPartTabVM
|
||||
'' Return Not IsNothing(m_refRawPartTabVM)
|
||||
''End Function
|
||||
|
||||
''Friend Function SetRefNestingTabVM(NestingTabVM As NestingTabVM) As Boolean
|
||||
'' m_refNestingTabVM = NestingTabVM
|
||||
'' Return Not IsNothing(m_refNestingTabVM)
|
||||
''End Function
|
||||
|
||||
''Friend Function SetRefMachiningTabVM(MachiningTabVM As MachiningTabVM) As Boolean
|
||||
'' m_refMachiningTabVM = MachiningTabVM
|
||||
'' Return Not IsNothing(m_refMachiningTabVM)
|
||||
''End Function
|
||||
|
||||
''Friend Function SetRefSplitModeVM(SplitModeVM As SplitModeVM) As Boolean
|
||||
'' m_refSplitModeVM = SplitModeVM
|
||||
'' Return Not IsNothing(m_refSplitModeVM)
|
||||
''End Function
|
||||
|
||||
''Friend Function SetRefMoveRawModeVM(MoveRawModeVM As MoveRawModeVM) As Boolean
|
||||
'' m_refMoveRawModeVM = MoveRawModeVM
|
||||
'' Return Not IsNothing(m_refMoveRawModeVM)
|
||||
''End Function
|
||||
|
||||
''Friend Function SetRefSimulTabVM(SimulTabVM As SimulTabVM) As Boolean
|
||||
'' m_refSimulTabVM = SimulTabVM
|
||||
'' Return Not IsNothing(m_refSimulTabVM)
|
||||
''End Function
|
||||
|
||||
Friend Function SetRefMachManaging(MachManaging As MachManaging) As Boolean
|
||||
m_refMachManaging = MachManaging
|
||||
Return Not IsNothing(m_refMachManaging)
|
||||
End Function
|
||||
|
||||
'Friend Function SetRefFeatureInPartInRawPartListVM(FeatureInPartInRawPartListVM As FeatureInPartInRawPartListVM) As Boolean
|
||||
' m_refFeatureInPartInRawPartListVM = FeatureInPartInRawPartListVM
|
||||
' Return Not IsNothing(m_refFeatureInPartInRawPartListVM)
|
||||
'End Function
|
||||
|
||||
'Friend Function SetRefPartInRawPartListVM(PartInRawPartListVM As PartInRawPartListVM) As Boolean
|
||||
' m_refPartInRawPartListVM = PartInRawPartListVM
|
||||
' Return Not IsNothing(m_refPartInRawPartListVM)
|
||||
'End Function
|
||||
|
||||
#End Region ' Set
|
||||
|
||||
#Region "Init"
|
||||
|
||||
Friend Function BeginInit(MainWindowVM As MainWindowVM) As Boolean
|
||||
m_refMainWindowVM = MainWindowVM
|
||||
Return Not IsNothing(m_refMainWindowVM)
|
||||
End Function
|
||||
Friend Function EndInit() As Boolean
|
||||
' Verifico se tutti i pezzi necessari sono stati caricati
|
||||
'Return Not IsNothing(m_refMainWindowVM) AndAlso Not IsNothing(m_refProjectVM) AndAlso
|
||||
' Not IsNothing(LibMap.refStatusBarVM) AndAlso Not IsNothing(m_refProjectManagerVM) AndAlso
|
||||
' Not IsNothing(LibMap.refSceneHostVM) AndAlso Not IsNothing(LibMap.refShowPanelVM) AndAlso
|
||||
' Not IsNothing(m_refVeinMatchPanelVM) AndAlso
|
||||
' Not IsNothing(m_refOptionPanelVM) AndAlso Not IsNothing(m_refRawPartTabVM) AndAlso
|
||||
' Not IsNothing(m_refNestingTabVM) AndAlso Not IsNothing(m_refSimulTabVM) AndAlso
|
||||
' Not IsNothing(m_refMachiningTabVM) AndAlso
|
||||
' LibMap.EndInit()
|
||||
Return Not IsNothing(m_refMainWindowVM) AndAlso 'Not IsNothing(m_refMainMenuVM) AndAlso
|
||||
Not IsNothing(m_refMachCommandMessagePanelVM) AndAlso Not IsNothing(m_refAxesPanelVM) AndAlso
|
||||
LibMap.EndInit()
|
||||
'Not IsNothing(LibMap.refStatusBarVM) AndAlso 'Not IsNothing(m_refProjManagerVM) AndAlso Not IsNothing(m_refProdManagerVM) AndAlso
|
||||
'Not IsNothing(m_refConfigurationPageVM) AndAlso Not IsNothing(m_refFeatureInPartInRawPartListVM) AndAlso
|
||||
'Not IsNothing(m_refPartInRawPartListVM) AndAlso
|
||||
'Not IsNothing(LibMap.refSceneHostVM) AndAlso Not IsNothing(LibMap.refShowPanelVM) AndAlso
|
||||
'Not IsNothing(m_refMachinePanelVM) AndAlso Not IsNothing(LibMap.refMachGroupPanelVM) AndAlso Not IsNothing(m_refRawPartListVM) AndAlso 'Not IsNothing(m_refWarehouseWndVM) AndAlso Not IsNothing(m_refShowBeamPanelVM) AndAlso
|
||||
End Function
|
||||
|
||||
#End Region ' Init
|
||||
|
||||
End Module
|
||||
@@ -0,0 +1,15 @@
|
||||
<UserControl x:Class="VariablesListV"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Height="200">
|
||||
|
||||
<DataGrid ItemsSource="{Binding VariablesList}"
|
||||
AutoGenerateColumns="False">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Name" Binding="{Binding sName}" Width="1*"/>
|
||||
<DataGridTextColumn Header="Address" Binding="{Binding sAddress}" Width="1*"/>
|
||||
<DataGridTextColumn Header="Value" Binding="{Binding sValue}" Width="1*"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
</UserControl>
|
||||
@@ -0,0 +1,3 @@
|
||||
Public Class VariablesListV
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,88 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.Windows.Threading
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class VariablesListVM
|
||||
|
||||
|
||||
Private m_VariablesList As New ObservableCollection(Of Variable)
|
||||
Public ReadOnly Property VariablesList As ObservableCollection(Of Variable)
|
||||
Get
|
||||
Return m_VariablesList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Sub New()
|
||||
' inizializzo tutte le variabili
|
||||
m_VariablesList.Add(New Variable(MachManaging.InitVar(1)))
|
||||
m_VariablesList.Add(New Variable(MachManaging.InitVar(2)))
|
||||
m_VariablesList.Add(New Variable(MachManaging.InitVar(3)))
|
||||
m_VariablesList.Add(New Variable(MachManaging.InitVar(4)))
|
||||
m_VariablesList.Add(New Variable(MachManaging.InitVar(5)))
|
||||
m_VariablesList.Add(New Variable(MachManaging.InitVar(6)))
|
||||
m_VariablesList.Add(New Variable(MachManaging.InitVar(7)))
|
||||
m_VariablesList.Add(New Variable(MachManaging.InitVar(8)))
|
||||
m_VariablesList.Add(New Variable(MachManaging.InitVar(9)))
|
||||
m_VariablesList.Add(New Variable(MachManaging.InitVar(10)))
|
||||
m_VariablesList.Add(New Variable(MachManaging.InitVar(11)))
|
||||
m_VariablesList.Add(New Variable(MachManaging.InitVar(12)))
|
||||
m_VariablesList.Add(New Variable(MachManaging.InitVar(13)))
|
||||
'm_VariablesList.Add(New Variable(MachManaging.InitVar(14)))
|
||||
'm_VariablesList.Add(New Variable(MachManaging.InitVar(15)))
|
||||
'm_VariablesList.Add(New Variable(MachManaging.InitVar(16)))
|
||||
'm_VariablesList.Add(New Variable(MachManaging.InitVar(17)))
|
||||
'm_VariablesList.Add(New Variable(MachManaging.InitVar(18)))
|
||||
'm_VariablesList.Add(New Variable(RWVariableManager.InitVar(19)))
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
Public Class Variable
|
||||
Inherits VMBase
|
||||
|
||||
Private m_CommVar As CommVar
|
||||
Public ReadOnly Property CommVar As CommVar
|
||||
Get
|
||||
Return m_CommVar
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Property sName As String
|
||||
Get
|
||||
Return CommVar.sName
|
||||
End Get
|
||||
Set(value As String)
|
||||
CommVar.sName = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property sAddress As String
|
||||
Get
|
||||
Return CommVar.sAddress
|
||||
End Get
|
||||
Set(value As String)
|
||||
CommVar.sAddress = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property sValue As String
|
||||
Get
|
||||
Return CommVar.sValue
|
||||
End Get
|
||||
Set(value As String)
|
||||
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.WRITE, {CommVar.nType}, Nothing, {CommVar.sName, value}))
|
||||
NotifyPropertyChanged(NameOf(sValue))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Sub New(CommVar As CommVar)
|
||||
m_CommVar = CommVar
|
||||
AddHandler CommVar.NewValue, AddressOf CommVar_NewValue
|
||||
End Sub
|
||||
|
||||
Private Sub CommVar_NewValue(sender As Object, e As NewValueEventArgs)
|
||||
NotifyPropertyChanged(NameOf(sValue))
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user