EgtCAM5 :
- sistemazioni varie per feedback via mail.
This commit is contained in:
@@ -85,6 +85,11 @@ Namespace EgtCAM5
|
||||
Return EgtMsg(MSG_TOPCOMMANDBAR + 9)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property SendFeedbackToolTip As String
|
||||
Get
|
||||
Return EgtMsg(MSG_TOPCOMMANDBAR + 13)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region ' ToolTip
|
||||
|
||||
@@ -374,7 +379,7 @@ Namespace EgtCAM5
|
||||
#Region "SendFeedbackCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Export.
|
||||
''' Returns a command that do SendFeedback.
|
||||
''' </summary>
|
||||
Public ReadOnly Property SendFeedbackCommand As ICommand
|
||||
Get
|
||||
@@ -386,28 +391,30 @@ Namespace EgtCAM5
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Export. This method is invoked by the ExportCommand.
|
||||
''' Execute the SendFeedback. This method is invoked by the SendFeedbackCommand.
|
||||
''' </summary>
|
||||
Public Sub SendFeedback(ByVal param As Object)
|
||||
' recupero indirizzo supporto
|
||||
' Recupero indirizzo a cui spedire la mail
|
||||
Dim sSupportAddress As String = String.Empty
|
||||
GetPrivateProfileString(S_GENERAL, K_SUPPORT, "", sSupportAddress)
|
||||
GetPrivateProfileString(S_GENERAL, K_SUPPORT, "support@egaltech.com", sSupportAddress)
|
||||
' se vuoto do messaggio di errore ed esco
|
||||
If String.IsNullOrWhiteSpace(sSupportAddress) Then
|
||||
MessageBox.Show(EgtMsg(MSG_TOPCOMMANDBAR + 10), EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK, MessageBoxImage.Error)
|
||||
Return
|
||||
End If
|
||||
' recupero numero chiave
|
||||
' Recupero numero chiave
|
||||
Dim sKey As String = String.Empty
|
||||
EgtGetKeyInfo(sKey)
|
||||
' recupero file del progetto corrente
|
||||
' Recupero file del progetto corrente
|
||||
Dim sCurrProject As String = String.Empty
|
||||
EgtGetCurrFilePath(sCurrProject)
|
||||
' se nome file vuoto, chiedo se si vuole salvare
|
||||
If String.IsNullOrWhiteSpace(sCurrProject) Then
|
||||
If MessageBox.Show(EgtMsg(MSG_TOPCOMMANDBAR + 11), "", MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes Then
|
||||
Application.Msn.NotifyColleagues(Application.SAVEPROJECT)
|
||||
End If
|
||||
EgtGetCurrFilePath(sCurrProject)
|
||||
' se modificato, chiedo se si vuole salvare
|
||||
Else
|
||||
If EgtGetModified() Then
|
||||
If MessageBox.Show(EgtMsg(MSG_TOPCOMMANDBAR + 11), "", MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes Then
|
||||
@@ -415,43 +422,66 @@ Namespace EgtCAM5
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Dim DoorOtherFiles As New List(Of String)
|
||||
' se door attivo
|
||||
If IniFile.IsActiveDoors Then
|
||||
' recupero file con lo stesso nome del progetto
|
||||
If Not String.IsNullOrWhiteSpace(sCurrProject) Then
|
||||
Dim sCurrProjectDir As String = Path.GetDirectoryName(sCurrProject)
|
||||
If Not String.IsNullOrWhiteSpace(sCurrProjectDir) Then
|
||||
Dim TempFiles() As String = Directory.GetFiles(sCurrProjectDir)
|
||||
For FileIndex = 0 To TempFiles.Count - 1
|
||||
If Path.GetFileNameWithoutExtension(TempFiles(FileIndex)).Contains(Path.GetFileNameWithoutExtension(sCurrProject)) AndAlso TempFiles(FileIndex) <> sCurrProject Then
|
||||
DoorOtherFiles.Add(TempFiles(FileIndex))
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
' Verifico se il progetto corrente è una porta
|
||||
Dim nPartId As Integer = EgtGetFirstPart()
|
||||
If nPartId = GDB_ID.NULL Then
|
||||
nPartId = EgtGetFirstPartInRawPart(EgtGetFirstRawPart())
|
||||
End If
|
||||
Dim sPartName As String = String.Empty
|
||||
EgtGetName(nPartId, sPartName)
|
||||
Dim bPrjIsDoor As Boolean = (String.Compare(sPartName, "DOOR") = 0)
|
||||
' Recupero macchine dei gruppi di lavoro del progetto
|
||||
Dim Machines As New List(Of String)
|
||||
Dim nMchGrpId As Integer = EgtGetFirstMachGroup()
|
||||
While nMchGrpId <> GDB_ID.NULL
|
||||
Dim sMachineName As String = String.Empty
|
||||
EgtGetMachGroupMachineName(nMchGrpId, sMachineName)
|
||||
If Not String.IsNullOrWhiteSpace(sMachineName) Then
|
||||
Machines.Add(sMachineName)
|
||||
End If
|
||||
nMchGrpId = EgtGetNextMachGroup(nMchGrpId)
|
||||
End While
|
||||
' Recupero altri file con lo stesso nome del progetto
|
||||
Dim OtherFiles As New List(Of String)
|
||||
If Not String.IsNullOrWhiteSpace(sCurrProject) Then
|
||||
Dim sCurrProjectDir As String = Path.GetDirectoryName(sCurrProject)
|
||||
If Not String.IsNullOrWhiteSpace(sCurrProjectDir) Then
|
||||
Dim TempFiles() As String = Directory.GetFiles(sCurrProjectDir)
|
||||
For FileIndex = 0 To TempFiles.Count - 1
|
||||
If Path.GetFileNameWithoutExtension(TempFiles(FileIndex)).Contains(Path.GetFileNameWithoutExtension(sCurrProject)) AndAlso TempFiles(FileIndex) <> sCurrProject Then
|
||||
OtherFiles.Add(TempFiles(FileIndex))
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
' creo zip file da allegare
|
||||
' Creo zip file da allegare
|
||||
Dim sZipToCreate As String = IniFile.m_sTempDir & "\Feedback.zip"
|
||||
If File.Exists(sZipToCreate) Then
|
||||
File.Delete(sZipToCreate)
|
||||
End If
|
||||
Try
|
||||
Using zip As New Ionic.Zip.ZipFile(sZipToCreate, Console.Out)
|
||||
' aggiungo file macchina
|
||||
zip.AddItem(IniFile.m_sMachinesRoot & "\" & IniFile.m_sMachineName, IniFile.m_sMachineName)
|
||||
' aggiungo file macchine
|
||||
For Each sMachineName As String In Machines
|
||||
Dim sMachineDir As String = IniFile.m_sMachinesRoot & "\" & sMachineName
|
||||
If Directory.Exists(sMachineDir) Then
|
||||
zip.AddItem(sMachineDir, sMachineName)
|
||||
End If
|
||||
Next
|
||||
' aggiungo progetto corrente
|
||||
If Not String.IsNullOrWhiteSpace(sCurrProject) Then
|
||||
zip.AddItem(sCurrProject, "")
|
||||
End If
|
||||
' se door attivo
|
||||
If IniFile.IsActiveDoors Then
|
||||
' aggiungo file log
|
||||
zip.AddItem(IniFile.m_sLogFile, "")
|
||||
' aggiungo file ausiliari
|
||||
For Each sOther As String In OtherFiles
|
||||
zip.AddItem(sOther, "")
|
||||
Next
|
||||
' se door attivo, progetto corrente è una porta e definito direttorio base di Doors
|
||||
If IniFile.IsActiveDoors And bPrjIsDoor And Directory.Exists(IniFile.m_sDoorsDirPath) Then
|
||||
' aggiungo Doors completo
|
||||
zip.AddItem(IniFile.m_sDoorsDirPath, "Doors")
|
||||
If DoorOtherFiles.Count > 0 Then
|
||||
For FileIndex = 0 To DoorOtherFiles.Count - 1
|
||||
zip.AddItem(DoorOtherFiles(FileIndex), "")
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
' salvo lo zip
|
||||
zip.Save()
|
||||
|
||||
Reference in New Issue
Block a user