Imports System.Collections.ObjectModel
Imports System.IO
Imports System.Runtime.InteropServices
Imports EgtBEAMWALL.Core
Imports EgtBEAMWALL.Core.ConstBeam
Imports EgtBEAMWALL.DataLayer.DatabaseModels
Imports EgtUILib
Imports EgtWPFLib5
Public Class MainMenuVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
Private m_MainMenu_IsEnabled As Boolean = True
Public ReadOnly Property MainMenu_IsEnabled As Boolean
Get
Return m_MainMenu_IsEnabled
End Get
End Property
Private m_SendFeedbackIsEnabled As Boolean = True
Public ReadOnly Property SendFeedbackIsEnabled As Boolean
Get
Return m_SelPage = Pages.VIEW Or m_SelPage = Pages.MACHINING
End Get
End Property
Public Property View_IsChecked As Boolean
Get
Return m_SelPage = Pages.VIEW
End Get
Set(value As Boolean)
If value Then SelPage = Pages.VIEW
End Set
End Property
Public Property Machining_IsChecked As Boolean
Get
Return m_SelPage = Pages.MACHINING
End Get
Set(value As Boolean)
If value Then SelPage = Pages.MACHINING
End Set
End Property
Public Property Supervisor_IsChecked As Boolean
Get
Return m_SelPage = Pages.SUPERVISOR
End Get
Set(value As Boolean)
If value Then SelPage = Pages.SUPERVISOR
End Set
End Property
Public Property Config_IsChecked As Boolean
Get
Return m_SelPage = Pages.CONFIG
End Get
Set(value As Boolean)
If value Then SelPage = Pages.CONFIG
End Set
End Property
Private m_SelPage As Integer = -1
Public Property SelPage As Integer
Get
Return m_SelPage
End Get
Set(value As Integer)
' lancio selezione pagina con verifica file modificato
SetSelPage(value)
End Set
End Property
' funzione che permette di cambiare pagina
' bVerifyModification: se vero verifica modifiche su file e chiede di salvare
Friend Sub SetSelPage(Page As Pages, Optional bVerifyModification As Boolean = True)
Dim bOk As Boolean = True
' Esco dallo stato corrente
Select Case m_SelPage
Case Pages.VIEW
bOk = ExitVIEW(bVerifyModification)
Case Pages.MACHINING
bOk = ExitMACHINING(bVerifyModification)
Case Pages.CONFIG
bOk = ExitCONFIG()
End Select
If bOk Then
' Entro nel nuovo stato
m_SelPage = Page
Select Case m_SelPage
Case Pages.VIEW
' Map.refMachGroupPanelVM.SetMachGroupState(False)
InitVIEW()
'Map.refTopCommandBarVM.IsEnabled = False
Case Pages.MACHINING
' Map.refMachGroupPanelVM.SetMachGroupState(True)
InitMACHINING()
'Map.refTopCommandBarVM.IsEnabled = True
Case Pages.CONFIG
InitCONFIG()
'Map.refMachGroupPanelVM.SetMachGroupState(False)
'Map.refCONFIGTabVM.InitCONFIGation()
'Map.refTopCommandBarVM.IsEnabled = False
End Select
End If
' aggiorno visualizzazione RadioButton
NotifyPropertyChanged("View_IsChecked")
NotifyPropertyChanged("Machining_IsChecked")
NotifyPropertyChanged("Supervisor_IsChecked")
NotifyPropertyChanged("Config_IsChecked")
Map.refProjectVM.NotifyPropertyChanged("SelItem")
End Sub
#Region "Messages"
Public ReadOnly Property Viewer_Msg As String
Get
Return EgtMsg(61830)
End Get
End Property
Public ReadOnly Property Optimizer_Msg As String
Get
Return EgtMsg(61831)
End Get
End Property
Public ReadOnly Property Configuration_Msg As String
Get
Return EgtMsg(61832)
End Get
End Property
Public ReadOnly Property Supervisor_Msg As String
Get
Return EgtMsg(62500)
End Get
End Property
#Region "ToolTip"
'Proprietà ToolTip
Public ReadOnly Property SendFeedbackToolTip As String
Get
Return EgtMsg(MSG_TOPCOMMANDBAR + 13)
End Get
End Property
#End Region ' ToolTip
#End Region ' Messages
' Definizione comandi
Private m_cmdSupervisor As ICommand
Private m_cmdSendFeedback As ICommand
#End Region ' Fields & Properties
#Region "CONSTRUCTOR"
Sub New()
' Creo riferimento a questa classe in EgtCAM5Map
Map.SetRefMainMenuVM(Me)
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Friend Sub SetMainMenuIsEnabled(bIsEnabled As Boolean)
m_MainMenu_IsEnabled = bIsEnabled
NotifyPropertyChanged(NameOf(MainMenu_IsEnabled))
End Sub
Private Function InitVIEW() As Boolean
Map.refProjectVM.SetBottomPanel_Visibility(True)
Map.refProjectVM.SetLeftPanel_Visibility(True)
Map.refLeftPanelVM.UpdateView()
Map.refProjectVM.SetPartManager_Visibility(False)
Map.refProjectVM.SetFeatureManager_Visibility(True)
Map.refProjectVM.SetTopPanel_Visibility(False)
Map.refProjectVM.SetShowBeamPanel_Visibility(True)
Map.refProjectVM.SetProjManager_Visibility(True)
Map.refProjectVM.SetProdManager_Visibility(False)
Map.refProjectVM.SetOptimizePanel_Visibility(Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL AndAlso Map.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.NESTING_AUTO))
Map.refProjectVM.NotifyAllPanelVisibility()
Map.refCALCPanelVM.SetChooseMachineBtn_Visibility(True)
If Not IsNothing(Map.refFeatureListVM.colFeature_Do) Then
Map.refFeatureListVM.colFeature_Do.ColumnVisibility = Visibility.Visible
End If
' imposto dimensioni colonne/righe della Grid
DimensionsIniFile.ReadGridDimensions(ConstDims.PROJECT_VIEW, Map.refProjectVM.GridDims)
DimensionsIniFile.ReadGridDimensions(ConstDims.LEFTPANEL_VIEW, Map.refLeftPanelVM.GridDims)
' apro progetto proj
If Not IsNothing(Map.refProjManagerVM.CurrProj) Then
If Map.refProjManagerVM.CurrProj.bReloadProject Then
Map.refProjManagerVM.OpenProject(Map.refProjManagerVM.CurrProj)
' aggiorno le colonne in base al tipo progetto
If Not IsNothing(Map.refProjectVM.BTLStructureVM) Then
Map.refRawPartListVM.UpdateColumns(Map.refProjectVM.BTLStructureVM.nPROJTYPE)
Map.refPartInRawPartListVM.UpdateColumns(Map.refProjectVM.BTLStructureVM.nPROJTYPE)
Else
Map.refRawPartListVM.UpdateColumns(BWType.BEAM)
Map.refPartInRawPartListVM.UpdateColumns(BWType.BEAM)
End If
DbControllers.m_ProjController.LockByProjId(Map.refProjManagerVM.CurrProj.nProjId, True)
Map.refProjManagerVM.NotifyPropertyChanged(NameOf(Map.refProjManagerVM.MruFileNames))
Else
' verifico se il prod di provenienza ha piu' proj
If Not IsNothing(Map.refProdManagerVM.CurrProd) AndAlso Map.refProdManagerVM.CurrProd.nProjIdList.Count > 1 Then
' se si rigenero BTLStructure
Map.refProjectVM.BTLStructureVM = New BTLStructureVM(BTLStructureM.CreateBTLStructure(Map.refProjManagerVM.CurrProj.nProjId))
End If
' mostro tutti i pezzi
Map.refShowBeamPanelVM.ShowAll()
Map.refProjManagerVM.CurrProj.SetReloadProject(True)
End If
' aggiorno titolo
Map.refMainWindowVM.UpdateTitle()
DbControllers.m_ProjController.LockByProjId(Map.refProjManagerVM.CurrProj.nProjId, True)
Else
Map.refSceneHostVM.MainController.NewProject()
Map.refProjectVM.BTLStructureVM = Nothing
Map.refProjectVM.MachGroupPanelVM = Nothing
End If
Map.refMainWindowVM.NotifyPropertyChanged(NameOf(Map.refMainWindowVM.nSelTabPage))
Map.refMainMenuVM.NotifyPropertyChanged(NameOf(Map.refMainMenuVM.SendFeedbackIsEnabled))
Map.refInstrumentPanelVM.NotifyPropertyChanged(NameOf(Map.refInstrumentPanelVM.ChangeParam_Visibility))
Return True
End Function
Private Function ExitVIEW(bVerifyModification As Boolean) As Boolean
' verifico se progetto modificato, e chiedo se salvare
If bVerifyModification Then
If Not ProjFileVM.VerifyProjectModification(Map.refProjManagerVM.CurrProj, ProjectType.PROJ) Then
Return False
End If
End If
' resetto eventuale visualizzazione statistiche
Map.refInstrumentPanelVM.ResetStatisticsIsChecked()
Map.refProjectVM.SetBottomPanel_Visibility(False)
Map.refProjectVM.SetLeftPanel_Visibility(True)
Map.refProjectVM.SetPartManager_Visibility(False)
Map.refProjectVM.SetFeatureManager_Visibility(False)
Map.refProjectVM.SetTopPanel_Visibility(True)
Map.refProjectVM.SetShowBeamPanel_Visibility(False)
Map.refProjectVM.SetProjManager_Visibility(False)
Map.refProjectVM.SetProdManager_Visibility(True)
Map.refProjectVM.SetOptimizePanel_Visibility(True)
Map.refCALCPanelVM.SetChooseMachine_Visibility(False)
If Not IsNothing(Map.refFeatureListVM.colFeature_Do) Then
Map.refFeatureListVM.colFeature_Do.ColumnVisibility = Visibility.Collapsed
End If
Return True
End Function
Private Function InitMACHINING() As Boolean
Map.refProjectVM.SetBottomPanel_Visibility(False)
Map.refProjectVM.SetLeftPanel_Visibility(True)
Map.refLeftPanelVM.UpdateView()
Map.refProjectVM.SetPartManager_Visibility(False)
Map.refProjectVM.SetFeatureManager_Visibility(False)
Map.refProjectVM.SetTopPanel_Visibility(True)
Map.refProjectVM.SetShowBeamPanel_Visibility(False)
Map.refProjectVM.SetProjManager_Visibility(False)
Map.refProjectVM.SetProdManager_Visibility(True)
Map.refProjectVM.SetOptimizePanel_Visibility(True)
Map.refProjectVM.NotifyAllPanelVisibility()
Map.refCALCPanelVM.SetChooseMachineBtn_Visibility(False)
Map.refTopPanelVM.UpdateQParameterVisibility()
' imposto dimensioni colonne/righe della Grid
DimensionsIniFile.ReadGridDimensions(ConstDims.PROJECT_OPTIMIZER, Map.refProjectVM.GridDims)
DimensionsIniFile.ReadGridDimensions(ConstDims.LEFTPANEL_OPTIMIZER, Map.refLeftPanelVM.GridDims)
' inizializzo gruppi di lavorazione
If Not IsNothing(Map.refProdManagerVM.CurrProd) AndAlso Not IsNothing(Map.refProdManagerVM.CurrProd.nProdId) AndAlso Map.refProdManagerVM.CurrProd.nProdId > 0 Then
If File.Exists(Map.refProdManagerVM.CurrProd.sProdPath) Then
' apro progetto
If Map.refProdManagerVM.CurrProd.bReloadProject Then
If Map.refSceneHostVM.MainController.OpenProject(Map.refProdManagerVM.CurrProd.sProdPath, False) Then
' aggiorno le colonne in base al tipo progetto
Map.refRawPartListVM.UpdateColumns(Map.refProjectVM.BTLStructureVM.nPROJTYPE)
Map.refPartInRawPartListVM.UpdateColumns(Map.refProjectVM.BTLStructureVM.nPROJTYPE)
DbControllers.m_ProdController.LockByProdId(Map.refProdManagerVM.CurrProd.nProdId, True)
' aggiorno titolo
Map.refMainWindowVM.UpdateTitle()
Map.refProdManagerVM.NotifyPropertyChanged(NameOf(Map.refProdManagerVM.MruFileNames))
End If
Else
' mostro tutti i pezzi
Map.refShowBeamPanelVM.ShowAll(False)
' verifico se il prod ha piu' proj
If Map.refProdManagerVM.CurrProd.nProjIdList.Count > 1 Then
' se si rigenero BTLStructure
Map.refProjectVM.BTLStructureVM = New BTLStructureVM(BTLStructureM.CreateBTLStructure(0))
End If
' recupero indice di modifica progetto
Dim CommIndex As Integer = -1
Dim ActiveSessionList As List(Of StatusMapModel) = DbControllers.m_StatusMapController.GetProd()
For Each ActiveSession In ActiveSessionList
If ActiveSession.ItemId = Map.refProdManagerVM.CurrProd.nProdId Then
CommIndex = ActiveSession.Index
End If
Next
' carico lista dei MachGroup
Map.refProjectVM.MachGroupPanelVM = New MyMachGroupPanelVM(MyMachGroupPanelM.CreateMyMachGroupPanel(Map.refMachinePanelVM.MachineList.ToList()))
' fisso indice sessione di comunicazione
If CommIndex > -1 Then
Map.refProdManagerVM.CurrProd.SetModificationIndex(CommIndex)
End If
Map.refProjManagerVM.CurrProj.SetReloadProject(True)
End If
'DbControllers.m_ProdController.ResetController()
DbControllers.m_ProdController.LockByProdId(Map.refProdManagerVM.CurrProd.nProdId, True)
' seleziono prima barra
Map.refProjectVM.MachGroupPanelVM.SelFirstMachGroup()
Else
MessageBox.Show(EgtMsg(61871))
End If
Else
Map.refSceneHostVM.MainController.NewProject()
Map.refProjectVM.BTLStructureVM = Nothing
Map.refProjectVM.MachGroupPanelVM = Nothing
End If
Map.refMainWindowVM.NotifyPropertyChanged(NameOf(Map.refMainWindowVM.nSelTabPage))
Map.refMainMenuVM.NotifyPropertyChanged(NameOf(Map.refMainMenuVM.SendFeedbackIsEnabled))
Map.refInstrumentPanelVM.NotifyPropertyChanged(NameOf(Map.refInstrumentPanelVM.ChangeParam_Visibility))
Map.refTopPanelVM.NotifyPropertyChanged(NameOf(Map.refTopPanelVM.MovePart_Visibility))
Return True
End Function
Private Function ExitMACHINING(bVerifyModification As Boolean) As Boolean
' verifico se progetto modificato, e chiedo se salvare
If bVerifyModification Then
If ProdFileVM.VerifyProjectModification(Map.refProdManagerVM.CurrProd) = MessageBoxResult.Cancel Then
Return False
End If
End If
' resetto eventuale visualizzazione statistiche
Map.refInstrumentPanelVM.ResetStatisticsIsChecked()
Map.refProjectVM.SetBottomPanel_Visibility(True)
Map.refProjectVM.SetLeftPanel_Visibility(False)
Map.refProjectVM.SetPartManager_Visibility(False)
Map.refProjectVM.SetFeatureManager_Visibility(True)
Map.refProjectVM.SetTopPanel_Visibility(False)
Map.refProjectVM.SetShowBeamPanel_Visibility(True)
Map.refProjectVM.SetProjManager_Visibility(True)
Map.refProjectVM.SetProdManager_Visibility(False)
Map.refProjectVM.SetOptimizePanel_Visibility(Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL AndAlso Map.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.NESTING_AUTO))
Map.refCALCPanelVM.SetChooseMachine_Visibility(False)
EgtResetCurrMachGroup()
Return True
End Function
Private Function InitCONFIG() As Boolean
Map.refMainWindowVM.NotifyPropertyChanged(NameOf(Map.refMainWindowVM.nSelTabPage))
Map.refMainMenuVM.NotifyPropertyChanged(NameOf(Map.refMainMenuVM.SendFeedbackIsEnabled))
' ricarico la lista delle colonne delle DataGrid in ConfigurationPage
If Not IsNothing(Map.refConfigurationPageVM) Then Map.refConfigurationPageVM.LoadConfigDGColumns()
Return True
End Function
Private Function ExitCONFIG() As Boolean
Map.refConfigurationPageVM.VerifyConfigPageModification()
' resetto flag inserimento password
Map.refConfigurationPageVM.bModifyMachParam = False
' ricarico le EgtDataGrid del programma con le colonne customizzate
Map.refFeatureListVM.FeatureColumns.Clear()
Map.refPartListVM.PartColumns.Clear()
Map.refFeatureInPartInRawPartListVM.FeatureInPartInRawPartColumns.Clear()
Map.refStatisticsVM.StatisticsColumns.Clear()
Map.refStatisticsVM.OptimizerStatisticsColumns.Clear()
Map.refPParameterListVM.PParameterListColumns.Clear()
Map.refQParameterListVM.QParameterListColumns.Clear()
GetPrivateProfileColumns(S_FEATURELIST, Map.refFeatureListVM.FeatureColumns)
GetPrivateProfileColumns(S_PARTLIST, Map.refPartListVM.PartColumns)
GetPrivateProfileColumns(S_FEATUREINPARTINRAWPARTLIST, Map.refFeatureInPartInRawPartListVM.FeatureInPartInRawPartColumns)
GetPrivateProfileColumns(S_STATISTICS, Map.refStatisticsVM.StatisticsColumns)
GetPrivateProfileColumns(S_OPTIMIZERSTATISTICS, Map.refStatisticsVM.OptimizerStatisticsColumns)
GetPrivateProfileColumns(S_PARAMETERLIST_P, Map.refPParameterListVM.PParameterListColumns)
GetPrivateProfileColumns(S_PARAMETERLIST_Q, Map.refQParameterListVM.QParameterListColumns)
If Not IsNothing(Map.refProjectVM.BTLStructureVM) Then
Map.refRawPartListVM.UpdateColumns(Map.refProjectVM.BTLStructureVM.nPROJTYPE)
Map.refPartInRawPartListVM.UpdateColumns(Map.refProjectVM.BTLStructureVM.nPROJTYPE)
Else
Map.refRawPartListVM.UpdateColumns(BWType.BEAM)
Map.refPartInRawPartListVM.UpdateColumns(BWType.BEAM)
End If
Return True
End Function
#End Region ' METHODS
#Region "COMMANDS"
#Region "Supervisor"
Public ReadOnly Property Supervisor_Command As ICommand
Get
If m_cmdSupervisor Is Nothing Then
m_cmdSupervisor = New Command(AddressOf Supervisor)
End If
Return m_cmdSupervisor
End Get
End Property
Public Sub Supervisor()
Dim sSupervisorName As String = "EgtBEAMWALL.SupervisorR32"
' recupero processo del supervisore
Dim localProc As Process() = Process.GetProcessesByName(sSupervisorName)
If localProc.Length > 0 Then
For Each p As Process In localProc
' porto in primo piano il Supervisor
BringWindowToFront(p.MainWindowHandle)
Exit For
Next
Else
Dim sSupervisorPath As String = Path.GetDirectoryName(System.AppDomain.CurrentDomain.BaseDirectory) & "\" & sSupervisorName & ".exe"
Try
Process.Start(sSupervisorPath)
Catch ex As Exception
EgtOutLog("Error: impossible starting supervisor from path " & sSupervisorPath)
End Try
End If
End Sub
#End Region ' Supervisor
#Region "SendFeedbackCommand"
'''
''' Returns a command that do SendFeedback.
'''
Public ReadOnly Property SendFeedbackCommand As ICommand
Get
If m_cmdSendFeedback Is Nothing Then
m_cmdSendFeedback = New Command(AddressOf SendFeedback)
End If
Return m_cmdSendFeedback
End Get
End Property
'''
''' Execute the SendFeedback. This method is invoked by the SendFeedbackCommand.
'''
Public Sub SendFeedback(ByVal param As Object)
If SelPage = Pages.MACHINING AndAlso IsNothing(Map.refProdManagerVM.CurrProd) Then
MessageBox.Show(EgtMsg(61891), EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
' Recupero indirizzo a cui spedire la mail
Dim sSupportAddress As String = String.Empty
GetMainPrivateProfileString(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
Dim sKey As String = String.Empty
EgtGetKeyInfo(sKey)
'' 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
' Map.refSceneHostVM.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
' Map.refSceneHostVM.SaveProject()
' End If
' End If
'End If
' Esporto il progetto
Dim ProjFileMList As List(Of ProjFileM)
If SelPage = Pages.MACHINING And Not IsNothing(Map.refProdManagerVM.CurrProd) Then
ProjFileMList = DbControllers.m_ProjController.GetByProdAsc(Map.refProdManagerVM.CurrProd.nProdId)
Map.refProjManagerVM.SetCurrProj(ProjFileMList(0).nProjId)
End If
Dim sExportFileName = Map.refProjManagerVM.CurrProj.nProjId.ToString("0000") & " - " & Map.refProjManagerVM.CurrProj.sBTLFileName & " - ProjectExport"
Dim sExpZipToCreate = Map.refProjManagerVM.ExportProject(sExportFileName)
' Creo zip file da allegare
Dim sZipToCreate As String = Map.refMainWindowVM.MainWindowM.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 progetto esportato
If File.Exists(sExpZipToCreate) Then
zip.AddItem(sExpZipToCreate, "")
End If
' aggiungo Prod e Proj associati
Dim ProdId As Integer
Select Case Map.refMainMenuVM.SelPage
Case Pages.VIEW
ProdId = Map.refProjManagerVM.CurrProj.nProdId
Case Pages.MACHINING
ProdId = Map.refProdManagerVM.CurrProd.nProdId
End Select
If ProdId = 0 Then
zip.AddItem(Map.refProjManagerVM.CurrProj.sProjDirPath, "Projs\" & Map.refProjManagerVM.CurrProj.nProjId.ToString("0000"))
Else
ProjFileMList = DbControllers.m_ProjController.GetByProdAsc(ProdId)
' se piu' di uno
If IsNothing(ProjFileMList) Then
Return
ElseIf ProjFileMList.Count > 0 Then
Dim ProjFileVMList As New List(Of ProjectFileVM)
For Each Project In ProjFileMList
ProjFileVMList.Add(New ProjFileVM(Project))
Next
For Each ProjFileVMItem In ProjFileVMList
zip.AddItem(ProjFileVMItem.sProjDirPath, "Projs\" & ProjFileVMItem.nProjId.ToString("0000"))
Next
zip.AddItem(ProjFileVMList(0).sProdDirPath, "Prods\" & ProjFileVMList(0).nProdId.ToString("0000"))
End If
End If
' aggiungo cartella macchina del progetto
Dim sMachineDir As String = Map.refMainWindowVM.MainWindowM.sMachinesRoot & "\" & sMachineName
If Directory.Exists(sMachineDir) Then
zip.AddItem(sMachineDir, sMachineName)
End If
' aggiungo file log
If File.Exists(Map.refMainWindowVM.MainWindowM.sLogFile) Then
zip.AddItem(Map.refMainWindowVM.MainWindowM.sLogFile, "")
End If
' aggiungo file parametri P e Q
If File.Exists(BTLIniFile.m_sBTLIniFile) Then
zip.AddItem(BTLIniFile.m_sBTLIniFile, "")
End If
' salvo lo zip
zip.Save()
End Using
Catch ex1 As Exception
EgtOutLog("Exception in zip: " & ex1.ToString())
End Try
' preparo la mail per il supporto
Dim bEx As Boolean = False
Try
Dim sAddressArray As String() = sSupportAddress.Split(CType(",", Char()))
Dim SendFeedbackWindow As New EgtWPFLib5.MapiMailMessage("EgtBEAMWALL Feedback - " & sKey)
SendFeedbackWindow.Recipients.Add(sAddressArray(0))
For index As Integer = 1 To sAddressArray.Length() - 1
SendFeedbackWindow.Recipients.Add(sAddressArray(index), EgtWPFLib5.MapiMailMessage.RecipientType.CC)
Next
If Not String.IsNullOrWhiteSpace(sZipToCreate) AndAlso File.Exists(sZipToCreate) Then
SendFeedbackWindow.Files.Add(Map.refMainWindowVM.MainWindowM.sTempDir & "\Feedback.zip")
End If
SendFeedbackWindow.ShowDialog()
Catch ex As Exception
EgtOutLog("Feedback exception: " & ex.ToString)
bEx = True
End Try
If bEx OrElse EgtWPFLib5.MapiMailMessage.m_ErrorCode <> 0 Then
MessageBox.Show(String.Format(EgtMsg(MSG_TOPCOMMANDBAR + 12), sSupportAddress, sZipToCreate), EgtMsg(MSG_MESSAGEBOX + 3), MessageBoxButton.OK, MessageBoxImage.Information)
Else
Map.refMyStatusBarVM.SetOutputMessage(EgtMsg(MSG_TOPCOMMANDBAR + 14))
End If
End Sub
#End Region ' SendFeedbackCommand
#Region "TEST"
#End Region ' TEST
#End Region ' COMMANDS
End Class