OmagVIEWPlus 2.1b1 :

- Primo rilascio
This commit is contained in:
Emmanuele Sassi
2019-02-27 08:26:22 +00:00
parent 4e76ccebec
commit e6d051c9a2
40 changed files with 3088 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/>
</startup>
</configuration>
+9
View File
@@ -0,0 +1,9 @@
<Application x:Class="Application"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Resources>
<ResourceDictionary Source="Utility/Dictionary.xaml" />
</Application.Resources>
</Application>
+14
View File
@@ -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
+52
View File
@@ -0,0 +1,52 @@
'----------------------------------------------------------------------------
' 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 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 = "OmagVIEWPlus.lic"
Public Const S_LICENCE As String = "Licence"
Public Const K_KEY As String = "Key"
' Abilitazioni licenza
Friend Enum KEY_OPT As UInteger
CUT_BASE = 1 ' Prodotto OmagCUT
MAN_MANIP = 2
AUTO_MANIP = 4
MAN_PHOTO = 8
AUTO_PHOTO = 16
AUTO_NESTING = 32
ENABLE_MILL = 64
PROCUCTION_LINE = 128
OFFICE_BASE = 256 ' Prodotto OmagOFFICE
VM_MULTI = 512
UNDER_CUT = 1024
CSV_SIMPLE = 2048
PHOTO_BASE = 4096 ' Prodotto OmagPHOTO
TRF_IMPORT = 8192
End Enum
' File di log generale
Public Const GENLOG_FILE_NAME As String = "OmagVIEWPlusLog#.txt"
' Sottodirettorio di configurazione
Public Const CONF_DIR As String = "Config"
' Sottodirettorio temporaneo
Public Const TEMP_DIR As String = "Temp"
End Module
+44
View File
@@ -0,0 +1,44 @@
'----------------------------------------------------------------------------
' 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.
'
'
'----------------------------------------------------------------------------
Module ConstIni
Public Const INI_FILE_NAME As String = "OmagVIEWPlus.ini"
Public Const S_GENERAL As String = "General"
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_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_SUPPORT As String = "Support"
Public Const S_LANGUAGES As String = "Languages"
Public Const K_LANGUAGE As String = "Language"
Public Const S_NUMERICALCONTROL As String = "NumericalControl"
Public Const K_TYPE As String = "Type"
Public Const K_IP As String = "Ip"
Public Const K_RACK As String = "Rack"
Public Const K_SLOT As String = "Slot"
Public Const K_TIMERINTERVAL As String = "TimerInterval"
Public Const S_VARIABLES As String = "Variables"
Public Const K_ACTIVEWAREHOUSE As String = "ActiveWarehouse"
End Module
+53
View File
@@ -0,0 +1,53 @@
Module ConstMsg
Public Const MSG_SETUPERRORS As Integer = 5000 + 1470
Public Const MSG_MISSINGKEYWD As Integer = 10100
Public Const MSG_NUMERICKEYBOARDWD As Integer = 10200
Public Const MSG_MESSAGEBOX As Integer = 15000
Public Const MSG_OMAGCUT As Integer = 90000
Public Const MSG_GENERAL As Integer = MSG_OMAGCUT
Public Const MSG_WORKINPROGRESSPAGEUC As Integer = MSG_OMAGCUT + 100
Public Const MSG_DIRECTCUTPAGEUC As Integer = MSG_OMAGCUT + 200
Public Const MSG_MANUALAXESMOVEPAGEUC As Integer = MSG_OMAGCUT + 220
Public Const MSG_CADCUTPAGEUC As Integer = MSG_OMAGCUT + 300
Public Const MSG_NESTPAGEUC As Integer = MSG_OMAGCUT + 330
Public Const MSG_SPLITPAGEUC As Integer = MSG_OMAGCUT + 340
Public Const MSG_MOVERAWPAGEUC As Integer = MSG_OMAGCUT + 360
Public Const MSG_DRAWPAGEUC As Integer = MSG_OMAGCUT + 380
Public Const MSG_COMPONENTPAGEUC As Integer = MSG_OMAGCUT + 400
Public Const MSG_IMPORTPAGEUC As Integer = MSG_OMAGCUT + 450
Public Const MSG_OPENPAGEUC As Integer = MSG_OMAGCUT + 490
Public Const MSG_RAWPARTPAGEUC As Integer = MSG_OMAGCUT + 500
Public Const MSG_CHOOSEMACHININGPAGEUC As Integer = MSG_OMAGCUT + 535
Public Const MSG_SIMULATIONPAGEUC As Integer = MSG_OMAGCUT + 550
Public Const MSG_FRAMECUTPAGEUC As Integer = MSG_OMAGCUT + 600
Public Const MSG_MACHINEPAGEUC As Integer = MSG_OMAGCUT + 700
Public Const MSG_TOOLSDBPAGEUC As Integer = MSG_OMAGCUT + 720
Public Const MSG_MACHININGSDBPAGEUC As Integer = MSG_OMAGCUT + 760
Public Const MSG_COMBOBOXPARAM As Integer = MSG_OMAGCUT + 800
Public Const MSG_ALARMSPAGEUC As Integer = MSG_OMAGCUT + 900
Public Const MSG_MACHINECNPAGEUC As Integer = MSG_OMAGCUT + 950
Public Const MSG_OPTIONSPAGEUC As Integer = MSG_OMAGCUT + 980
Public Const MSG_EGTMSGBOX As Integer = MSG_OMAGCUT + 1100
Public Const MSG_CSVPAGEUC As Integer = MSG_OMAGCUT + 1200
Public Const MSG_OMAGOFFICE As Integer = 91400
Public Const MSG_OPTIONPANEL As Integer = MSG_OMAGOFFICE
Public Const MSG_MYMACHININGDBWINDOW As Integer = MSG_OMAGOFFICE + 50
Public Const MSG_TOPCMDBAR As Integer = MSG_OMAGOFFICE + 100
Public Const MSG_RAWPARTTAB As Integer = MSG_OMAGOFFICE + 150
Public Const MSG_VEINMATCHING As Integer = MSG_OMAGOFFICE + 200
Public Const MSG_GENERIC As Integer = MSG_OMAGOFFICE + 250
Public Const MSG_EGTWPFLIB5 As Integer = 30000
Public Const MSG_TOPCOMMANDBAR As Integer = MSG_EGTWPFLIB5 + 500
Public Const MSG_GRIDVIEWPANEL As Integer = MSG_EGTWPFLIB5 + 800
Public Const MSG_TOOLDB As Integer = MSG_EGTWPFLIB5 + 1000
Public Const MSG_TOOLDBERRORS As Integer = MSG_EGTWPFLIB5 + 1100
Public Const MSG_MACHININGDB As Integer = MSG_EGTWPFLIB5 + 1200
Public Const MSG_MACHININGDBERRORS As Integer = MSG_EGTWPFLIB5 + 1400
Public Const MSG_SIMULATION As Integer = MSG_EGTWPFLIB5 + 1600
End Module
+252
View File
@@ -0,0 +1,252 @@
Imports System.Threading
Imports System.Math
Imports EgtUILib
Imports EgtWPFLib5
Public Class MainWindowM
#Region "FIELDS"
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
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_sLogFile As String
Friend ReadOnly Property sLogFile As String
Get
Return m_sLogFile
End Get
End Property
#End Region ' FIELDS
#Region "CONSTRUCTOR"
Sub New()
InitializeEgtEnvironment()
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Private Sub InitializeEgtEnvironment()
' 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
' 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)
' Recupero livello e opzioni della chiave
Dim bKey As Boolean = EgtGetKeyLevel(9423, 19, 1, m_nKeyLevel) And
EgtGetKeyOptions(9423, 19, 1, m_nKeyOptions)
' Verifico abilitazione prodotto
Dim bProd As Boolean = GetKeyOption(KEY_OPT.MAN_MANIP) And GetKeyOption(KEY_OPT.AUTO_MANIP) And GetKeyOption(KEY_OPT.PROCUCTION_LINE)
' 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
If Not bKey Then
MessageBox.Show("Missing Protection Key. Insert Dongle and restart the program", "Error", MessageBoxButton.OK, MessageBoxImage.Error)
'End
End If
If Not bProd Then
MessageBox.Show("Program without licence. Load Licence and restart the program.", "Error", MessageBoxButton.OK, MessageBoxImage.Error)
'End
End If
' Leggo file messaggi
Dim sMsgFilePath As String = sMsgDir & "\" & sMsgName
If Not EgtLoadMessages(sMsgFilePath) Then
EgtOutLog("Error in EgtLoadMessages")
End If
' Leggo e imposto livello utilizzatore
m_nUserLevel = Math.Min(m_nKeyLevel, GetMainPrivateProfileInt(S_GENERAL, K_USERLEVEL, 1))
' Info su opzioni chiave
EgtOutLog("KeyOptions : " & bKey.ToString() & " " & m_nKeyOptions.ToString() & " " & bProd.ToString())
End Sub
Private Sub ManageInstance()
Dim bCreated As Boolean
Try
m_objMutex = New Mutex(False, "Global\OmagVIEWPlus", 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
Const MAX_INST As Integer = 32
Dim nMaxInst As Integer = GetMainPrivateProfileInt(S_GENERAL, K_MAXINST, 1)
nMaxInst = Max(1, Min(nMaxInst, MAX_INST))
' 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("OmagVIEWPlusR32")
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("OmagVIEWPlusR64")
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 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
+24
View File
@@ -0,0 +1,24 @@
<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:OmagVIEWPlus="clr-namespace:OmagVIEWPlus"
DataContext="{StaticResource MainWindowVM}"
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
Title="{Binding Title}"
MinHeight="600" MinWidth="800">
<!--AboutBoxCommand="{Binding AboutBoxCommand}" WindowStyle="None" ResizeMode="NoResize"
CloseCommand="{Binding CloseApplicationCommand,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}">-->
<!--Pannello principale -->
<DockPanel LastChildFill="True">
<!--StatusBar --><!--
<OmagOFFICE:StatusBarV DataContext="{StaticResource StatusBarVM}"
DockPanel.Dock="Bottom"/>-->
<!--Magazzino -->
<OmagVIEWPlus:UnloadingAreaV DataContext="{StaticResource UnloadingAreaVM}"/>
</DockPanel>
</EgtWPFLib5:EgtCustomWindow>
+38
View File
@@ -0,0 +1,38 @@
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)
End Sub
#End Region ' CONSTRUCTOR
#Region "EVENTS"
Private Sub MainWindowV_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
' Carico e imposto posizione finestra
WinPosFromIniToWindow(S_GENERAL, K_WINPLACE, Me)
End Sub
Private Sub MainWindowV_ContentRendered(sender As Object, e As EventArgs) Handles Me.ContentRendered
m_MainWindowVM.ContentRendered()
End Sub
Private Sub MainWindowV_Unloaded(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles Me.Closing
' Salvo posizione finestra (se non minimizzata)
If WindowState <> WindowState.Minimized Then
WinPosFromWindowToIni(Me, S_GENERAL, K_WINPLACE)
End If
End Sub
#End Region ' EVENTS
End Class
+123
View File
@@ -0,0 +1,123 @@
Imports EgtUILib
Imports EgtWPFLib5
Imports System.IO
Public Class MainWindowVM
Inherits VMBase
' Riferimento al Model della MainWindow
Private m_MainWindowM As MainWindowM
Friend ReadOnly Property MainWindowM As MainWindowM
Get
Return m_MainWindowM
End Get
End Property
' Dichiarazione della classe di connessione al PLC
Friend m_CNCommunication As NCCommunication
' Variabile che indica che il programma è stato avviato correttamente (sia la mappa che l'ambiente Egt)
Private m_bInitStatus As Boolean
Friend ReadOnly Property bInitStatus As Boolean
Get
Return m_bInitStatus
End Get
End Property
' Titolo
Private m_Title As String
Public Property Title As String
Get
Return m_Title
End Get
Set(value As String)
m_Title = value
NotifyPropertyChanged("Title")
End Set
End Property
' definizione comandi
Private m_cmdAboutBox As ICommand
Private m_cmdCloseApplication 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
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Friend Sub SetTitle(sTitle As String)
m_Title = sTitle
NotifyPropertyChanged("Title")
End Sub
Friend Sub ContentRendered()
' Verifico che l'inizializzazione di tutte le parti del programma sia andata a buon fine
If Map.EndInit() Then
m_bInitStatus = True
' altrimenti chiudo il programma
Else
m_bInitStatus = False
End If
' Creazione gestore comunicazione con PLC
m_CNCommunication = New NCCommunication
SetTitle("OmagVIEWPlus")
End Sub
#End Region ' METHODS
#Region "COMMANDS"
#Region "AboutBoxCommand"
' Returns a command that manage the MainWindow_Unloaded command
Public ReadOnly Property AboutBoxCommand() 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 "CloseApplicationCommand"
' Returns a command that manage the MainWindow_Unloaded command
Public ReadOnly Property CloseApplicationCommand() As ICommand
Get
If m_cmdCloseApplication Is Nothing Then
m_cmdCloseApplication = New Command(AddressOf CloseApplication)
End If
Return m_cmdCloseApplication
End Get
End Property
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
Public Sub CloseApplication(ByVal param As Object)
' Termino il Model
m_MainWindowM.Close()
' Termino il programma
Application.Current.Shutdown()
End Sub
#End Region ' CloseApplicationCommand
#End Region ' COMMANDS
End Class
+74
View File
@@ -0,0 +1,74 @@
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
Imports System.Globalization
Imports System.Resources
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
#If PLATFORM = "x64" Then
#If DEBUG Then
<Assembly: AssemblyTitle("OmagVIEWPlusD64.exe")>
<Assembly: AssemblyDescription("OmagVIEWPlus Debug 64 bit")>
#Else
<Assembly: AssemblyTitle("OmagVIEWPlusR64.exe")>
<Assembly: AssemblyDescription("OmagVIEWPlus 64 bit")>
#End if
#Else
#If DEBUG Then
<Assembly: AssemblyTitle("OmagVIEWPlusD32.exe")>
<Assembly: AssemblyDescription("OmagVIEWPlus Debug 32 bit")>
#Else
<Assembly: AssemblyTitle("OmagVIEWPlusR32.exe")>
<Assembly: AssemblyDescription("OmagVIEWPlus 32 bit")>
#End If
#End If
<Assembly: AssemblyCompany("EgalTech s.r.l.")>
<Assembly: AssemblyProduct("OmagVIEWPlus")>
<Assembly: AssemblyCopyright("Copyright © 2018-2018 by EgalTech s.r.l.")>
<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("94b31015-df05-4395-a323-6e03d97e183b")>
' 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("2.1.2.1")>
<Assembly: AssemblyFileVersion("2.1.2.1")>
+121
View File
@@ -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
+63
View File
@@ -0,0 +1,63 @@
'------------------------------------------------------------------------------
' <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
Imports System
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("OmagVIEWPlus.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
resourceCulture = value
End Set
End Property
End Module
End Namespace
+117
View File
@@ -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>
+71
View File
@@ -0,0 +1,71 @@
'------------------------------------------------------------------------------
' <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
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.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
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.OmagVIEWPlus.MySettings
Get
Return Global.OmagVIEWPlus.MySettings.Default
End Get
End Property
End Module
End Namespace
+7
View File
@@ -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>
+323
View File
@@ -0,0 +1,323 @@
Imports System.Windows.Threading
Imports EgtWPFLib5
Imports Sharp7
Public Class NCCommunication
Public Enum Types As Integer
' BIT = 0
' WORD = 1
INT = 2
' DWORD = 3
DINT = 4
REAL = 5
' STRING_ = 6
' CHAR_ARRAY = 7
End Enum
Public Enum Connection_States As Integer
DEBUG = 0
SIEMENS = 3
End Enum
Private m_bFirst As Boolean = True
' Timer
Private m_TimerIsBusy As Boolean = False
Private m_RefreshTimer As New DispatcherTimer
Private m_NC As Nc_Parent = Nothing
Private Connection_State As Connection_States = Connection_States.DEBUG
Private Sub ShowResult(ByVal Result As Integer)
' This function returns a textual explaination of the error code
'TextError.Text = Client.ErrorText(Result)
End Sub
Public Sub New()
' lettura tipo di PLC
Dim nType As Integer = GetMainPrivateProfileInt(S_NUMERICALCONTROL, K_TYPE, 0)
Select Case nType
Case Connection_States.DEBUG
Connection_State = Connection_States.DEBUG
Case Connection_States.SIEMENS
' creazione classe Siemens
m_NC = New Nc_Siemens
' connessione
Dim bOk As Boolean = m_NC.InitConnection()
If bOk Then
Connection_State = Connection_States.SIEMENS
Else
Connection_State = Connection_States.DEBUG
MessageBox.Show("Impossible connect to the PLC.")
End If
Case Else
Connection_State = Connection_States.DEBUG
End Select
If Connection_State = Connection_States.DEBUG Then
m_NC = New Nc_Debug
End If
' lancio il timer di aggiornamento dell'interfaccia
'AddHandler m_RefreshTimer.Tick, AddressOf RefreshTimer_Tick
'm_RefreshTimer.Interval = TimeSpan.FromMilliseconds(GetMainPrivateProfileInt(S_NUMERICALCONTROL, K_TIMERINTERVAL, 1000))
'm_RefreshTimer.Start()
' Eseguo subito la prima lettura variabili
Refresh()
End Sub
Private Sub RefreshTimer_Tick()
If Not m_TimerIsBusy Then
m_TimerIsBusy = True
m_RefreshTimer.Stop()
Refresh()
m_TimerIsBusy = False
m_RefreshTimer.Start()
End If
End Sub
Private Sub Refresh()
'Dim n1Value As Integer = 0
'Dim x As Boolean = m_NC.ReadInt(81, 0, n1Value)
'Dim y As Boolean = m_NC.WriteInt(81, 0, 547)
''Dim nValue As Integer = 0
''ReadInt32(81, 0, nValue)
'Dim dValue As Double = 0
'm_NC.ReadReal(81, 2, dValue)
'Dim dVal As Double = 0
'Dim z As Boolean = m_NC.ReadReal(81, 2, dVal)
'Dim e As Boolean = m_NC.WriteReal(81, 2, 635.8736)
'Dim b As Boolean = False
'x = TryCast(m_NC, Nc_Siemens).ReadBool(81, 6, b)
'x = TryCast(m_NC, Nc_Siemens).WriteBool(81, 6, True)
'Dim s As String = ""
'x = TryCast(m_NC, Nc_Siemens).ReadString(81, 8, 6, s)
'x = TryCast(m_NC, Nc_Siemens).WriteString(81, 8, "tres")
Dim nValue As Integer = 0
Dim nValue2 As Integer = 0
' Leggo magazzino attivo
Dim ActiveStorage As Warehouses = Warehouses.A
If ReadInt("ActiveStorage", nValue) Then
If nValue >= 0 OrElse nValue < 3 Then ActiveStorage = DirectCast(nValue, Warehouses)
Map.refUnloadingAreaVM.SetActiveWarehouse(ActiveStorage)
End If
' Calcolo magazzino non attivo
Dim NotActiveStorage As Warehouses = If(ActiveStorage = Warehouses.A, Warehouses.B, Warehouses.A)
' Leggo box attivo
Dim ActiveBox As Integer = 0
If ReadInt("ActiveBox", nValue) Then
If nValue >= 0 OrElse nValue <= 6 Then ActiveBox = nValue
Map.refUnloadingAreaVM.SetBoxIsActive(ActiveBox)
End If
If m_bFirst Then
' Leggo se primo magazzino è pallet o rack
Dim Storage1_IsPallet As Boolean = True
If ReadInt("Storage1_IsPallet", nValue) Then
Storage1_IsPallet = (nValue <> 0)
Map.refUnloadingAreaVM.SetWarehouse_IsPallet(Warehouses.A, Storage1_IsPallet)
End If
' Leggo se secondo magazzino è pallet o rack
Dim Storage2_IsPallet As Boolean = True
If ReadInt("Storage2_IsPallet", nValue) Then
Storage2_IsPallet = (nValue <> 0)
Map.refUnloadingAreaVM.SetWarehouse_IsPallet(Warehouses.B, Storage2_IsPallet)
End If
Else
'Verifico se magazzino attivo
If ActiveStorage <> 0 Then
' Leggo se magazzino attivo è pallet o rack
Dim Storage_IsPallet As Boolean = True
If ReadInt("Storage" & ActiveStorage & "_IsPallet", nValue) Then
Storage_IsPallet = (nValue <> 0)
Map.refUnloadingAreaVM.SetWarehouse_IsPallet(ActiveStorage, Storage_IsPallet)
End If
' Scrivo se magazzino non attivo è pallet o rack
Storage_IsPallet = True
WriteInt("WStorage" & NotActiveStorage & "_IsPallet", If(Map.refUnloadingAreaVM.WarehouseList(NotActiveStorage - 1).IsPallet, 1, 0))
' Non c'è magazzino attivo
Else
WriteInt("WStorage1_IsPallet", If(Map.refUnloadingAreaVM.WarehouseList(Warehouses.A - 1).IsPallet, 1, 0))
WriteInt("WStorage2_IsPallet", If(Map.refUnloadingAreaVM.WarehouseList(Warehouses.B - 1).IsPallet, 1, 0))
End If
End If
' Leggo stato primo magazzino
Dim Storage1_Stato As States = States.NOT_AVAILABLE
If ReadInt("Storage1_Stato", nValue) Then
If nValue >= 0 OrElse nValue <= 3 Then Storage1_Stato = DirectCast(nValue, States)
Map.refUnloadingAreaVM.WarehouseList(0).SetState(Storage1_Stato)
End If
' Leggo stato secondo magazzino
Dim Storage2_Stato As States = States.NOT_AVAILABLE
If ReadInt("Storage2_Stato", nValue) Then
If nValue >= 0 OrElse nValue <= 3 Then Storage2_Stato = DirectCast(nValue, States)
Map.refUnloadingAreaVM.WarehouseList(1).SetState(Storage2_Stato)
End If
If m_bFirst Then
' Leggo stati pallet/rack di entrambi i magazzini
Dim StorageX_BoxX_Stato As States = States.NOT_AVAILABLE
For StorageX As Integer = 1 To 2
Dim MaxBoxX As Integer = If(Map.refUnloadingAreaVM.WarehouseList(StorageX - 1).IsPallet, 6, 3)
For BoxX As Integer = 1 To MaxBoxX
StorageX_BoxX_Stato = States.NOT_AVAILABLE
If ReadInt("Storage" & StorageX & "_Box" & BoxX & "_Stato", nValue) Then
If nValue >= 0 OrElse nValue <= 3 Then StorageX_BoxX_Stato = DirectCast(nValue, States)
Map.refUnloadingAreaVM.SetBoxState(If(StorageX = 1, Warehouses.A, Warehouses.B), BoxX, StorageX_BoxX_Stato)
End If
Next
Next
Else
'Verifico se magazzino attivo
If ActiveStorage <> 0 Then
' Leggo stati del magazzino attivo
Dim StorageX_BoxX_Stato As States = States.NOT_AVAILABLE
Dim MaxBoxX As Integer = If(Map.refUnloadingAreaVM.WarehouseList(ActiveStorage - 1).IsPallet, 6, 3)
For BoxX As Integer = 1 To MaxBoxX
StorageX_BoxX_Stato = States.NOT_AVAILABLE
If ReadInt("Storage" & ActiveStorage & "_Box" & BoxX & "_Stato", nValue) Then
If nValue >= 0 OrElse nValue <= 3 Then StorageX_BoxX_Stato = DirectCast(nValue, States)
Map.refUnloadingAreaVM.SetBoxState(If(ActiveStorage = 1, Warehouses.A, Warehouses.B), BoxX, StorageX_BoxX_Stato)
End If
Next
' Scrivo stati del magazzino non attivo
MaxBoxX = If(Map.refUnloadingAreaVM.WarehouseList(NotActiveStorage - 1).IsPallet, 6, 3)
For BoxX As Integer = 1 To MaxBoxX
Dim nState As Integer = Map.refUnloadingAreaVM.WarehouseList(NotActiveStorage - 1).Boxes(BoxX - 1).State
WriteInt("WStorage" & NotActiveStorage & "_Box" & BoxX & "_Stato", nState)
Next
' Non c'è magazzino attivo
Else
For StorageX As Integer = 1 To 2
Dim MaxBoxX As Integer = If(Map.refUnloadingAreaVM.WarehouseList(StorageX - 1).IsPallet, 6, 3)
For BoxX As Integer = 1 To MaxBoxX
Dim nState As Integer = Map.refUnloadingAreaVM.WarehouseList(StorageX - 1).Boxes(BoxX - 1).State
WriteInt("WStorage" & StorageX & "_Box" & BoxX & "_Stato", nState)
Next
Next
End If
End If
' Leggo numero massimo righe e colonne
Dim MaxNRighe As Integer = 0
Dim MaxNColonne As Integer = 0
If ReadInt("MaxNRighe", nValue) AndAlso ReadInt("MaxNColonne", nValue2) Then
If nValue >= 0 Then MaxNRighe = nValue
If nValue2 >= 0 Then MaxNColonne = nValue2
Map.refUnloadingAreaVM.MaxFillActiveBox(MaxNRighe, MaxNColonne)
End If
' Leggo numero riga e colonna corrente su box attivo
Dim ActBox_Livello As Integer = 0
Dim ActBox_Riga As Integer = 0
If ReadInt("ActBox_Livello", nValue) AndAlso ReadInt("ActBox_Riga", nValue2) Then
If nValue >= 0 Then ActBox_Livello = nValue
If nValue2 >= 0 Then ActBox_Riga = nValue2
Map.refUnloadingAreaVM.FillActiveBox(ActBox_Livello, ActBox_Riga)
End If
' Leggo contatore 1
Dim Table1Counter As Integer = 0
If ReadInt("Table1Counter", nValue) Then
If nValue >= 0 Then Table1Counter = nValue
Map.refUnloadingAreaVM.SetTable1Counter(Table1Counter)
End If
' Leggo contatore 2
Dim Table2Counter As Integer = 0
If ReadInt("Table2Counter", nValue) Then
If nValue >= 0 Then Table2Counter = nValue
Map.refUnloadingAreaVM.SetTable2Counter(Table2Counter)
End If
' Leggo riga corrente tavolo 1
Dim Table1CurrRow As Integer = 0
Dim Table1NRow As Integer = 0
If ReadInt("Table1CurrRow", nValue) AndAlso ReadInt("Table1NRow", nValue2) Then
If nValue >= 0 Then Table1CurrRow = nValue
If nValue2 >= 0 Then Table1NRow = nValue2
Map.refUnloadingAreaVM.SetTable1Percentage(Table1CurrRow, Table1NRow)
End If
' Leggo tipo di piastrella
Dim TipoPiastrella As Integer = 0
If ReadInt("TipoPiastrella", nValue) Then
If nValue >= 1 OrElse nValue <= 5 Then TipoPiastrella = nValue
'Map.refUnloadingAreaVM.SetBoxIsActive(TipoPiastrella)
End If
' Leggo spessore
Dim DimensioneZ As Integer = 0
If ReadInt("DimensioneZ", nValue) Then
If nValue >= 0 Then DimensioneZ = nValue
'Map.refUnloadingAreaVM.SetBoxIsActive(TipoPiastrella)
End If
' Leggo ultima lastra
Dim UltimaLastra As Integer = 0
If ReadInt("UltimaLastra", nValue) Then
If nValue >= 0 Then UltimaLastra = nValue
'Map.refUnloadingAreaVM.SetBoxIsActive(TipoPiastrella)
End If
' se Debug, incremento tempo
If Connection_State = Connection_States.DEBUG Then TryCast(m_NC, Nc_Debug).IncrementTime()
m_bFirst = False
End Sub
Private Function ReadInt(sVarName As String, ByRef nValue As Integer) As Boolean
Dim bok As Boolean = True
Dim sVar As String = String.Empty
' Lettura variabile
If GetMainPrivateProfileString(S_VARIABLES, sVarName, "", sVar) > 0 Then
' Spezzatura nei componenti
Dim sVarSplit() As String = sVar.Split(","c)
If sVarSplit.Length = 3 Then
' elimino spazi
For Each Var In sVarSplit
Var = Var.Trim
Next
Dim nType As Integer = 0
Dim Type As Types = 0
Integer.TryParse(sVarSplit(2), nType)
If nType >= 0 AndAlso nType <= 7 Then Type = DirectCast(nType, Types)
If Type = 2 Then
Dim DbNumber As Integer = 0
Dim Start As Integer = 0
Integer.TryParse(sVarSplit(0), DbNumber)
Integer.TryParse(sVarSplit(1), Start)
If m_NC.ReadInt(DbNumber, Start, nValue) Then
Return True
End If
End If
End If
End If
Return False
End Function
Private Function WriteInt(sVarName As String, nValue As Integer) As Boolean
Dim bok As Boolean = True
Dim sVar As String = String.Empty
' Lettura variabile
If GetMainPrivateProfileString(S_VARIABLES, sVarName, "", sVar) > 0 Then
' Spezzatura nei componenti
Dim sVarSplit() As String = sVar.Split(","c)
If sVarSplit.Length = 3 Then
' elimino spazi
For Each Var In sVarSplit
Var = Var.Trim
Next
Dim nType As Integer = 0
Dim Type As Types = 0
Integer.TryParse(sVarSplit(2), nType)
If nType >= 0 AndAlso nType <= 7 Then Type = DirectCast(nType, Types)
If Type = 2 Then
Dim DbNumber As Integer = 0
Dim Start As Integer = 0
Integer.TryParse(sVarSplit(0), DbNumber)
Integer.TryParse(sVarSplit(1), Start)
If m_NC.WriteInt(DbNumber, Start, nValue) Then
Return True
End If
End If
End If
End If
Return False
End Function
End Class
+56
View File
@@ -0,0 +1,56 @@
Imports EgtUILib
Imports EgtWPFLib5
Public Class Nc_Debug
Inherits Nc_Parent
Private m_sDebugFilePath As String = Map.refMainWindowVM.MainWindowM.sConfigDir & "\Nc_Debug.ini"
Private m_nTime As Integer = 1
Private IntBuffer As Integer = 0
Private DoubleBuffer As Double = 0
Private StringBuffer As String ' Buffer
Friend Overrides Function InitConnection() As Boolean
Return True
End Function
Friend Overrides Sub CloseConnection()
End Sub
Friend Overrides Function ReadInt(DBNumber As Integer, Start As Integer, ByRef Value As Integer) As Boolean
Value = GetPrivateProfileInt(m_nTime.ToString, DBNumber & "." & Start, 0, m_sDebugFilePath)
Return True
End Function
Friend Overrides Function WriteInt(DBNumber As Integer, Start As Integer, Value As Int16) As Boolean
Return WritePrivateProfileString(m_nTime.ToString, DBNumber & "." & Start, Value.ToString, m_sDebugFilePath)
End Function
Friend Overrides Function ReadDInt(DBNumber As Integer, Start As Integer, ByRef Value As Integer) As Boolean
Value = GetPrivateProfileInt(m_nTime.ToString, DBNumber & "." & Start, 0, m_sDebugFilePath)
Return True
End Function
Friend Overrides Function WriteDInt(DBNumber As Integer, Start As Integer, Value As Integer) As Boolean
Return WritePrivateProfileString(m_nTime.ToString, DBNumber & "." & Start, Value.ToString, m_sDebugFilePath)
End Function
Friend Overrides Function ReadReal(DBNumber As Integer, Start As Integer, ByRef Value As Double) As Boolean
Value = GetPrivateProfileDouble(m_nTime.ToString, DBNumber & "." & Start, 0, m_sDebugFilePath)
Return True
End Function
Friend Overrides Function WriteReal(DBNumber As Integer, Start As Integer, Value As Single) As Boolean
Return WritePrivateProfileString(m_nTime.ToString, DBNumber & "." & Start, DoubleToString(Value, 3), m_sDebugFilePath)
End Function
Friend Sub SetTime(nTime As Integer)
m_nTime = nTime
End Sub
Friend Sub IncrementTime()
m_nTime += 1
End Sub
End Class
+19
View File
@@ -0,0 +1,19 @@
Public MustInherit Class Nc_Parent
Friend MustOverride Function InitConnection() As Boolean
Friend MustOverride Sub CloseConnection()
Friend MustOverride Function ReadInt(DBNumber As Integer, Start As Integer, ByRef Value As Integer) As Boolean
Friend MustOverride Function WriteInt(DBNumber As Integer, Start As Integer, Value As Int16) As Boolean
Friend MustOverride Function ReadDInt(DBNumber As Integer, Start As Integer, ByRef Value As Integer) As Boolean
Friend MustOverride Function WriteDInt(DBNumber As Integer, Start As Integer, Value As Integer) As Boolean
Friend MustOverride Function ReadReal(DBNumber As Integer, Start As Integer, ByRef Value As Double) As Boolean
Friend MustOverride Function WriteReal(DBNumber As Integer, Start As Integer, Value As Single) As Boolean
End Class
+120
View File
@@ -0,0 +1,120 @@
Imports EgtWPFLib5
Imports Sharp7
Public Class Nc_Siemens
Inherits Nc_Parent
Private IntBuffer() As Byte = {0, 0}
Private BoolBuffer() As Byte = {0}
Private DIntBuffer() As Byte = {0, 0, 0, 0}
Private RealBuffer() As Byte = {0, 0, 0, 0}
Private StringBuffer(65536) As Byte ' Buffer
Private Client As New S7Client ' Client Object
Friend Overrides Function InitConnection() As Boolean
Dim Result As Integer
Dim sIp As String = ""
GetMainPrivateProfileString(S_NUMERICALCONTROL, K_IP, "", sIp)
Dim nRack As Integer = GetMainPrivateProfileInt(S_NUMERICALCONTROL, K_RACK, 0)
Dim nSlot As Integer = GetMainPrivateProfileInt(S_NUMERICALCONTROL, K_SLOT, 0)
Result = Client.ConnectTo(sIp, nRack, nSlot)
Return Result = 0
End Function
Friend Overrides Sub CloseConnection()
Client.Disconnect()
End Sub
Friend Overrides Function ReadInt(DBNumber As Integer, Start As Integer, ByRef Value As Integer) As Boolean
' Read 2 bytes from the DBNumber starting from Start and puts them into ReadBuffer.
Dim Result As Integer = Client.DBRead(DBNumber, Start, 2, IntBuffer) ' DbNumber, Start, Amount, Buffer
If Result = 0 Then
Value = S7.GetIntAt(IntBuffer, 0)
Return True
End If
Return False
End Function
Friend Overrides Function WriteInt(DBNumber As Integer, Start As Integer, Value As Int16) As Boolean
S7.SetIntAt(IntBuffer, 0, Value)
' Read "Size" bytes from the DB "DBNumber" starting from 0 and puts them into Buffer.
Dim Result As Integer = Client.DBWrite(DBNumber, Start, 2, IntBuffer) ' DbNumber, Start, Amount, Buffer
Return Result = 0
End Function
Friend Function ReadBool(DBNumber As Integer, Start As Integer, ByRef Value As Boolean) As Boolean
' Read 2 bytes from the DBNumber starting from Start and puts them into ReadBuffer.
Dim Result As Integer = Client.DBRead(DBNumber, Start, 1, BoolBuffer) ' DbNumber, Start, Amount, Buffer
If Result = 0 Then
Value = BitConverter.ToBoolean(BoolBuffer, 0)
Return True
End If
Return False
End Function
Friend Function WriteBool(DBNumber As Integer, Start As Integer, Value As Boolean) As Boolean
If Value Then
BoolBuffer(0) = &H1
Else
BoolBuffer(0) = &H0
End If
' Read "Size" bytes from the DB "DBNumber" starting from 0 and puts them into Buffer.
Dim Result As Integer = Client.DBWrite(DBNumber, Start, 1, BoolBuffer) ' DbNumber, Start, Amount, Buffer
Return Result = 0
End Function
Friend Overrides Function ReadDInt(DBNumber As Integer, Start As Integer, ByRef Value As Integer) As Boolean
' Read 2 bytes from the DBNumber starting from Start and puts them into ReadBuffer.
Dim Result As Integer = Client.DBRead(DBNumber, Start, 4, DIntBuffer) ' DbNumber, Start, Amount, Buffer
If Result = 0 Then
Value = S7.GetDIntAt(DIntBuffer, 0)
Return True
End If
Return False
End Function
Friend Overrides Function WriteDInt(DBNumber As Integer, Start As Integer, Value As Integer) As Boolean
S7.SetDIntAt(DIntBuffer, 0, Value)
' Read "Size" bytes from the DB "DBNumber" starting from 0 and puts them into Buffer.
Dim Result As Integer = Client.DBWrite(DBNumber, Start, 4, DIntBuffer) ' DbNumber, Start, Amount, Buffer
Return Result = 0
End Function
Friend Overrides Function ReadReal(DBNumber As Integer, Start As Integer, ByRef Value As Double) As Boolean
' Read 4 bytes from the DBNumber starting from Start and puts them into ReadBuffer.
Dim Result As Integer = Client.DBRead(DBNumber, Start, 4, RealBuffer) ' DbNumber, Start, Amount, Buffer
If Result = 0 Then
Value = S7.GetRealAt(RealBuffer, 0)
Return True
End If
Return False
End Function
Friend Overrides Function WriteReal(DBNumber As Integer, Start As Integer, Value As Single) As Boolean
S7.SetRealAt(RealBuffer, 0, Value)
' Read "Size" bytes from the DB "DBNumber" starting from 0 and puts them into Buffer.
Dim Result As Integer = Client.DBWrite(DBNumber, Start, 4, RealBuffer) ' DbNumber, Start, Amount, Buffer
Return Result = 0
End Function
Friend Function ReadString(DBNumber As Integer, Start As Integer, Length As Integer, ByRef Value As String) As Boolean
' Read 2 bytes from the DBNumber starting from Start and puts them into ReadBuffer.
Dim Result As Integer = Client.DBRead(DBNumber, Start, Length, StringBuffer) ' DbNumber, Start, Amount, Buffer
If Result = 0 Then
Value = S7.GetStringAt(StringBuffer, 0)
Return True
End If
Return False
End Function
Friend Function WriteString(DBNumber As Integer, Start As Integer, Value As String) As Boolean
If Value.Length > 65535 Then
Return False
End If
S7.SetStringAt(StringBuffer, 0, 65535, Value)
' Read "Size" bytes from the DB "DBNumber" starting from 0 and puts them into Buffer.
Dim Result As Integer = Client.DBWrite(DBNumber, Start, Value.Length + 2, StringBuffer) ' DbNumber, Start, Amount, Buffer
Return Result = 0
End Function
End Class
+22
View File
@@ -0,0 +1,22 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.40629.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "OmagVIEWPlus", "OmagVIEWPlus.vbproj", "{14F465D6-9866-4DB4-AD9D-301B9E0C1338}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{14F465D6-9866-4DB4-AD9D-301B9E0C1338}.Debug|x86.ActiveCfg = Debug|x86
{14F465D6-9866-4DB4-AD9D-301B9E0C1338}.Debug|x86.Build.0 = Debug|x86
{14F465D6-9866-4DB4-AD9D-301B9E0C1338}.Release|x86.ActiveCfg = Release|x86
{14F465D6-9866-4DB4-AD9D-301B9E0C1338}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
+263
View File
@@ -0,0 +1,263 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" 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>{14F465D6-9866-4DB4-AD9D-301B9E0C1338}</ProjectGuid>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
<OutputType>WinExe</OutputType>
<RootNamespace>OmagVIEWPlus</RootNamespace>
<AssemblyName>OmagVIEWPlus</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<MyType>Custom</MyType>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</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|x64'">
<OutputPath>bin\x64\Debug\</OutputPath>
<DocumentationFile>
</DocumentationFile>
<Optimize>true</Optimize>
<NoWarn>
</NoWarn>
<DebugType>None</DebugType>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<DefineTrace>true</DefineTrace>
<OutputPath>bin\x64\Release\</OutputPath>
<DocumentationFile>
</DocumentationFile>
<Optimize>true</Optimize>
<NoWarn>
</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<OutputPath>bin\x86\Debug\</OutputPath>
<DocumentationFile>
</DocumentationFile>
<Optimize>false</Optimize>
<NoWarn>
</NoWarn>
<DebugType>Full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<DebugSymbols>true</DebugSymbols>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<DefineTrace>false</DefineTrace>
<OutputPath>bin\x86\Release\</OutputPath>
<DocumentationFile>
</DocumentationFile>
<Optimize>true</Optimize>
<NoWarn>
</NoWarn>
<DebugType>None</DebugType>
<PlatformTarget>x86</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="EgtUILib">
<HintPath>..\..\EgtProg\DllD32\EgtUILib.dll</HintPath>
</Reference>
<Reference Include="EgtWPFLib5">
<HintPath>..\..\EgtProg\DllD32\EgtWPFLib5.dll</HintPath>
</Reference>
<Reference Include="Sharp7.net">
<HintPath>..\..\EgtProg\OmagVIEWPlus\Sharp7.net.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<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" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="Application.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Application.xaml.vb">
<DependentUpon>Application.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Constants\ConstGen.vb" />
<Compile Include="Constants\ConstIni.vb" />
<Compile Include="Constants\ConstMsg.vb" />
<Compile Include="NCCommunication\Nc_Debug.vb" />
<Compile Include="NCCommunication\Nc_Parent.vb" />
<Compile Include="NCCommunication\Nc_Siemens.vb" />
<Compile Include="UnloadingArea\UnloadingAreaV.xaml.vb">
<DependentUpon>UnloadingAreaV.xaml</DependentUpon>
</Compile>
<Compile Include="UnloadingArea\UnloadingAreaVM.vb" />
<Compile Include="Utility\Dictionary.xaml.vb">
<DependentUpon>Dictionary.xaml</DependentUpon>
</Compile>
<Compile Include="Utility\Enums.vb" />
<Compile Include="Utility\Map.vb" />
<Compile Include="NCCommunication\NCCommunication.vb" />
<Compile Include="Warehouse\Box.vb" />
<Compile Include="Warehouse\WarehouseV.xaml.vb">
<DependentUpon>WarehouseV.xaml</DependentUpon>
</Compile>
<Compile Include="Warehouse\WarehouseVM.vb" />
</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\MainWindowM.vb" />
<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>
<AppDesigner Include="My Project\" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Page Include="MainWindow\MainWindowV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="UnloadingArea\UnloadingAreaV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Utility\Dictionary.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Warehouse\WarehouseV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\LogoOmag.jpg" />
<Resource Include="Resources\OmagCUT.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Pallet.png" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4 Client Profile %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.4.5">
<Visible>False</Visible>
<ProductName>Windows Installer 4.5</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Nastro.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Tavola1.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Rack.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<PropertyGroup>
<PostBuildEvent>IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\OmagVIEWPlus\OmagVIEWPlusR32.exe
IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Debug" copy $(TargetPath) c:\EgtProg\OmagVIEWPlus\OmagVIEWPlusD32.exe</PostBuildEvent>
</PropertyGroup>
</Project>
Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

+124
View File
@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="1200mm"
height="1000mm"
viewBox="0 0 1200 1000"
version="1.1"
id="svg8"
inkscape:version="0.92.3 (2405546, 2018-03-11)"
sodipodi:docname="Pallet.svg"
inkscape:export-filename="C:\EgtDev\OmagVIEWPlus\Resources\Pallet.png"
inkscape:export-xdpi="4.2417998"
inkscape:export-ydpi="4.2417998">
<defs
id="defs2" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.175"
inkscape:cx="1860.0538"
inkscape:cy="1860.8829"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1920"
inkscape:window-height="1017"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,703)">
<rect
style="opacity:1;fill:#b19448;fill-opacity:1;stroke:#323232;stroke-width:0.79424882;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect850"
width="149.20575"
height="999.20575"
x="0.39712441"
y="-702.60284"
ry="0.6518119" />
<rect
style="opacity:1;fill:#b19448;fill-opacity:1;stroke:#323232;stroke-width:0.79424882;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect850-4"
width="149.20575"
height="999.20575"
x="525.39709"
y="-702.60284"
ry="0.6518119" />
<rect
style="opacity:1;fill:#b19448;fill-opacity:1;stroke:#323232;stroke-width:0.79424882;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect850-7"
width="149.20575"
height="999.20575"
x="1050.3971"
y="-702.60284"
ry="0.6518119" />
<rect
style="opacity:1;fill:#f8bd4f;fill-opacity:1;stroke:#323232;stroke-width:0.66914606;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect815"
width="1199.3308"
height="110.44186"
x="0.33457303"
y="186.22357"
ry="0.65704167" />
<rect
style="opacity:1;fill:#f8bd4f;fill-opacity:1;stroke:#323232;stroke-width:0.66914606;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect815-7"
width="1199.3308"
height="110.44186"
x="0.33457303"
y="-35.998428"
ry="0.65704167" />
<rect
style="opacity:1;fill:#f8bd4f;fill-opacity:1;stroke:#323232;stroke-width:0.66914606;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect815-5"
width="1199.3308"
height="110.44186"
x="0.33457303"
y="-258.22043"
ry="0.65704167" />
<rect
style="opacity:1;fill:#f8bd4f;fill-opacity:1;stroke:#323232;stroke-width:0.66914606;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect815-71"
width="1199.3308"
height="110.44186"
x="0.33457303"
y="-480.44244"
ry="0.65704167" />
<rect
style="opacity:1;fill:#f8bd4f;fill-opacity:1;stroke:#323232;stroke-width:0.66914606;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect815-6"
width="1199.3308"
height="110.44186"
x="0.33457303"
y="-702.66443"
ry="0.65704167" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

