EgtDOORCreator 2.2k1:

-> aggiunto bottone per aprire la porta corrente con il programma Cam5.
This commit is contained in:
Nicola Pievani
2020-11-17 17:57:32 +00:00
parent ed24c7fe25
commit a2aaa829fc
8 changed files with 146 additions and 4 deletions
+1
View File
@@ -39,6 +39,7 @@ Module ConstIni
Public Const K_HARDWAREDIMENSION As String = "HardwareDimensions"
Public Const K_INVERTBEVEL As String = "DisableInvertBevel"
Public Const K_ASKMEAGAINCONFIRM As String = "AskMeAgainConfirm"
Public Const K_EGTCAMEXE As String = "EgtCam5Exe"
Public Const S_LANGUAGES As String = "Languages"
Public Const K_LANGUAGE As String = "Language"
+1
View File
@@ -448,6 +448,7 @@
<AppDesigner Include="My Project\" />
<Resource Include="Resources\InstrumentPanel\LinearDimension.png" />
<Resource Include="Resources\TopCommandBar\DeleteDir.png" />
<Resource Include="Resources\EgtCAM5.png" />
<Content Include="Resources\TopCommandBar\SaveAsTemplate1.png" />
</ItemGroup>
<ItemGroup>
+2
View File
@@ -55,6 +55,8 @@ Friend Module IniFile
Friend m_sListLabelDir As String = String.Empty
' Path del modello ListLabel
Friend m_sListLabelCurrent As String = String.Empty
' Path dell'eseguibile Cam5
Friend m_sEgtCameEXEPath As String = String.Empty
' EgtDoorCreator.ini
Public Function GetPrivateProfileLanguage(ByVal lpAppName As String, ByVal lpKeyName As String) As Language
+2 -2
View File
@@ -72,5 +72,5 @@ Imports System.Windows
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.2.10.1")>
<Assembly: AssemblyFileVersion("2.2.10.1")>
<Assembly: AssemblyVersion("2.2.11.1")>
<Assembly: AssemblyFileVersion("2.2.11.1")>
+5
View File
@@ -274,6 +274,11 @@ Friend Module OptionModule
EgtOutLog(String.Format(EgtMsg(50180), sListLabelFile & " (File Report)"))
End If
Dim sEgtCam5EXE As String = String.Empty
If GetMainPrivateProfileString(S_GENERAL, K_EGTCAMEXE, "", sEgtCam5EXE) > 0 AndAlso File.Exists(sListLabelFile) Then
IniFile.m_sEgtCameEXEPath = sEgtCam5EXE
End If
Dim nHelpSelct As Integer = 0
Select Case GetMainPrivateProfileInt(S_GENERAL, K_SMARTHELP, 1)
Case 0
+7 -2
View File
@@ -55,8 +55,13 @@
<Image Source="/Resources/TopCommandBar/Export.png" Stretch="Uniform" />
</ContentControl>
</Button>
<Button Command="{Binding PrintCommand}" ToolTip="{Binding PrintToolTip}" Focusable="False">
<Button Command="{Binding OpenCamCommand}" ToolTip="{Binding OpenCamToolTip}" Focusable="False"
Visibility="{Binding VisibilityEgtCAM}">
<ContentControl>
<Image Source="/Resources/EgtCAM5.png" Stretch="Uniform" />
</ContentControl>
</Button>
<Button Command="{Binding PrintCommand}" ToolTip="{Binding PrintToolTip}" Focusable="False">
<ContentControl>
<Image Source="/Resources/InstrumentPanel/Print.png" Stretch="Uniform" />
</ContentControl>
+128
View File
@@ -65,6 +65,20 @@ Public Class ProjectManagerVM
End Get
End Property
Public ReadOnly Property VisibilityEgtCAM As Visibility
Get
If String.IsNullOrEmpty(IniFile.m_sEgtCameEXEPath) Then
Return Visibility.Collapsed
ElseIf Not File.Exists(IniFile.m_sEgtCameEXEPath) Then
Return Visibility.Collapsed
ElseIf File.Exists(IniFile.m_sEgtCameEXEPath) Then
Return Visibility.Visible
Else
Return Visibility.Collapsed
End If
End Get
End Property
Private m_IsModifiedImage As String = "/Resources/TopCommandBar/Save.png"
Public Property IsModifiedImage As String
Get
@@ -130,6 +144,7 @@ Public Class ProjectManagerVM
Private m_cmdHardware As ICommand
Private m_cmdRefreshDir As ICommand
Private m_cmdCreateAssembly As ICommand
Private m_CmdOpenCam As ICommand
#Region "ToolTip"
@@ -211,6 +226,12 @@ Public Class ProjectManagerVM
End Get
End Property
Public ReadOnly Property OpenCamToolTip As String
Get
Return "EgtCam5"
End Get
End Property
Public ReadOnly Property DuplicaToolTip As String
Get
' Save As
@@ -1271,6 +1292,59 @@ Public Class ProjectManagerVM
#End Region ' Copy
#Region "OpenCam5"
Public ReadOnly Property OpenCamCommand As ICommand
Get
If m_CmdOpenCam Is Nothing Then
m_CmdOpenCam = New Command(AddressOf OpenCam)
End If
Return m_CmdOpenCam
End Get
End Property
Public Sub OpenCam()
If IsNothing(Map.refAssemblyManagerVM.CurrProject) OrElse
IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) Then
' 50192 = Impossible to export to machine a door if there is not a door!
MessageBox.Show(EgtMsg(50192), EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning)
Return
End If
'Verifico che tutto sia salvato, altrimenti esco con messaggio
If Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified() Then
' Project must be saved before copying
MessageBox.Show(EgtMsg(50186), EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning)
Return
End If
' Dim CurrFile As String = IniFile.m_sTempDir & "\CurrPart" & DDF_EXTENSION
Dim CurrFile As String = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name
Try
Dim Proc As New Process
Proc.StartInfo.FileName = IniFile.m_sEgtCameEXEPath
' 0: creata una porta come descritta nel file riferito
' 1 viene creata la porta e il suo programma di lavorazione sul centro di lavoro preconfigurato
Proc.StartInfo.Arguments = """" & CurrFile & """ " & If((Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift, """1""", """0""")
If Not Proc.Start() Then
' Error in starting EgtCam5.exe
MessageBox.Show(EgtMsg(50567), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
End If
Catch ex As Exception
' Error in starting EgtCam5.exe
MessageBox.Show(EgtMsg(50567), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
End Try
Dim sError As String = String.Empty
Dim nType As Integer = 0
ShowGraphicError(sError, nType)
If Not String.IsNullOrEmpty(sError) And nType > 0 Then
MessageBox.Show(sError, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
ElseIf Not String.IsNullOrEmpty(sError) And nType < 0 Then
MessageBox.Show(sError, EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning)
End If
End Sub
#End Region ' Copy
#Region "Duplica"
Public ReadOnly Property DuplicaCommand As ICommand
@@ -1574,6 +1648,60 @@ Public Class ProjectManagerVM
#End Region ' CreateAssemblyCommand
#Region "METHODS"
#End Region ' Methos
'questo metodo restituisce l'errore letto nel file CurrDoor.txt
Public Sub ShowGraphicError(ByRef ErrorMessages As String, ByRef Type As Integer)
' se non c'è nessuna porta aperta allora esco
If IsNothing(Map.refAssemblyManagerVM.CurrProject) OrElse
IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) Then
Return
End If
Dim FileLog As String = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name
FileLog = FileLog.Replace(DDF_EXTENSION, ".txt")
Dim FileContent() As String
' controllo se esite il file CurrDoor.txt
If Not File.Exists(FileLog) Then Return
FileContent = File.ReadAllLines(FileLog)
' se il file esiste ma è vuoto
If FileContent.Count = 0 Then
MessageBox.Show(EgtMsg(50107), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
End If
Dim IndexLine As Integer = 0
Dim nMsgErr As Integer = 0
' leggo il valore numerico (se il valore non è numerico è passato di default il valore 0)
nMsgErr = RegexFunction.ErrDraw(FileContent(IndexLine))
Type = nMsgErr
' passo alla riga succesiva
IndexLine += 1
' se il valore è maggiore di zero allora è un errore
If nMsgErr > 0 Then
' salto tutte le righe vuote
While String.IsNullOrEmpty(FileContent(IndexLine)) AndAlso IndexLine < FileContent.Count
IndexLine += 1
End While
ErrorMessages = FileContent(IndexLine)
IndexLine += 1
While IndexLine < FileContent.Count
ErrorMessages &= vbNewLine & FileContent(IndexLine)
IndexLine += 1
End While
' altrimenti un avvertimento
ElseIf nMsgErr < 0 Then
While String.IsNullOrEmpty(FileContent(IndexLine)) AndAlso IndexLine < FileContent.Count
IndexLine += 1
End While
ErrorMessages = FileContent(IndexLine)
IndexLine += 1
While IndexLine < FileContent.Count
ErrorMessages &= vbNewLine & FileContent(IndexLine)
IndexLine += 1
End While
Else
ErrorMessages = String.Empty
End If
End Sub
#End Region ' Commands
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB