diff --git a/App.config b/App.config
new file mode 100644
index 0000000..3fa3cae
--- /dev/null
+++ b/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/Application.xaml b/Application.xaml
new file mode 100644
index 0000000..5028241
--- /dev/null
+++ b/Application.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
diff --git a/Application.xaml.vb b/Application.xaml.vb
new file mode 100644
index 0000000..4c3378a
--- /dev/null
+++ b/Application.xaml.vb
@@ -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
diff --git a/Constants/ConstGen.vb b/Constants/ConstGen.vb
new file mode 100644
index 0000000..48b70a1
--- /dev/null
+++ b/Constants/ConstGen.vb
@@ -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 = "EgtDOORProbe.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 = "EgtDOORProbeLog#.txt"
+
+ ' Sottodirettorio di configurazione
+ Public Const CONF_DIR As String = "Config"
+ ' Sottodirettorio temporaneo
+ Public Const TEMP_DIR As String = "Temp"
+
+End Module
diff --git a/Constants/ConstIni.vb b/Constants/ConstIni.vb
new file mode 100644
index 0000000..b4629e0
--- /dev/null
+++ b/Constants/ConstIni.vb
@@ -0,0 +1,50 @@
+'----------------------------------------------------------------------------
+' 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 = "EgtDOORProbe.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_COMMANDLOG As String = "CommandLog"
+ 'Public Const K_MESSAGESDIR As String = "MessagesDir"
+ 'Public Const K_MESSAGES As String = "Messages"
+ Public Const K_EGTCAM5PATH As String = "EgtCAM5Path"
+ Public Const K_CNCFILEPATH As String = "CncFilePath"
+ Public Const K_DATAFILEPATH As String = "DataFilePath"
+ Public Const K_CHECKFILENAME As String = "CheckFileName"
+ Public Const K_DATAFILENAME As String = "DataFileName"
+ Public Const K_PARTPROGRAMFILENAME As String = "PartProgramFileName"
+ Public Const K_PROBINGTIMEOUT As String = "ProbingTimeout"
+ 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_DOORS As String = "Doors"
+ Public Const K_DDFENABLE As String = "DdfEnable"
+ Public Const K_BASEDIR As String = "BaseDir"
+ Public Const K_DDFEXEC As String = "DdfExec"
+ Public Const K_DDFFUNCTION As String = "DdfFun"
+ Public Const K_DDFDIR As String = "DdfDir"
+ Public Const K_DDFDEFAULTDIR As String = "DdfDefaultDir"
+ Public Const K_DDFMACHEXEC As String = "DdfMachExec"
+ Public Const K_TABLESDIR As String = "TablesDir"
+ Public Const K_CURRMTABLE As String = "CurrMTable"
+ Public Const K_MTABLEWINPLACE As String = "MTableWinPlace"
+
+End Module
diff --git a/Constants/ConstMsg.vb b/Constants/ConstMsg.vb
new file mode 100644
index 0000000..1f8d2d1
--- /dev/null
+++ b/Constants/ConstMsg.vb
@@ -0,0 +1,52 @@
+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_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
diff --git a/EgtDOORProbe.sln b/EgtDOORProbe.sln
new file mode 100644
index 0000000..3c1834e
--- /dev/null
+++ b/EgtDOORProbe.sln
@@ -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}") = "EgtDOORProbe", "EgtDOORProbe.vbproj", "{F1514999-464B-4EB2-A5BA-EF50F31286A0}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x86 = Debug|x86
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {F1514999-464B-4EB2-A5BA-EF50F31286A0}.Debug|x86.ActiveCfg = Debug|x86
+ {F1514999-464B-4EB2-A5BA-EF50F31286A0}.Debug|x86.Build.0 = Debug|x86
+ {F1514999-464B-4EB2-A5BA-EF50F31286A0}.Release|x86.ActiveCfg = Release|x86
+ {F1514999-464B-4EB2-A5BA-EF50F31286A0}.Release|x86.Build.0 = Release|x86
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/EgtDOORProbe.vbproj b/EgtDOORProbe.vbproj
new file mode 100644
index 0000000..7db1428
--- /dev/null
+++ b/EgtDOORProbe.vbproj
@@ -0,0 +1,216 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {F1514999-464B-4EB2-A5BA-EF50F31286A0}
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}
+ WinExe
+ EgtDOORProbe
+ EgtDOORProbe
+ v4.0
+ Custom
+ Client
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+ On
+
+
+ Binary
+
+
+ Off
+
+
+ On
+
+
+ true
+ true
+ true
+ bin\x86\Debug\
+ EgtDOORProbe.xml
+
+
+ full
+ x86
+ MinimumRecommendedRules.ruleset
+ true
+
+
+ true
+ bin\x86\Release\
+ EgtDOORProbe.xml
+ true
+
+
+ pdbonly
+ x86
+ MinimumRecommendedRules.ruleset
+ true
+
+
+ Resources\EgtDOORProbe.ico
+
+
+
+ False
+ ..\..\EgtProg\DllD32\EgtUILib.dll
+
+
+ ..\..\EgtProg\DllD32\EgtWPFLib5.dll
+
+
+
+
+
+
+
+
+ 4.0
+
+
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+
+
+ ProbingPanelV.xaml
+
+
+
+ StatusBarV.xaml
+
+
+
+ MSBuild:Compile
+ Designer
+
+
+ Application.xaml
+ Code
+
+
+
+
+
+ MainWindowV.xaml
+ Code
+
+
+ Designer
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Code
+
+
+ Microsoft.VisualBasic.WPF.MyExtension
+ 1.0.0.0
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ VbMyResourcesResXFileCodeGenerator
+ Resources.Designer.vb
+ My.Resources
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.vb
+
+
+
+
+
+
+
+
+
+
+
+ False
+ Microsoft .NET Framework 4 Client Profile %28x86 and x64%29
+ true
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ false
+
+
+ False
+ Windows Installer 4.5
+ true
+
+
+
+
+ IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\EgtDOORProbe\EgtDOORProbeR32.exe
+IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Debug" copy $(TargetPath) c:\EgtProg\EgtDOORProbe\EgtDOORProbeD32.exe
+
+
+
\ No newline at end of file
diff --git a/MainWindow/MainWindowM.vb b/MainWindow/MainWindowM.vb
new file mode 100644
index 0000000..5d12155
--- /dev/null
+++ b/MainWindow/MainWindowM.vb
@@ -0,0 +1,205 @@
+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_sMachinesRoot As String
+ 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()
+ ' Verifico sia l'unica istanza
+ ManageSingleIstance()
+ ' 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
+ ' 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.OFFICE_BASE)
+ '' Leggo direttorio dei messaggi (se manca uso direttorio di configurazione)
+ 'Dim sMsgDir As String = String.Empty
+ 'If GetMainPrivateProfileString(S_GENERAL, K_MESSAGESDIR, "", sMsgDir) = 0 Then
+ ' sMsgDir = m_sConfigDir
+ 'End If
+ '' Leggo lingua corrente
+ 'Dim sLanguage As String = String.Empty
+ 'GetMainPrivateProfileString(S_GENERAL, K_MESSAGES, "", sLanguage)
+ '' Recupero nome file dei messaggi della lingua corrente
+ 'Dim sMsgName As String = "EgalTechIta.txt"
+ 'Dim nIndex As Integer = 1
+ 'While True
+ ' Dim ReadLanguage As Language = GetMainPrivateProfileLanguage(S_LANGUAGES, K_LANGUAGE & nIndex)
+ ' If IsNothing(ReadLanguage) Then Exit While
+ ' If String.Compare(ReadLanguage.Name, sLanguage, True) = 0 Then
+ ' sMsgName = ReadLanguage.FilePath
+ ' Exit While
+ ' End If
+ ' nIndex += 1
+ 'End While
+ '' Leggo file messaggi
+ 'Dim sMsgFilePath As String = sMsgDir & "\" & sMsgName
+ 'If Not EgtLoadMessages(sMsgFilePath) Then
+ ' EgtOutLog("Error in EgtLoadMessages")
+ 'End If
+ ' Leggo e imposto 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 ManageSingleIstance()
+ Dim bCreated As Boolean
+ Try
+ m_objMutex = New Mutex(False, "Global\EgtDOORProbe", bCreated)
+ Catch
+ bCreated = False
+ End Try
+ If Not bCreated 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("EgtDOORProbeR32")
+ 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("EgtDOORProbeR64")
+ 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
+ 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()
+ End Sub
+
+#End Region ' METHODS
+
+End Class
diff --git a/MainWindow/MainWindowV.xaml b/MainWindow/MainWindowV.xaml
new file mode 100644
index 0000000..6a47eec
--- /dev/null
+++ b/MainWindow/MainWindowV.xaml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/MainWindow/MainWindowV.xaml.vb b/MainWindow/MainWindowV.xaml.vb
new file mode 100644
index 0000000..35d4e68
--- /dev/null
+++ b/MainWindow/MainWindowV.xaml.vb
@@ -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
diff --git a/MainWindow/MainWindowVM.vb b/MainWindow/MainWindowVM.vb
new file mode 100644
index 0000000..ebde47b
--- /dev/null
+++ b/MainWindow/MainWindowVM.vb
@@ -0,0 +1,82 @@
+Imports EgtWPFLib5
+
+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
+
+ ' 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
+
+#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
+ ' imposto titolo finestra
+ m_Title = "EgtDOORProbe"
+ NotifyPropertyChanged("Title")
+ 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
+ ' Se istanza oltre la prima, chiedo cosa aprire
+ If Not m_MainWindowM.bFirstInstance Then
+ ' OmagOFFICEMap.refTopCommandBarVM.Open()
+ ' ' altrimenti verifico se richiesto ultimo progetto
+ 'ElseIf GetMainPrivateProfileInt(S_GENERAL, K_AUTOLOADLASTPROJ, 0) = 1 Then
+ ' Dim sLastProjectPath As String = String.Empty
+ ' GetMainPrivateProfileString(S_GENERAL, K_LASTPROJ, String.Empty, sLastProjectPath)
+ ' If Not String.IsNullOrWhiteSpace(sLastProjectPath) AndAlso File.Exists(sLastProjectPath) Then
+ ' OmagOFFICEMap.refTopCommandBarVM.OpenProject(sLastProjectPath)
+ ' Else
+ ' OmagOFFICEMap.refTopCommandBarVM.NewCmd()
+ ' End If
+ ' altrimenti nuovo progetto
+ End If
+ End Sub
+
+#End Region ' METHODS
+
+End Class
diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb
new file mode 100644
index 0000000..31f6b2b
--- /dev/null
+++ b/My Project/AssemblyInfo.vb
@@ -0,0 +1,64 @@
+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 DEBUG Then
+
+
+#Else
+
+
+#End If
+
+
+
+
+
+
+'In order to begin building localizable applications, set
+'CultureYouAreCodingWith in your .vbproj file
+'inside a . For example, if you are using US english
+'in your source files, set the 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.
+
+'
+
+
+'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)
+
+
+
+
+'The following GUID is for the ID of the typelib if this project is exposed to COM
+
+
+' 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:
+'
+
+
+
diff --git a/My Project/MyExtensions/MyWpfExtension.vb b/My Project/MyExtensions/MyWpfExtension.vb
new file mode 100644
index 0000000..2f5639e
--- /dev/null
+++ b/My Project/MyExtensions/MyWpfExtension.vb
@@ -0,0 +1,121 @@
+#If _MyType <> "Empty" Then
+
+Namespace My
+ '''
+ ''' Module used to define the properties that are available in the My Namespace for WPF
+ '''
+ '''
+ _
+ 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)
+ '''
+ ''' Returns the application object for the running application
+ '''
+ _
+ Friend ReadOnly Property Application() As Application
+ Get
+ Return CType(Global.System.Windows.Application.Current, Application)
+ End Get
+ End Property
+ '''
+ ''' Returns information about the host computer.
+ '''
+ _
+ Friend ReadOnly Property Computer() As Global.Microsoft.VisualBasic.Devices.Computer
+ Get
+ Return s_Computer.GetInstance()
+ End Get
+ End Property
+ '''
+ ''' Returns information for the current user. If you wish to run the application with the current
+ ''' Windows user credentials, call My.User.InitializeWithWindowsUser().
+ '''
+ _
+ Friend ReadOnly Property User() As Global.Microsoft.VisualBasic.ApplicationServices.User
+ Get
+ Return s_User.GetInstance()
+ End Get
+ End Property
+ '''
+ ''' Returns the application log. The listeners can be configured by the application's configuration file.
+ '''
+ _
+ Friend ReadOnly Property Log() As Global.Microsoft.VisualBasic.Logging.Log
+ Get
+ Return s_Log.GetInstance()
+ End Get
+ End Property
+
+ '''
+ ''' Returns the collection of Windows defined in the project.
+ '''
+ _
+ Friend ReadOnly Property Windows() As MyWindows
+ _
+ Get
+ Return s_Windows.GetInstance()
+ End Get
+ End Property
+ _
+ _
+ Friend NotInheritable Class MyWindows
+ _
+ 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
+ _
+ _
+ Private Sub Dispose__Instance__(Of T As Global.System.Windows.Window)(ByRef instance As T)
+ instance = Nothing
+ End Sub
+ _
+ _
+ Public Sub New()
+ MyBase.New()
+ End Sub
+ Private Shared s_WindowBeingCreated As Global.System.Collections.Hashtable
+ Public Overrides Function Equals(ByVal o As Object) As Boolean
+ Return MyBase.Equals(o)
+ End Function
+ Public Overrides Function GetHashCode() As Integer
+ Return MyBase.GetHashCode
+ End Function
+ _
+ _
+ Friend Overloads Function [GetType]() As Global.System.Type
+ Return GetType(MyWindows)
+ End Function
+ 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
+ _
+ _
+ Friend ReadOnly Property Info() As Global.Microsoft.VisualBasic.ApplicationServices.AssemblyInfo
+ _
+ Get
+ Return New Global.Microsoft.VisualBasic.ApplicationServices.AssemblyInfo(Global.System.Reflection.Assembly.GetExecutingAssembly())
+ End Get
+ End Property
+End Class
+#End If
\ No newline at end of file
diff --git a/My Project/Resources.Designer.vb b/My Project/Resources.Designer.vb
new file mode 100644
index 0000000..84df411
--- /dev/null
+++ b/My Project/Resources.Designer.vb
@@ -0,0 +1,63 @@
+'------------------------------------------------------------------------------
+'
+' 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.
+'
+'------------------------------------------------------------------------------
+
+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.
+ '''
+ ''' A strongly-typed resource class, for looking up localized strings, etc.
+ '''
+ _
+ Friend Module Resources
+
+ Private resourceMan As Global.System.Resources.ResourceManager
+
+ Private resourceCulture As Global.System.Globalization.CultureInfo
+
+ '''
+ ''' Returns the cached ResourceManager instance used by this class.
+ '''
+ _
+ 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("EgtDOORProbe.Resources", GetType(Resources).Assembly)
+ resourceMan = temp
+ End If
+ Return resourceMan
+ End Get
+ End Property
+
+ '''
+ ''' Overrides the current thread's CurrentUICulture property for all
+ ''' resource lookups using this strongly typed resource class.
+ '''
+ _
+ Friend Property Culture() As Global.System.Globalization.CultureInfo
+ Get
+ Return resourceCulture
+ End Get
+ Set
+ resourceCulture = value
+ End Set
+ End Property
+ End Module
+End Namespace
diff --git a/My Project/Resources.resx b/My Project/Resources.resx
new file mode 100644
index 0000000..ffecec8
--- /dev/null
+++ b/My Project/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/My Project/Settings.Designer.vb b/My Project/Settings.Designer.vb
new file mode 100644
index 0000000..38a3b20
--- /dev/null
+++ b/My Project/Settings.Designer.vb
@@ -0,0 +1,71 @@
+'------------------------------------------------------------------------------
+'
+' 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.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+
+ _
+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
+
+ _
+ 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
+
+ _
+ Friend Module MySettingsProperty
+
+ _
+ Friend ReadOnly Property Settings() As Global.EgtDOORProbe.MySettings
+ Get
+ Return Global.EgtDOORProbe.MySettings.Default
+ End Get
+ End Property
+ End Module
+End Namespace
diff --git a/My Project/Settings.settings b/My Project/Settings.settings
new file mode 100644
index 0000000..2b428d2
--- /dev/null
+++ b/My Project/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ProbingPanel/ProbingPanelV.xaml b/ProbingPanel/ProbingPanelV.xaml
new file mode 100644
index 0000000..e21f9b9
--- /dev/null
+++ b/ProbingPanel/ProbingPanelV.xaml
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProbingPanel/ProbingPanelV.xaml.vb b/ProbingPanel/ProbingPanelV.xaml.vb
new file mode 100644
index 0000000..dd11511
--- /dev/null
+++ b/ProbingPanel/ProbingPanelV.xaml.vb
@@ -0,0 +1,3 @@
+Public Class ProbingPanelV
+
+End Class
diff --git a/ProbingPanel/ProbingPanelVM.vb b/ProbingPanel/ProbingPanelVM.vb
new file mode 100644
index 0000000..0a0640e
--- /dev/null
+++ b/ProbingPanel/ProbingPanelVM.vb
@@ -0,0 +1,611 @@
+Imports System.Windows.Threading
+Imports EgtWPFLib5
+Imports System.IO
+
+Public Class ProbingPanelVM
+ Inherits VMBase
+
+ Public Enum Properties As Integer
+ NULL = 0
+ SKINNED = 1
+ EXTRUDED = 2
+ NOTHING_ = 3
+ End Enum
+
+ ' Path di EgtCAM5
+ Private m_EgtCAM5Path As String
+ Private m_CncFilePath As String
+ Private m_DataFilePath As String
+ Private m_CheckFileName As String
+ Private m_DataFileName As String
+ Private m_PartProgFileName As String
+
+ ' Timer d'attesa
+ Private m_Timer As New DispatcherTimer
+
+ Private m_DDFPath As String
+ Public ReadOnly Property DDFPath As String
+ Get
+ Return m_DDFPath
+ End Get
+ End Property
+
+ Private m_DoorProperty As Properties
+ Public ReadOnly Property DoorProperty As Properties
+ Get
+ Return m_DoorProperty
+ End Get
+ End Property
+
+ Public ReadOnly Property DoorType As String
+ Get
+ Select Case m_DoorProperty
+ Case Properties.SKINNED
+ Return "Skinned"
+ Case Properties.EXTRUDED
+ Return "Extruded"
+ Case Properties.NOTHING_
+ Return "Nothing"
+ Case Else
+ Return ""
+ End Select
+ End Get
+ End Property
+
+ Private m_Width As String
+ Public Property Width As String
+ Get
+ Return m_Width
+ End Get
+ Set(value As String)
+ m_Width = value
+ End Set
+ End Property
+
+ Private m_Height As String
+ Public Property Height As String
+ Get
+ Return m_Height
+ End Get
+ Set(value As String)
+ m_Height = value
+ End Set
+ End Property
+
+ Private m_Thickness As String
+ Public Property Thickness As String
+ Get
+ Return m_Thickness
+ End Get
+ Set(value As String)
+ m_Thickness = value
+ End Set
+ End Property
+
+ Private m_Status As String
+ Public Property Status As String
+ Get
+ Return m_Status
+ End Get
+ Set(value As String)
+ m_Status = value
+ End Set
+ End Property
+
+ Public Property Progress_Value As Double
+ Get
+ Return m_Timer_Time / m_Timer_TimeOut * 100
+ End Get
+ Set(value As Double)
+ End Set
+ End Property
+
+ Private m_OpenDDF_IsEnabled As Boolean
+ Public Property OpenDDF_IsEnabled As Boolean
+ Get
+ Return m_OpenDDF_IsEnabled
+ End Get
+ Set(value As Boolean)
+ m_OpenDDF_IsEnabled = value
+ End Set
+ End Property
+
+ Private m_Generate_IsEnabled As Boolean
+ Public Property Generate_IsEnabled As Boolean
+ Get
+ Return m_Generate_IsEnabled
+ End Get
+ Set(value As Boolean)
+ m_Generate_IsEnabled = value
+ End Set
+ End Property
+
+ Private m_Timer_IsEnabled As Boolean = False
+ Public Property Timer_IsEnabled As Boolean
+ Get
+ Return m_Timer_IsEnabled
+ End Get
+ Set(value As Boolean)
+ m_Timer_IsEnabled = value
+ End Set
+ End Property
+
+ ' Tempo per cui il timer resta in attesa, espresso in secondi
+ Private m_Timer_TimeOut As Integer
+ Private m_Timer_Time As Integer
+
+ ' definizione comandi
+ Private m_cmdOpenDDF As ICommand
+ Private m_cmdCancel As ICommand
+ Private m_cmdGenerate As ICommand
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ ' Leggo path EgtCAM5
+ Dim sTemp As String = ""
+ GetMainPrivateProfileString(S_GENERAL, K_EGTCAM5PATH, "", sTemp)
+ ' verifico che esista il file d'esecuzione
+ If File.Exists(sTemp) Then
+ m_EgtCAM5Path = sTemp
+ Else
+ MessageBox.Show("Can't find EgtCAM5 in the configured path." & Environment.NewLine &
+ "Try to check in the Config.ini file." & Environment.NewLine &
+ "The program will close", "Error!", MessageBoxButton.OK)
+ End
+ End If
+ ' Leggo path CNC File
+ GetMainPrivateProfileString(S_GENERAL, K_CNCFILEPATH, "", sTemp)
+ ' verifico che esista il file d'esecuzione
+ If Directory.Exists(sTemp) Then
+ m_CncFilePath = sTemp
+ Else
+ MessageBox.Show("Can't find CNC file path." & Environment.NewLine &
+ "Try to check in the Config.ini file." & Environment.NewLine &
+ "The program will close", "Error!", MessageBoxButton.OK)
+ End
+ End If
+ ' Leggo path Data File
+ GetMainPrivateProfileString(S_GENERAL, K_DATAFILEPATH, "", sTemp)
+ ' verifico che esista il file d'esecuzione
+ If Directory.Exists(sTemp) Then
+ m_DataFilePath = sTemp
+ Else
+ MessageBox.Show("Can't find Data path." & Environment.NewLine &
+ "Try to check in the Config.ini file." & Environment.NewLine &
+ "The program will close", "Error!", MessageBoxButton.OK)
+ End
+ End If
+ ' Leggo nome Part Program File
+ GetMainPrivateProfileString(S_GENERAL, K_PARTPROGRAMFILENAME, "", sTemp)
+ ' verifico che non sia vuoto
+ If Not String.IsNullOrWhiteSpace(sTemp) Then
+ m_PartProgFileName = sTemp
+ Else
+ m_PartProgFileName = "Door.cnc"
+ End If
+ ' Leggo nome Data File
+ GetMainPrivateProfileString(S_GENERAL, K_DATAFILENAME, "", sTemp)
+ ' verifico che non sia vuoto
+ If Not String.IsNullOrWhiteSpace(sTemp) Then
+ m_DataFileName = sTemp
+ Else
+ m_DataFileName = "Data.dat"
+ End If
+ ' Leggo nome Check File
+ GetMainPrivateProfileString(S_GENERAL, K_CHECKFILENAME, "", sTemp)
+ ' verifico che non sia vuoto
+ If Not String.IsNullOrWhiteSpace(sTemp) Then
+ m_CheckFileName = sTemp
+ Else
+ m_CheckFileName = "PCHK.txt"
+ End If
+ ' settaggi timer
+ AddHandler m_Timer.Tick, AddressOf WaitingTimer_Tick
+ m_Timer.Interval = TimeSpan.FromMilliseconds(1000)
+ ' Leggo timeout
+ Dim nTemp As Integer = 0
+ GetMainPrivateProfileString(S_GENERAL, K_PROBINGTIMEOUT, "60", sTemp)
+ If Not String.IsNullOrWhiteSpace(sTemp) And Integer.TryParse(sTemp, nTemp) Then
+ m_Timer_TimeOut = nTemp
+ Else
+ m_Timer_TimeOut = 60
+ End If
+ ' Attivo bottone apertura DDF
+ EnableDDFButton(True)
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+#Region "METHODS"
+
+ Private Sub SetStatus(sValue As String)
+ m_Status = sValue
+ NotifyPropertyChanged("Status")
+ End Sub
+
+ Private Sub ResetStatus()
+ m_Status = ""
+ NotifyPropertyChanged("Status")
+ End Sub
+
+ Private Sub WaitingTimer_Tick(sender As Object, e As System.EventArgs)
+ ' incremento il contatore
+ m_Timer_Time += 1
+ NotifyPropertyChanged("Progress_Value")
+ ' se trova il file di fine tastatura
+ Dim EndProbeFilePath As String = m_DataFilePath & m_CheckFileName
+ If File.Exists(EndProbeFilePath) Then
+ ' fermo il timer
+ m_Timer.Stop()
+ m_Timer_Time = 0
+ m_Timer_IsEnabled = False
+ NotifyPropertyChanged("Progress_Value")
+ NotifyPropertyChanged("Timer_IsEnabled")
+ SetStatus("Probe completed")
+ ' lancio calcolo porta da file tastatura
+ GenAfterProbe()
+ EnableDDFButton(True)
+ End If
+ ' verifico che non sia finito il tempo di attesa
+ If m_Timer_Time >= m_Timer_TimeOut Then
+ m_Timer.Stop()
+ m_Timer_Time = 0
+ m_Timer_IsEnabled = False
+ NotifyPropertyChanged("Progress_Value")
+ NotifyPropertyChanged("Timer_IsEnabled")
+ SetStatus("Error in probing, can't find the probe file")
+ EnableDDFButton(True)
+ End If
+ End Sub
+
+ Private Sub GenAfterProbe()
+ ' verifico se esiste il file dati del probe
+ Dim DataFile As String = m_DataFilePath & m_DataFileName
+ If Not File.Exists(DataFile) Then
+ SetStatus("Can't find the Probe Data File")
+ Return
+ End If
+ SetStatus("Start recalculating door from probe dimensions")
+ ' copio file probe data in cartella ddf
+ Try
+ File.Copy(DataFile, Path.GetDirectoryName(m_DDFPath) & "\" & "Data.dat")
+ Catch ex As Exception
+ SetStatus("Error in copying the Probe Data File to the PC")
+ Return
+ End Try
+ ' cancello file probe data sul CN
+ Try
+ File.Delete(DataFile)
+ Catch ex As Exception
+ SetStatus("Error in deleting the Probe Data File on the CNC" &
+ Environment.NewLine & "Please, delete it manually")
+ System.Threading.Thread.Sleep(2000)
+ End Try
+ ' cancello file txt e cnc del ddf
+ Try
+ File.Delete(Path.ChangeExtension(m_DDFPath, ".txt"))
+ File.Delete(Path.ChangeExtension(m_DDFPath, ".cnc"))
+ Catch ex As Exception
+
+ End Try
+ ' Lancio il programma in cieco per generazione porta ricalcolata
+ Dim GenFilePath As String = Path.ChangeExtension(m_DDFPath, ".cnc")
+ SetStatus("Generating the Part Program")
+ Try
+ Dim CommandLine As String = """" & m_DDFPath & """ " & "4"
+ Process.Start(m_EgtCAM5Path, CommandLine)
+ Dim bTxtOk As Boolean = False
+ For I = 0 To 150
+ ' aspetto che venga generato il txt del ddf
+ If Not bTxtOk AndAlso File.Exists(Path.ChangeExtension(m_DDFPath, ".txt")) Then
+ bTxtOk = True
+ ' pausa necessaria, altrimenti copia un file vuoto!
+ System.Threading.Thread.Sleep(1000)
+ End If
+ If bTxtOk AndAlso File.Exists(GenFilePath) Then
+ SetStatus("Part program correctly generated")
+ Exit Try
+ End If
+ ' Aspetto e costringo ad aggiornare UI
+ System.Threading.Thread.Sleep(100)
+ UpdateUI()
+ Next
+ SetStatus("Error in Part Program generation!")
+ Return
+ Catch ex As Exception
+ SetStatus("Error in Part Program generation!")
+ Return
+ End Try
+ SetStatus("Copying the Part Program to the CNC")
+ ' copio il programma sul CN
+ Try
+ Dim NcFilePath As String = m_CncFilePath & "\" &
+ m_PartProgFileName &
+ ".cnc"
+ File.Delete(NcFilePath)
+ File.Copy(Path.ChangeExtension(m_DDFPath, ".cnc"), NcFilePath)
+ SetStatus("Part program copied to the CNC, activate it and start the machine")
+ Catch ex As Exception
+ SetStatus("Error in copying the Part Program to the CNC")
+ Return
+ End Try
+ End Sub
+
+#End Region ' METHODS
+
+#Region "COMMANDS"
+
+#Region "OpenDDF"
+
+ ' Returns a command that manage the MainWindow_Unloaded command
+ Public ReadOnly Property OpenDDF_Command() As ICommand
+ Get
+ If m_cmdOpenDDF Is Nothing Then
+ m_cmdOpenDDF = New Command(AddressOf OpenDDF)
+ End If
+ Return m_cmdOpenDDF
+ End Get
+ End Property
+
+ ' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
+ Public Sub OpenDDF(ByVal param As Object)
+ ' verifico che non sia in corso una tastatura
+ If m_Timer.IsEnabled Then Return
+ Dim Path_IsValid As Boolean = False
+ ' Direttorio corrente per file DDF
+ Dim sDir As String = String.Empty
+ GetMainPrivateProfileString(S_DOORS, K_DDFDIR, "", sDir)
+ ' apro finestra di scelta file
+ Dim OpenFileDialogWnd As New Microsoft.Win32.OpenFileDialog With {
+ .Title = "Open DDF",
+ .Filter = "DDF File(*.ddf)|*.ddf",
+ .FilterIndex = 1,
+ .InitialDirectory = sDir}
+ If Not OpenFileDialogWnd.ShowDialog Then Return
+ ' segno path ottenuta
+ Dim TempPath As String = OpenFileDialogWnd.FileName
+ ' verifico di aver ricevuto una path valida
+ If File.Exists(TempPath) And Path.GetExtension(TempPath) = ".ddf" Then
+ m_DDFPath = TempPath
+ Path_IsValid = True
+ ' segno path in ini file
+ WriteMainPrivateProfileString(S_DOORS, K_DDFDIR, System.IO.Path.GetDirectoryName(TempPath))
+ Else
+ m_DDFPath = String.Empty
+ Path_IsValid = False
+ End If
+ ' se path valida
+ If Path_IsValid Then
+ ' provo a leggere il file
+ Dim FileContent As String() = File.ReadAllLines(m_DDFPath)
+ If FileContent.Length = 0 Then
+ Map.refStatusBarVM.SetOutputMessage("Impossible to read this DDF file", MSG_TYPE.ERROR_)
+ Return
+ End If
+ ' scansiono il contenuto del file
+ Dim bPropertiesFounded As Boolean = False
+ Dim bSizeFounded As Boolean = False
+ Dim bWidthFounded As Boolean = False
+ Dim bHeightFounded As Boolean = False
+ Dim bThicknessFounded As Boolean = False
+ For LineIndex As Integer = 0 To FileContent.Count - 1
+ Dim sFileLine As String = FileContent(LineIndex)
+ ' se riga vuota, salto alla prossima
+ If String.IsNullOrWhiteSpace(sFileLine) Then Continue For
+ ' se riga di commento, salto alla prossima
+ If sFileLine(0) = "#" Then Continue For
+ ' elimino commento all'interno della riga
+ If sFileLine.Contains("#") Then
+ Strings.Left(sFileLine, InStr(sFileLine, "#"))
+ End If
+ ' cerco la proprietà
+ If sFileLine.Contains("properties:") Then
+ If sFileLine.Contains("skinned") Then
+ m_DoorProperty = Properties.SKINNED
+ ElseIf sFileLine.Contains("extruded") Then
+ m_DoorProperty = Properties.EXTRUDED
+ Else
+ m_DoorProperty = Properties.NOTHING_
+ End If
+ bPropertiesFounded = True
+ End If
+ ' cerco dimensioni porta
+ If Not bSizeFounded And sFileLine.Contains("size:") Then
+ bSizeFounded = True
+ Continue For
+ End If
+ If Not bThicknessFounded And bHeightFounded Then
+ bThicknessFounded = CheckDoorDimension(sFileLine, "thickness:", m_Thickness)
+ End If
+ If Not bHeightFounded And bWidthFounded Then
+ bHeightFounded = CheckDoorDimension(sFileLine, "height:", m_Height)
+ End If
+ If Not bWidthFounded And bSizeFounded Then
+ bWidthFounded = CheckDoorDimension(sFileLine, "width:", m_Width)
+ End If
+ Next
+ ' se non ho trovato dimensioni, errore e disattivo interfaccia
+ If Not bSizeFounded Or Not bThicknessFounded Then
+ Map.refStatusBarVM.SetOutputMessage("Impossible to read this DDF file", MSG_TYPE.ERROR_)
+ m_Generate_IsEnabled = False
+ Return
+ Else
+ Map.refStatusBarVM.SetOutputMessage("DDF correctly opened", 5, MSG_TYPE.INFO)
+ m_Generate_IsEnabled = True
+ End If
+ ' se non ho trovato opzioni, setto a NULL
+ If Not bPropertiesFounded Then m_DoorProperty = Properties.NOTHING_
+ Else
+ Map.refStatusBarVM.SetOutputMessage("Impossible to read this DDF file", MSG_TYPE.ERROR_)
+ ' disabilito interfaccia
+ m_Generate_IsEnabled = False
+ End If
+ ' resetto stato
+ ResetStatus()
+ ' aggiorno valori interfaccia
+ NotifyPropertyChanged("Generate_IsEnabled")
+ NotifyPropertyChanged("DDFPath")
+ NotifyPropertyChanged("DoorType")
+ NotifyPropertyChanged("Width")
+ NotifyPropertyChanged("Height")
+ NotifyPropertyChanged("Thickness")
+ End Sub
+
+ Private Function CheckDoorDimension(sFileLine As String, sKey As String, ByRef sDimension As String) As Boolean
+ If sFileLine.Contains(sKey) Then
+ CleanValueString(sFileLine, sKey, sDimension)
+ Return True
+ Else
+ Map.refStatusBarVM.SetOutputMessage("Impossible to read this DDF file", MSG_TYPE.ERROR_)
+ Return False
+ End If
+ End Function
+
+ Private Sub CleanValueString(sFileLine As String, sKey As String, ByRef sResult As String)
+ Dim sTemp As String = sFileLine
+ sTemp = sTemp.Replace(sKey, "")
+ sTemp = sTemp.Trim()
+ sResult = sTemp
+ End Sub
+
+#End Region ' OpenDDF
+
+#Region "Generate"
+
+ ' Returns a command that manage the MainWindow_Unloaded command
+ Public ReadOnly Property Generate_Command() As ICommand
+ Get
+ If m_cmdGenerate Is Nothing Then
+ m_cmdGenerate = New Command(AddressOf Generate)
+ End If
+ Return m_cmdGenerate
+ End Get
+ End Property
+
+ ' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
+ Public Sub Generate(ByVal param As Object)
+ ' se nessuna proprietà impostata do errore ed esco
+ If m_DoorProperty = Properties.NULL Then
+ Map.refStatusBarVM.SetOutputMessage("Error, proprerty not readed!", MSG_TYPE.ERROR_)
+ Return
+ End If
+ ' disabilito bottone apri DDF
+ EnableDDFButton(False)
+ ' cancello file txt e cnc del ddf
+ Try
+ File.Delete(Path.ChangeExtension(m_DDFPath, ".txt"))
+ File.Delete(Path.ChangeExtension(m_DDFPath, ".cnc"))
+ Catch ex As Exception
+
+ End Try
+ ' Inizio generazione primo PartProgram per entrambe le modalità
+ Dim bIsSkinned As Boolean = m_DoorProperty = Properties.SKINNED
+ Dim sProgramMsg As String = If(bIsSkinned, "Probing Part Program", "Part Program")
+ Dim GenFileExtension As String = If(bIsSkinned, ".prb", ".cnc")
+ Dim GenFilePath As String = Path.ChangeExtension(m_DDFPath, GenFileExtension)
+ SetStatus("Generating the " & sProgramMsg)
+ ' Lancio il programma in cieco per generazione normale
+ Try
+ Dim CommandLine As String = """" & m_DDFPath & """ " & If(bIsSkinned, "3", "2")
+ Process.Start(m_EgtCAM5Path, CommandLine)
+ Dim bTxtOk As Boolean = False
+ For I = 0 To 150
+ ' aspetto che venga generato il txt del ddf
+ If Not bTxtOk AndAlso File.Exists(Path.ChangeExtension(m_DDFPath, ".txt")) Then
+ bTxtOk = True
+ ' pausa necessaria, altrimenti copia un file vuoto!
+ System.Threading.Thread.Sleep(1000)
+ End If
+ If bTxtOk AndAlso File.Exists(GenFilePath) Then
+ SetStatus(sProgramMsg & " correctly generated")
+ Exit Try
+ End If
+ ' Aspetto e costringo ad aggiornare UI
+ System.Threading.Thread.Sleep(100)
+ UpdateUI()
+ Next
+ SetStatus("Error in " & sProgramMsg & " generation!")
+ EnableDDFButton(True)
+ Return
+ Catch ex As Exception
+ SetStatus("Error in " & sProgramMsg & " generation!")
+ EnableDDFButton(True)
+ Return
+ End Try
+ SetStatus("Copying the " & sProgramMsg & " to the CNC")
+ ' copio il programma sul CN
+ Try
+ Dim NcFilePath As String = m_CncFilePath & "\" &
+ m_PartProgFileName &
+ GenFileExtension
+ File.Delete(NcFilePath)
+ File.Copy(Path.ChangeExtension(m_DDFPath, GenFileExtension), NcFilePath)
+ SetStatus(sProgramMsg & " copied to the CNC, activate it and start the machine")
+ Catch ex As Exception
+ SetStatus("Error in copying the " & sProgramMsg & " to the CNC")
+ EnableDDFButton(True)
+ Return
+ End Try
+ ' se skinned
+ If m_DoorProperty = Properties.SKINNED Then
+ ' cancello file di fine tastatura precedente
+ Dim EndProbeFilePath As String = m_DataFilePath & m_CheckFileName
+ Try
+ File.Delete(EndProbeFilePath)
+ Catch ex As Exception
+ SetStatus("Error in deleting the probe end file on the CNC" &
+ Environment.NewLine & "Please, delete it manually")
+ End Try
+ ' avvio timer d'attesa
+ m_Timer.Start()
+ m_Timer_Time = 0
+ m_Timer_IsEnabled = True
+ NotifyPropertyChanged("Progress_Value")
+ NotifyPropertyChanged("Timer_IsEnabled")
+ Else
+ EnableDDFButton(True)
+ End If
+ End Sub
+
+ Private Sub EnableDDFButton(value As Boolean)
+ ' abilito bottone apri DDF
+ m_OpenDDF_IsEnabled = value
+ NotifyPropertyChanged("OpenDDF_IsEnabled")
+ End Sub
+
+#End Region ' Generate
+
+#Region "Cancel"
+
+ ' Returns a command that manage the MainWindow_Unloaded command
+ Public ReadOnly Property Cancel_Command() As ICommand
+ Get
+ If m_cmdCancel Is Nothing Then
+ m_cmdCancel = New Command(AddressOf Cancel)
+ End If
+ Return m_cmdCancel
+ End Get
+ End Property
+
+ ' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
+ Public Sub Cancel(ByVal param As Object)
+ ' se timer non attivo esco
+ If Not m_Timer.IsEnabled Then Return
+ ' ferma il timer di attesa
+ m_Timer.Stop()
+ m_Timer_Time = 0
+ m_Timer_IsEnabled = False
+ NotifyPropertyChanged("Progress_Value")
+ NotifyPropertyChanged("Timer_IsEnabled")
+ SetStatus("Probing waiting cycle manually interrupted")
+ ' abilito bottone apri DDF
+ m_OpenDDF_IsEnabled = True
+ NotifyPropertyChanged("OpenDDF_IsEnabled")
+ End Sub
+
+#End Region ' Cancel
+
+#End Region ' COMMANDS
+
+End Class
diff --git a/Resources/EgtDOORProbe.ico b/Resources/EgtDOORProbe.ico
new file mode 100644
index 0000000..3eec029
Binary files /dev/null and b/Resources/EgtDOORProbe.ico differ
diff --git a/StatusBar/StatusBarV.xaml b/StatusBar/StatusBarV.xaml
new file mode 100644
index 0000000..551b85b
--- /dev/null
+++ b/StatusBar/StatusBarV.xaml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/StatusBar/StatusBarV.xaml.vb b/StatusBar/StatusBarV.xaml.vb
new file mode 100644
index 0000000..384a5ee
--- /dev/null
+++ b/StatusBar/StatusBarV.xaml.vb
@@ -0,0 +1,3 @@
+Public Class StatusBarV
+
+End Class
diff --git a/Utility/Dictionary.xaml b/Utility/Dictionary.xaml
new file mode 100644
index 0000000..dbe244f
--- /dev/null
+++ b/Utility/Dictionary.xaml
@@ -0,0 +1,513 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ None
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Utility/Map.vb b/Utility/Map.vb
new file mode 100644
index 0000000..3ed1470
--- /dev/null
+++ b/Utility/Map.vb
@@ -0,0 +1,59 @@
+Imports EgtWPFLib5
+
+Module Map
+
+ Private m_refMainWindowVM As MainWindowVM
+ Private m_refProbingPanelVM As ProbingPanelVM
+
+#Region "Get"
+
+ Public ReadOnly Property refMainWindowVM As MainWindowVM
+ Get
+ Return m_refMainWindowVM
+ End Get
+ End Property
+
+ Public ReadOnly Property refStatusBarVM As StatusBarVM
+ Get
+ Return LibMap.refStatusBarVM
+ End Get
+ End Property
+
+ Public ReadOnly Property refProbingPanelVM As ProbingPanelVM
+ Get
+ Return m_refProbingPanelVM
+ 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 SetRefProbingPanelVM(ProbingPanelVM As ProbingPanelVM) As Boolean
+ m_refProbingPanelVM = ProbingPanelVM
+ Return Not IsNothing(m_refProbingPanelVM)
+ 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(LibMap.refStatusBarVM) AndAlso
+ Not IsNothing(m_refProbingPanelVM) AndAlso LibMap.EndInit()
+ End Function
+
+#End Region ' Init
+
+End Module