+63
View File
@@ -0,0 +1,63 @@
<Grid x:Class="UnloadingAreaV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:OmagVIEWPlus="clr-namespace:OmagVIEWPlus"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="0.2*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<ItemsControl ItemsSource="{Binding WarehouseList}"
Grid.Row="1">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="1" Rows="2"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<OmagVIEWPlus:WarehouseV/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<Image Source="/Resources/Nastro.png"
Stretch="UniformToFill"
Grid.ColumnSpan="2"
Margin="10"/>
<Image Source="/Resources/Tavola1.png"
Stretch="Uniform"
Grid.Row="1" Grid.Column="1"
Margin="10"/>
<Grid Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Table1Counter}"
Grid.Column="1"
Style="{StaticResource CounterPercentageTextBlock}"/>
</Grid>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Table2Counter}"
Style="{StaticResource CounterPercentageTextBlock}"/>
</Grid>
<TextBlock Text="{Binding Table1Percentage}"
Grid.Column="1" Grid.Row="1"
Style="{StaticResource CounterPercentageTextBlock}"/>
</Grid>
+3
View File
@@ -0,0 +1,3 @@
Public Class UnloadingAreaV
End Class
+148
View File
@@ -0,0 +1,148 @@
Imports System.Collections.ObjectModel
Imports EgtWPFLib5
Public Class UnloadingAreaVM
Inherits VMBase
Private m_WarehouseList As New ObservableCollection(Of WarehouseVM)
Public ReadOnly Property WarehouseList As ObservableCollection(Of WarehouseVM)
Get
Return m_WarehouseList
End Get
End Property
Private m_ActiveWarehouse As Warehouses
Public ReadOnly Property ActiveWarehouse As Warehouses
Get
Return m_ActiveWarehouse
End Get
End Property
Private m_Table1CurrRow As Integer
Private m_Table1NRow As Integer
Public ReadOnly Property Table1Percentage As String
Get
Return DoubleToString(m_Table1CurrRow / m_Table1NRow * 100, 0) & "%"
End Get
End Property
Private m_TileType As Integer
Public ReadOnly Property TileType As String
Get
Return m_TileType.ToString
End Get
End Property
Private m_Table1Counter As Integer
Public ReadOnly Property Table1Counter As String
Get
Return m_Table1Counter.ToString
End Get
End Property
Private m_Table2Counter As Integer
Public ReadOnly Property Table2Counter As String
Get
Return m_Table2Counter.ToString
End Get
End Property
Private m_TileThickness As Double
Public ReadOnly Property TileThickness As String
Get
Return LenToString(m_TileThickness, 1)
End Get
End Property
Private m_LastSlab As Boolean
Public ReadOnly Property LastSlab As Boolean
Get
Return m_LastSlab
End Get
End Property
#Region "CONSTRUCTOR"
Sub New()
' Creo riferimento a questa classe in CompoWindowMap
Map.SetRefUnloadingAreaVM(Me)
m_WarehouseList.Add(New WarehouseVM(Warehouses.A))
m_WarehouseList.Add(New WarehouseVM(Warehouses.B))
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Friend Sub SetActiveWarehouse(ActiveWarehouse As Warehouses)
m_ActiveWarehouse = ActiveWarehouse
If ActiveWarehouse = Warehouses.A Then
m_WarehouseList(0).SetIsActive(True)
m_WarehouseList(1).SetIsActive(False)
ElseIf ActiveWarehouse = Warehouses.B Then
m_WarehouseList(0).SetIsActive(False)
m_WarehouseList(1).SetIsActive(True)
End If
'If ActiveWarehouse <> m_ActiveWarehouse Then
' m_ActiveWarehouse = ActiveWarehouse
' For Each Warehouse In m_WarehouseList
' Warehouse.SetState(If(Warehouse.Id = ActiveWarehouse, States.ACTIVE, States.FULL))
' Next
' m_WarehouseList(ActiveWarehouse - 1).SetState(States.ACTIVE)
'End If
End Sub
Friend Sub SetWarehouse_IsPallet(Warehouse As Warehouses, IsPallet As Boolean)
m_WarehouseList(Warehouse - 1).SetIsPallet(IsPallet)
End Sub
Friend Sub SetBoxIsActive(BoxId As Integer)
If Not m_ActiveWarehouse > 0 AndAlso m_ActiveWarehouse <= 2 Then
m_WarehouseList(Warehouses.A).SetBoxIsActive(0)
m_WarehouseList(Warehouses.A).SetBoxIsActive(0)
End If
m_WarehouseList(m_ActiveWarehouse - 1).SetBoxIsActive(BoxId)
End Sub
Friend Sub SetBoxState(Warehouse As Warehouses, Id As Integer, State As States)
m_WarehouseList(Warehouse - 1).SetBoxState(Id, State)
End Sub
Friend Sub FillActiveBox(Livello As Integer, Riga As Integer)
m_WarehouseList(m_ActiveWarehouse - 1).FillActiveBox(Livello, Riga)
End Sub
Friend Sub MaxFillActiveBox(MaxLivello As Integer, MaxRiga As Integer)
m_WarehouseList(m_ActiveWarehouse - 1).MaxFillActiveBox(MaxLivello, MaxRiga)
End Sub
Friend Sub SetTable1Counter(Table1Counter As Integer)
m_Table1Counter = Table1Counter
NotifyPropertyChanged("Table1Counter")
End Sub
Friend Sub SetTable2Counter(Table2Counter As Integer)
m_Table2Counter = Table2Counter
NotifyPropertyChanged("Table2Counter")
End Sub
Friend Sub SetTable1Percentage(Table1CurrRow As Integer, Table1NRow As Integer)
m_Table1CurrRow = Table1CurrRow
m_Table1NRow = Table1NRow
NotifyPropertyChanged("Table1Percentage")
End Sub
Friend Sub SetTileType(TyleType As Integer)
m_TileType = TyleType
NotifyPropertyChanged("TileType")
End Sub
Friend Sub SetTileThickness(TileThickness As Double)
m_TileThickness = TileThickness
NotifyPropertyChanged("TileThickness")
End Sub
Friend Sub SetLastSlab(LastSlab As Boolean)
m_LastSlab = LastSlab
NotifyPropertyChanged("LastSlab")
End Sub
#End Region ' METHODS
End Class
+398
View File
@@ -0,0 +1,398 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:OmagVIEWPlus="clr-namespace:OmagVIEWPlus"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5">
<!--
Assign a Key to every Panel ViewModel to use
it in xaml file(ProjectView.xaml).
-->
<OmagVIEWPlus:MainWindowVM x:Key="MainWindowVM"/>
<OmagVIEWPlus:UnloadingAreaVM x:Key="UnloadingAreaVM"/>
<!--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>
<!-- ______________________________________________________________________________________________________________________________________________ -->
<!-- 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_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>
<!-- ______________________________________________________________________________________________________________________________________________ -->
<!-- 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="UnloadingArea_ToggleButton" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource {x:Type ToggleButton}}">
<Setter Property="Margin" Value="25"/>
<Setter Property="Padding" Value="10"/>
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
<Setter Property="Background" Value="{StaticResource Omag_Green}"/>
<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="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="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_Red}"/>
<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}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</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="VerticalAlignment" Value="Center"/>
</Style>
<Style x:Key="CounterPercentageTextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="Background" Value="White"/>
<Setter Property="Height" Value="32"/>
<Setter Property="Width" Value="42"/>
<Setter Property="TextAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Padding" Value="10"/>
</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>
<!-- ______________________________________________________________________________________________________________________________________________ -->
<!-- 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>
<!-- ______________________________________________________________________________________________________________________________________________ -->
<!-- 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>
<!-- ______________________________________________________________________________________________________________________________________________ -->
<!-- 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>
<!-- ______________________________________________________________________________________________________________________________________________ -->
<!-- DataTemplate per pallet e rack -->
<DataTemplate x:Key="PalletTemplate">
<ToggleButton IsChecked="{Binding State_IsChecked}"
Style="{StaticResource UnloadingArea_ToggleButton}">
<ToggleButton.Content>
<Grid>
<Image Source="/Resources/Pallet.png"
Stretch="Uniform"
Visibility="{Binding Image_Visibility}"/>
<TextBlock Text="{Binding FillPercentage}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Visibility="{Binding Percentage_Visibility}"/>
</Grid>
</ToggleButton.Content>
</ToggleButton>
</DataTemplate>
<DataTemplate x:Key="RackTemplate">
<ToggleButton IsChecked="{Binding State_IsChecked}"
Style="{StaticResource UnloadingArea_ToggleButton}">
<ToggleButton.Content>
<Grid>
<Image Source="/Resources/Rack.png"
Stretch="Uniform"
Visibility="{Binding Image_Visibility}"/>
<TextBlock Text="{Binding FillPercentage}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Visibility="{Binding Percentage_Visibility}"/>
</Grid>
</ToggleButton.Content>
</ToggleButton>
</DataTemplate>
<!-- ______________________________________________________________________________________________________________________________________________ -->
</ResourceDictionary>
+30
View File
@@ -0,0 +1,30 @@
Public Class Dictionary
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
+14
View File
@@ -0,0 +1,14 @@
Public Module Enums
Public Enum Warehouses As Integer
A = 1
B = 2
End Enum
Public Enum States As Integer
NOT_AVAILABLE = 0
AVAILABLE = 1
FULL = 2
End Enum
End Module
+51
View File
@@ -0,0 +1,51 @@
Imports EgtWPFLib5
Module Map
Private m_refMainWindowVM As MainWindowVM
Private m_refUnloadingAreaVM As UnloadingAreaVM
#Region "Get"
Public ReadOnly Property refMainWindowVM As MainWindowVM
Get
Return m_refMainWindowVM
End Get
End Property
Public ReadOnly Property refUnloadingAreaVM As UnloadingAreaVM
Get
Return m_refUnloadingAreaVM
End Get
End Property
#End Region ' Get
#Region "Set"
'Friend Function SetRefStatusBarVM(StatusBarVM As StatusBarVM) As Boolean
' LibMap.SetRefStatusBarVM(StatusBarVM)
' Return Not IsNothing(LibMap.refStatusBarVM)
'End Function
Friend Function SetRefUnloadingAreaVM(UnloadingAreaVM As UnloadingAreaVM) As Boolean
m_refUnloadingAreaVM = UnloadingAreaVM
Return Not IsNothing(m_refUnloadingAreaVM)
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_refUnloadingAreaVM) ' AndAlso LibMap.EndInit()
End Function
#End Region ' Init
End Module
+133
View File
@@ -0,0 +1,133 @@
Imports EgtWPFLib5
Public Class Box
Inherits VMBase
#Region "FIELDS & PROPERTIES"
Private m_refWarehouse As WarehouseVM
Private m_Id As Integer
Private m_State As States
Public ReadOnly Property State As States
Get
Return m_State
End Get
End Property
Public Property State_IsChecked As Boolean
Get
Return (m_State <> States.AVAILABLE)
End Get
Set(value As Boolean)
If value Then
m_State = States.NOT_AVAILABLE
Else
m_State = States.AVAILABLE
End If
End Set
End Property
Private m_Livello As Integer
Private m_Fila As Integer
Private m_MaxLivello As Integer = 1
Private m_MaxFila As Integer = 1
Private m_Warehouse_IsActive As Boolean
Private m_IsActive As Boolean = False
Friend ReadOnly Property IsActive As Boolean
Get
Return m_IsActive
End Get
End Property
Private m_FillPercentage As Integer = 0
Public ReadOnly Property nFillPercentage As Integer
Get
Return m_FillPercentage
End Get
End Property
Public ReadOnly Property FillPercentage As String
Get
Return If(m_State = States.NOT_AVAILABLE, "--", m_FillPercentage & " %")
End Get
End Property
Private m_IsPallet As Boolean
Friend ReadOnly Property IsPallet As Boolean
Get
Return m_IsPallet
End Get
End Property
Public ReadOnly Property Percentage_Visibility As Visibility
Get
Return If(m_Warehouse_IsActive, Visibility.Visible, Visibility.Collapsed)
End Get
End Property
Public ReadOnly Property Image_Visibility As Visibility
Get
Return If(Not m_Warehouse_IsActive, Visibility.Visible, Visibility.Collapsed)
End Get
End Property
#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTOR"
Sub New(nId As Integer, bIsPallet As Boolean, Warehouse As WarehouseVM)
m_Id = nId
m_IsPallet = bIsPallet
m_refWarehouse = Warehouse
m_State = States.AVAILABLE
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Friend Sub SetState(State As States)
m_State = State
Select Case m_State
Case States.AVAILABLE, States.NOT_AVAILABLE
m_FillPercentage = 0
Case States.FULL
m_FillPercentage = 100
End Select
NotifyPropertyChanged("FillPercentage")
End Sub
Friend Sub SetWarehouse_IsActive(bIsActive As Boolean)
m_Warehouse_IsActive = bIsActive
NotifyPropertyChanged("Percentage_Visibility")
NotifyPropertyChanged("Image_Visibility")
End Sub
Friend Sub SetIsActive(IsActive As Boolean)
m_IsActive = IsActive
End Sub
Friend Sub FillBox(Livello As Integer, Fila As Integer)
m_Livello = Livello
m_Fila = Fila
If m_MaxLivello = 0 OrElse m_MaxFila = 0 Then
m_FillPercentage = 0
Else
m_FillPercentage = CInt(Math.Round((((m_Livello - 1) * m_MaxFila) + m_Fila) / (m_MaxLivello * m_MaxFila) * 100))
End If
NotifyPropertyChanged("FillPercentage")
End Sub
Friend Sub MaxFillBox(MaxLivello As Integer, MaxFila As Integer)
m_MaxLivello = MaxLivello
m_MaxFila = MaxFila
End Sub
#End Region ' METHODS
#Region "COMMANDS"
#End Region ' COMMANDS
End Class
+45
View File
@@ -0,0 +1,45 @@
<GroupBox x:Class="WarehouseV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:OmagVIEWPlus="clr-namespace:OmagVIEWPlus"
IsEnabled="{Binding IsEnabled}">
<GroupBox.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Id}"
Margin="10,0,5,0"/>
<TextBlock Text="{Binding FillPercentage}"
Margin="5,0,10,0"
Visibility="{Binding FillPercentage_Visibility}"/>
</StackPanel>
</GroupBox.Header>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Grid.Resources>
<OmagVIEWPlus:BoxTemplateSelector x:Key="BoxTemplateSelector"/>
</Grid.Resources>
<UniformGrid Columns="2">
<RadioButton Content="Pallet"
IsChecked="{Binding IsPallet}"
Style="{StaticResource OptionPanel_ToggleButton}"/>
<RadioButton Content="Rack"
IsChecked="{Binding NotIsPallet}"
Style="{StaticResource OptionPanel_ToggleButton}"/>
</UniformGrid>
<ItemsControl ItemsSource="{Binding Boxes}"
ItemTemplateSelector="{StaticResource BoxTemplateSelector}"
Grid.Row="1">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="3"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</Grid>
</GroupBox>
+21
View File
@@ -0,0 +1,21 @@
Public Class WarehouseV
End Class
Public Class BoxTemplateSelector
Inherits DataTemplateSelector
Public Overrides Function SelectTemplate(item As Object, container As DependencyObject) As DataTemplate
Dim element As FrameworkElement = TryCast(container, FrameworkElement)
If element IsNot Nothing AndAlso item IsNot Nothing AndAlso TypeOf item Is Box Then
Dim Box As Box = TryCast(item, Box)
If Box.IsPallet Then
Return TryCast(element.FindResource("PalletTemplate"), DataTemplate)
Else
Return TryCast(element.FindResource("RackTemplate"), DataTemplate)
End If
End If
Return MyBase.SelectTemplate(item, container)
End Function
End Class
+187
View File
@@ -0,0 +1,187 @@
Imports System.Collections.ObjectModel
Imports EgtUILib
Imports EgtWPFLib5
Public Class WarehouseVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
Private m_Id As Warehouses
Public ReadOnly Property Id As Warehouses
Get
Return m_Id
End Get
End Property
Private m_State As States
Friend ReadOnly Property State As States
Get
Return m_State
End Get
End Property
Private m_IsPallet As Boolean
Public Property IsPallet As Boolean
Get
Return m_IsPallet
End Get
Set(value As Boolean)
If value <> m_IsPallet Then
CreateBoxList(value)
m_IsPallet = value
End If
End Set
End Property
Public Property NotIsPallet As Boolean
Get
Return Not m_IsPallet
End Get
Set(value As Boolean)
If value = m_IsPallet Then
CreateBoxList(Not value)
m_IsPallet = Not value
End If
End Set
End Property
Private m_IsActive As Boolean = True
Friend ReadOnly Property IsActive As Boolean
Get
Return m_IsActive
End Get
End Property
Public ReadOnly Property IsEnabled As Boolean
Get
Return Not m_IsActive
End Get
End Property
Private m_Boxes As New ObservableCollection(Of Box)
Public Property Boxes As ObservableCollection(Of Box)
Get
Return m_Boxes
End Get
Set(value As ObservableCollection(Of Box))
m_Boxes = value
End Set
End Property
Private m_ActiveBox_Index As Integer
Private m_ActiveBox As Box
Public ReadOnly Property FillPercentage As String
Get
Dim Counter As Integer = 0
Dim Fill As Integer = 0
For Each Box In Boxes
If Box.State <> States.NOT_AVAILABLE Then
Counter += 1
Fill += Box.nFillPercentage
End If
Next
Return DoubleToString(Fill / Counter, 0) & "%"
End Get
End Property
Public ReadOnly Property FillPercentage_Visibility As Visibility
Get
Return If(m_IsActive, Visibility.Visible, Visibility.Collapsed)
End Get
End Property
#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTOR"
Sub New(nWarehouse As Warehouses)
m_Id = nWarehouse
NotifyPropertyChanged("Id")
' valore da leggere da macchina
IsPallet = True
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Private Sub CreateBoxList(bIsPallet As Boolean)
m_Boxes.Clear()
' aggiungo i box
Dim nBox As Integer = If(bIsPallet, 6, 3)
For Index = 1 To nBox
Boxes.Add(New Box(Index, bIsPallet, Me))
Next
End Sub
Friend Sub SetState(State As States)
m_State = State
End Sub
Friend Sub SetIsActive(bIsActive As Boolean)
m_IsActive = bIsActive
For Index = 0 To m_Boxes.Count - 1
m_Boxes(Index).SetWarehouse_IsActive(bIsActive)
Next
NotifyPropertyChanged("IsEnabled")
NotifyPropertyChanged("FillPercentage_Visibility")
End Sub
Friend Sub SetIsPallet(IsPallet As Boolean)
Me.IsPallet = IsPallet
NotifyPropertyChanged("IsPallet")
NotifyPropertyChanged("NotIsPallet")
End Sub
Friend Sub SetBoxState(Id As Integer, State As States)
m_Boxes(ConvertBoxIndex(Id) - 1).SetState(State)
End Sub
Friend Sub SetBoxIsActive(Id As Integer)
If Id > 0 And Id <= 6 Then
m_ActiveBox_Index = Id - 1
m_ActiveBox = Boxes(ConvertBoxIndex(Id) - 1)
End If
For Each Box In m_Boxes
Box.SetIsActive(Box Is m_ActiveBox)
Next
End Sub
Friend Sub FillActiveBox(Livello As Integer, Fila As Integer)
m_ActiveBox.FillBox(Livello, Fila)
NotifyPropertyChanged("FillPercentage")
End Sub
Friend Sub MaxFillActiveBox(MaxLivello As Integer, MaxFila As Integer)
m_ActiveBox.MaxFillBox(MaxLivello, MaxFila)
End Sub
' funzione che converte l'indice box che arriva dalla macchina nell'indice box della grafica
' sono disposti diversamente!
Private Function ConvertBoxIndex(MachineIndex As Integer) As Integer
If IsPallet Then
Select Case MachineIndex
Case 1
Return 4
Case 2
Return 1
Case 3
Return 5
Case 4
Return 2
Case 5
Return 6
Case 6
Return 3
Case Else
Return 4
End Select
Else
Return MachineIndex
End If
End Function
#End Region
End Class