EgtDOORCreator 1.9b2 :
-aggiunta dell'HardwareManager, -aggiunta della pagina di stampa.
This commit is contained in:
@@ -0,0 +1,371 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.ComponentModel
|
||||
Imports System.IO
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
Imports Ionic.zip
|
||||
|
||||
Public Class ProjectManagerHardwareVM
|
||||
Implements INotifyPropertyChanged
|
||||
|
||||
#Region "FIELDS & PROPERTIES"
|
||||
|
||||
Friend m_CurrProject As Project
|
||||
|
||||
' Definizione comandi
|
||||
Private m_cmdNew As ICommand
|
||||
Private m_cmdSave As ICommand
|
||||
Private m_cmdOptions As ICommand
|
||||
Private m_cmdSendFeedback As ICommand
|
||||
Private m_cmdGuide As ICommand
|
||||
Private m_cmdDuplica As ICommand
|
||||
Private m_cmdDoor As ICommand
|
||||
|
||||
#Region "ToolTip"
|
||||
|
||||
'Proprietà ToolTip
|
||||
Public ReadOnly Property NewToolTip As String
|
||||
Get
|
||||
Return EgtMsg(MSG_TOPCOMMANDBAR + 1)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property SaveToolTip As String
|
||||
Get
|
||||
Return EgtMsg(MSG_TOPCOMMANDBAR + 3)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property SendFeedbackToolTip As String
|
||||
Get
|
||||
Return EgtMsg(50046)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property OptionsToolTip As String
|
||||
Get
|
||||
Return EgtMsg(MSG_MAINWINDOW + 209)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property GuideToolTip As String
|
||||
Get
|
||||
Return EgtMsg(50305)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property Help As String
|
||||
Get
|
||||
Return EgtMsg(50305)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property DuplicaToolTip As String
|
||||
Get
|
||||
Return "Duplicate"
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region ' ToolTip
|
||||
|
||||
#End Region ' Fields & Properties
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New()
|
||||
Map.SetRefProjectManagerHardwareVM(Me)
|
||||
End Sub
|
||||
|
||||
#End Region ' Constructor
|
||||
|
||||
#Region "COMMANDS"
|
||||
|
||||
#Region "NewCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do New.
|
||||
''' </summary>
|
||||
Public ReadOnly Property NewCommand As ICommand
|
||||
Get
|
||||
If m_cmdNew Is Nothing Then
|
||||
m_cmdNew = New Command(AddressOf NewCmd)
|
||||
End If
|
||||
Return m_cmdNew
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the New. This method is invoked by the NewCommand.
|
||||
''' </summary>
|
||||
Public Sub NewCmd()
|
||||
If Not IsNothing(Map.refHardwarePageVM.CurrHardware) Then
|
||||
' controllo che quello che esiste sia salvato
|
||||
If Map.refHardwarePageVM.CurrHardware.SaveControl() = Hardware.SaveResult.nCancel Then Return
|
||||
' notifico la modifica
|
||||
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
||||
Map.refHardwarePageVM.CurrHardware.ClearGroupChapters()
|
||||
' solo se il modello non esiste allora carico l'unico che può esistere
|
||||
Map.refHardwarePageVM.CurrHardware.TemplateName = "File Name"
|
||||
Map.refHardwarePageVM.CurrHardware.ReadChapterTemplate()
|
||||
Map.refSceneManagerVM.RefreshBtn()
|
||||
Map.refHardwarePageVM.CurrHardware.VisibilityTextTemplate = Visibility.Visible
|
||||
Map.refHardwarePageVM.CurrHardware.IsEnableType = True
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' NewCommand
|
||||
|
||||
#Region "SaveCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Save.
|
||||
''' </summary>
|
||||
Public ReadOnly Property SaveCommand As ICommand
|
||||
Get
|
||||
If m_cmdSave Is Nothing Then
|
||||
m_cmdSave = New Command(AddressOf Save)
|
||||
End If
|
||||
Return m_cmdSave
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Save. This method is invoked by the SaveCommand.
|
||||
''' </summary>
|
||||
Public Sub Save()
|
||||
If Not IsNothing(Map.refHardwarePageVM.CurrHardware) Then Map.refHardwarePageVM.CurrHardware.Save()
|
||||
End Sub
|
||||
|
||||
#End Region ' SaveCommand
|
||||
|
||||
#Region "OptionsCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Export.
|
||||
''' </summary>
|
||||
Public ReadOnly Property OptionsCommand As ICommand
|
||||
Get
|
||||
If m_cmdOptions Is Nothing Then
|
||||
m_cmdOptions = New Command(AddressOf Options)
|
||||
End If
|
||||
Return m_cmdOptions
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Export. This method is invoked by the ExportCommand.
|
||||
''' </summary>
|
||||
Public Sub Options(ByVal param As Object)
|
||||
Dim OptionsWindow As New OptionsV
|
||||
OptionsWindow.Height = 550
|
||||
OptionsWindow.Width = 650
|
||||
OptionsWindow.DataContext = New OptionsVM()
|
||||
OptionsWindow.Owner = Application.Current.MainWindow
|
||||
OptionsWindow.ShowDialog()
|
||||
End Sub
|
||||
|
||||
#End Region ' OptionsCommand
|
||||
|
||||
#Region "SendFeedbackCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do SendFeedback.
|
||||
''' </summary>
|
||||
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
|
||||
|
||||
''' <summary>
|
||||
''' Execute the SendFeedback. This method is invoked by the SendFeedbackCommand.
|
||||
''' </summary>
|
||||
Public Sub SendFeedback()
|
||||
'' 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(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
||||
' Return
|
||||
'End If
|
||||
'' Recupero numero chiave
|
||||
'Dim sKey As String = String.Empty
|
||||
'EgtGetKeyInfo(sKey)
|
||||
'' Recupero file del progetto corrente (tipo file .nge)
|
||||
'Dim sCurrProject As String = String.Empty
|
||||
'EgtGetCurrFilePath(sCurrProject)
|
||||
'' se nome file vuoto, chiedo se si vuole salvare (file .nge)
|
||||
'If String.IsNullOrWhiteSpace(sCurrProject) Then
|
||||
' If MessageBox.Show(EgtMsg(MSG_TOPCOMMANDBAR + 11), "", MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes Then
|
||||
' Save()
|
||||
' 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
|
||||
' Save()
|
||||
' End If
|
||||
' End If
|
||||
'End If
|
||||
'' recuro il file DDF associato al file .nge
|
||||
'Dim sCurrProjectDDF As String = String.Empty
|
||||
'sCurrProjectDDF = IniFile.m_sTempDir & "\CurrPart.ddf"
|
||||
'' recupero il file di log
|
||||
'Dim sFileLog As String = String.Empty
|
||||
'sFileLog = IniFile.m_sTempDir & "\EgtDOORCreatorLog1.txt"
|
||||
|
||||
'' 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 progetto corrente .nge
|
||||
' If File.Exists(sCurrProject) Then
|
||||
' zip.AddItem(sCurrProject, "")
|
||||
' End If
|
||||
' ' aggiungo progetto corrente .ddf
|
||||
' If File.Exists(sCurrProjectDDF) Then
|
||||
' zip.AddItem(sCurrProjectDDF, "")
|
||||
' End If
|
||||
' ' aggiungo file log
|
||||
' If File.Exists(sFileLog) Then
|
||||
' zip.AddItem(sFileLog, "")
|
||||
' End If
|
||||
' ' aggiungo la cartella Doors
|
||||
' If Directory.Exists(IniFile.m_sDoorsDirPath) Then
|
||||
' zip.AddItem(IniFile.m_sDoorsDirPath, "Doors")
|
||||
' End If
|
||||
' 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 SendFeedbackWindow As New EgtWPFLib5.MapiMailMessage("EgtDOORCreator Feedback - " & sKey)
|
||||
' SendFeedbackWindow.Recipients.Add(sSupportAddress)
|
||||
' If Not String.IsNullOrWhiteSpace(sZipToCreate) AndAlso File.Exists(sZipToCreate) Then
|
||||
' SendFeedbackWindow.Files.Add(IniFile.m_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_EGTDOORCREATOR + 118), MessageBoxButton.OK, MessageBoxImage.Information)
|
||||
' ' stampo il messaggio nella StatusBar
|
||||
' Map.refStatusBarVM.StatusOutput = EgtMsg(MSG_TOPCOMMANDBAR + 14)
|
||||
'Else
|
||||
' ' stampo il messaggio nella StatusBar
|
||||
' Map.refStatusBarVM.StatusOutput = EgtMsg(MSG_TOPCOMMANDBAR + 14)
|
||||
'End If
|
||||
End Sub
|
||||
|
||||
#End Region ' SendFeedbackCommand
|
||||
|
||||
#Region "Guide"
|
||||
Public ReadOnly Property GuideCommand As ICommand
|
||||
Get
|
||||
If m_cmdGuide Is Nothing Then
|
||||
m_cmdGuide = New Command(AddressOf Guide)
|
||||
End If
|
||||
Return m_cmdGuide
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub Guide()
|
||||
Dim GuideWindow As New GuideV(Application.Current.MainWindow, New GuideVM)
|
||||
GuideWindow.Show()
|
||||
End Sub
|
||||
|
||||
#End Region ' Guide
|
||||
|
||||
#Region "Duplica"
|
||||
|
||||
Public ReadOnly Property DuplicaCommand As ICommand
|
||||
Get
|
||||
If m_cmdDuplica Is Nothing Then
|
||||
m_cmdDuplica = New Command(AddressOf Duplica)
|
||||
End If
|
||||
Return m_cmdDuplica
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub Duplica()
|
||||
If Not IsNothing(Map.refHardwarePageVM) And Not IsNothing(Map.refHardwarePageVM.CurrHardware) Then
|
||||
If Map.refHardwarePageVM.CurrHardware.SaveControl() = Hardware.SaveResult.nCancel Then
|
||||
Return
|
||||
ElseIf Map.refHardwarePageVM.CurrHardware.SaveControl() = Hardware.SaveResult.nYes Then
|
||||
Map.refHardwarePageVM.CurrHardware.Save()
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not IsNothing(Map.refHardwarePageVM.CurrHardware) Then
|
||||
Dim refNewHardwareV As New NewHardwareV
|
||||
Dim refNewhardwareVM As New NewHardwareVM(Map.refHardwarePageVM.CurrHardware.HardwareGeneral)
|
||||
refNewHardwareV.DataContext = refNewhardwareVM
|
||||
refNewHardwareV.Owner = Application.Current.MainWindow
|
||||
refNewHardwareV.ShowDialog()
|
||||
refNewHardwareV.Close()
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
#End Region ' Duplica
|
||||
|
||||
#Region "Door"
|
||||
|
||||
Public ReadOnly Property DoorCommand As ICommand
|
||||
Get
|
||||
If m_cmdDoor Is Nothing Then
|
||||
m_cmdDoor = New Command(AddressOf GoToPartPage)
|
||||
End If
|
||||
Return m_cmdDoor
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub GoToPartPage()
|
||||
' controllo che sia stato salvato
|
||||
If Not IsNothing(Map.refHardwarePageVM) And Not IsNothing(Map.refHardwarePageVM.CurrHardware) Then
|
||||
If Map.refHardwarePageVM.CurrHardware.SaveControl() = Hardware.SaveResult.nCancel Then
|
||||
Return
|
||||
ElseIf Map.refHardwarePageVM.CurrHardware.SaveControl() = Hardware.SaveResult.nYes Then
|
||||
Map.refHardwarePageVM.CurrHardware.Save()
|
||||
End If
|
||||
End If
|
||||
' torna all'EgtDOORCreator
|
||||
If OptionModule.m_ConfigurationSoftware = ConfigType.Assembly Then
|
||||
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nAssemblyPage
|
||||
Else
|
||||
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nDDFPage
|
||||
Map.refCompoPanelVM.GoBackVisibility = Visibility.Collapsed
|
||||
End If
|
||||
' elimino i riferimenti all'hardware corrente
|
||||
Map.refHardwarePageVM.CurrHardware = Nothing
|
||||
' spengo il focus su tutti i bottoni
|
||||
For IndexCompoType As Integer = 0 To Map.refCompoPanelHardwareVM.CompoTypeList.Count - 1
|
||||
Map.refCompoPanelHardwareVM.CompoTypeList(IndexCompoType).IsSelectedBtn = False
|
||||
Next
|
||||
Map.refHardwarePageVM.CompoPanelControl.DataContext = Map.refCompoPanelHardwareVM
|
||||
Map.refProjectManagerVM.OpenLastProject()
|
||||
Map.refSceneManagerVM.RefreshBtn()
|
||||
CompoMatch.ResetHMD()
|
||||
End Sub
|
||||
|
||||
|
||||
#End Region ' LastProject
|
||||
|
||||
#End Region ' Commands
|
||||
|
||||
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
|
||||
|
||||
Public Sub NotifyPropertyChanged(propName As String)
|
||||
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user