cedcf1dd4f
- aggiunta di nuovo parametro ( ActiveBox); - possibilità di selezionare l'ultimo ddf letto ( in modalità singola porta); - elimino l'errore dopo la modifica dei parametri; - porto il focus sul ddf selezionato ( in modalità progetto).
1051 lines
42 KiB
VB.net
1051 lines
42 KiB
VB.net
Imports System.Collections.ObjectModel
|
|
Imports System.ComponentModel
|
|
Imports System.IO
|
|
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
Imports Ionic.zip
|
|
|
|
Public Class ProjectManagerVM
|
|
Implements INotifyPropertyChanged
|
|
|
|
Friend m_MruFiles As New MruList
|
|
Public ReadOnly Property MruFileNames As ObservableCollection(Of String)
|
|
Get
|
|
Return m_MruFiles.FileNames
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property DisableHM As Visibility
|
|
Get
|
|
If OptionModule.m_DisableHM Then
|
|
Return Visibility.Visible
|
|
Else
|
|
Return Visibility.Collapsed
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property VisibilityTemplate As Visibility
|
|
Get
|
|
If OptionModule.m_DisableTemplate Then
|
|
Return Visibility.Collapsed
|
|
Else
|
|
Return Visibility.Visible
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
Friend m_CurrProject As Project
|
|
|
|
' Definizione comandi
|
|
Private m_cmdNew As ICommand
|
|
Private m_cmdOpen As ICommand
|
|
Private m_cmdOpenMruFile As ICommand
|
|
Private m_cmdSave As ICommand
|
|
Private m_cmdSaveAs As ICommand
|
|
Private m_cmdInsert As ICommand
|
|
Private m_cmdImport As ICommand
|
|
Private m_cmdExport As ICommand
|
|
Private m_cmdPrint As ICommand
|
|
Private m_cmdOptions As ICommand
|
|
Private m_CmdLastProject As ICommand
|
|
Private m_cmdSendFeedback As ICommand
|
|
Private m_CmdCreateTemplate As ICommand
|
|
Private m_cmdGuide As ICommand
|
|
Private m_cmdCopy As ICommand
|
|
Private m_cmdDuplica As ICommand
|
|
Private m_cmdHardware As ICommand
|
|
Private m_cmdRefreshDir 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 OpenToolTip As String
|
|
Get
|
|
Return EgtMsg(MSG_TOPCOMMANDBAR + 2)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property SaveToolTip As String
|
|
Get
|
|
Return EgtMsg(MSG_TOPCOMMANDBAR + 3)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property SaveAsToolTip As String
|
|
Get
|
|
Return EgtMsg(MSG_TOPCOMMANDBAR + 4)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property InsertToolTip As String
|
|
Get
|
|
Return EgtMsg(MSG_TOPCOMMANDBAR + 5)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property ImportToolTip As String
|
|
Get
|
|
Return EgtMsg(MSG_TOPCOMMANDBAR + 6)
|
|
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 TemplateDoorToolTip As String
|
|
Get
|
|
Return EgtMsg(MSG_MAINWINDOW + 223)
|
|
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 CopyToolTip As String
|
|
Get
|
|
' Export to machine
|
|
Return EgtMsg(50416)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property DuplicaToolTip As String
|
|
Get
|
|
' Duplicate
|
|
Return EgtMsg(50415)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property PrintToolTip As String
|
|
Get
|
|
' Print
|
|
Return EgtMsg(50411)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property HardwareToolTip As String
|
|
Get
|
|
' Hardware
|
|
Return EgtMsg(50413)
|
|
End Get
|
|
End Property
|
|
#End Region ' ToolTip
|
|
|
|
#End Region ' Fields & Properties
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New()
|
|
Map.SetRefProjectManagerVM(Me)
|
|
' Impostazioni MruLists
|
|
m_MruFiles.Init(S_MRUFILES, 8)
|
|
End Sub
|
|
|
|
#End Region ' Constructor
|
|
|
|
#Region "COMMANDS"
|
|
|
|
#Region "NewCommand"
|
|
|
|
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
|
|
|
|
Public Sub NewCmd()
|
|
' Gestisco porta corrente modificata
|
|
If Not Map.refAssemblyManagerVM.ManageModified() Then Return
|
|
' Richiedo il nome del progetto (cioè la directory da creare)
|
|
If Not OptionModule.m_SingleDoor Then
|
|
Dim SaveFileDialog As New MySaveFileDialogVM
|
|
Dim SaveFileDialogWnd As New EgtWPFLib5.SaveFileDialogV(Application.Current.MainWindow, SaveFileDialog)
|
|
SaveFileDialog.Title = EgtMsg(50304)
|
|
SaveFileDialog.Directory = IniFile.m_MyProjectDir & "\"
|
|
SaveFileDialog.Extension = "\"
|
|
If Not SaveFileDialogWnd.ShowDialog Then
|
|
Map.refAssemblyManagerVM.Open(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName)
|
|
Return
|
|
End If
|
|
' controllo che il direttorio non esista
|
|
Dim MsgResult As MessageBoxResult = MessageBoxResult.Yes
|
|
If Directory.Exists(SaveFileDialog.FileName) Then
|
|
MsgResult = MessageBox.Show("Directory " & SaveFileDialog.FileName & " already exists! Do you want to overwrite it?", "Caution", MessageBoxButton.YesNo, MessageBoxImage.Asterisk)
|
|
' cancello il direttorio
|
|
Directory.Delete(SaveFileDialog.FileName, True)
|
|
End If
|
|
If MsgResult = MessageBoxResult.No Then
|
|
Map.refAssemblyManagerVM.Open(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName)
|
|
Return
|
|
End If
|
|
' Creo nuovo progetto
|
|
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nNothingSelected
|
|
Directory.CreateDirectory(SaveFileDialog.FileName)
|
|
Dim CurrProject As Project = Map.refAssemblyManagerVM.CurrProject
|
|
' salvo il riferimento al progetto corrente
|
|
m_CurrProject = CurrProject
|
|
' salvo path progetto
|
|
CurrProject.Name = SaveFileDialog.FileName
|
|
' Ripulisco lista porte
|
|
CurrProject.AssemblyList.Clear()
|
|
EgtNewFile()
|
|
EgtZoom(ZM.ALL)
|
|
Map.refMainWindowVM.ProjectNameMsg = CurrProject.Name
|
|
' Creo nuova porta
|
|
Map.refAssemblyManagerVM.AddAssembly()
|
|
Map.refOptionsVM.MyProjectDir = CurrProject.Name
|
|
Return
|
|
End If
|
|
|
|
' dichiaro la finestra di dialogo
|
|
Dim saveFileDialog1 As New System.Windows.Forms.SaveFileDialog()
|
|
saveFileDialog1.Filter = "ddf files (*.ddf)|*.ddf"
|
|
saveFileDialog1.FilterIndex = 2
|
|
saveFileDialog1.RestoreDirectory = True
|
|
' apro la finestra di dialogo
|
|
If saveFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
|
|
Dim FilePathComplete As String = saveFileDialog1.FileName
|
|
Dim CurrProject As Project = Map.refAssemblyManagerVM.CurrProject
|
|
' salvo il riferimento al progetto corrente
|
|
m_CurrProject = CurrProject
|
|
' salvo path progetto
|
|
CurrProject.Name = Path.GetDirectoryName(FilePathComplete)
|
|
' Ripulisco lista porte
|
|
CurrProject.AssemblyList.Clear()
|
|
EgtNewFile()
|
|
EgtZoom(ZM.ALL)
|
|
Map.refMainWindowVM.ProjectNameMsg = CurrProject.Name
|
|
' creo un nuovo assemblato
|
|
Dim Local_AssemblyName As New AssemblyName
|
|
Local_AssemblyName.Name = FilePathComplete
|
|
m_CurrProject.AssemblyList.Add(Local_AssemblyName)
|
|
' Seleziono AssembyName creato
|
|
m_CurrProject.SelAssemblyName = Local_AssemblyName
|
|
' Creo nuovo assembly
|
|
Map.refAssemblyManagerVM.NewCmd(Local_AssemblyName)
|
|
' carico il nome come Assemblato selezionato
|
|
If Not OptionModule.m_DisableWindowOrder Then
|
|
Dim OrderWindow As New OrderV(Application.Current.MainWindow, New OrderVM())
|
|
OrderWindow.ShowDialog()
|
|
End If
|
|
' tolgo la visualizzazione della lista dei nomi
|
|
Map.refAssemblyManagerVM.VisibilityDoorList = Visibility.Collapsed
|
|
CurrProject.NotifyPropertyChanged("Name")
|
|
End If
|
|
|
|
End Sub
|
|
|
|
#End Region ' NewCommand
|
|
|
|
#Region "OpenCommand"
|
|
|
|
Public ReadOnly Property OpenCommand As ICommand
|
|
Get
|
|
If m_cmdOpen Is Nothing Then
|
|
m_cmdOpen = New Command(AddressOf Open)
|
|
End If
|
|
Return m_cmdOpen
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub Open()
|
|
OpenProject("")
|
|
End Sub
|
|
|
|
Public Sub OpenProject(sFilePath As String)
|
|
' se true carica una singola porta del progetto
|
|
Dim bIsSingleDoor As Boolean = OptionModule.m_SingleDoor
|
|
Dim sFilePathComplete As String = String.Empty
|
|
Dim bValidPath As Boolean = False
|
|
' verifico se selezionato esiste e modificato
|
|
If Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) AndAlso Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified Then
|
|
Dim sText As String = String.Format(EgtMsg(50109), Path.GetFileNameWithoutExtension(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name))
|
|
Select Case MessageBox.Show(sText, "", MessageBoxButton.YesNoCancel, MessageBoxImage.Question)
|
|
Case MessageBoxResult.Yes
|
|
Map.refAssemblyManagerVM.Save(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName)
|
|
Case MessageBoxResult.No
|
|
'Map.refAssemblyManagerVM.Delete(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName)
|
|
Case MessageBoxResult.Cancel
|
|
Return
|
|
End Select
|
|
End If
|
|
|
|
If Directory.Exists(sFilePath) AndAlso Not bIsSingleDoor Then
|
|
bValidPath = True
|
|
ElseIf Directory.Exists(sFilePath) AndAlso bIsSingleDoor Then
|
|
m_MruFiles.Remove(sFilePath)
|
|
bValidPath = False
|
|
ElseIf File.Exists(sFilePath) Then
|
|
sFilePathComplete = sFilePath
|
|
sFilePath = Path.GetDirectoryName(sFilePath)
|
|
bValidPath = True
|
|
Else
|
|
' elimino eventual FilePath inesistente dalla lista dei recenti
|
|
m_MruFiles.Remove(sFilePath)
|
|
bValidPath = False
|
|
End If
|
|
|
|
' Se FilePath non valida
|
|
If Not bValidPath Then
|
|
|
|
'If OptionModule.m_SingleDoor OrElse Keyboard.Modifiers.HasFlag(ModifierKeys.Shift) Then
|
|
If OptionModule.m_SingleDoor Then
|
|
bIsSingleDoor = True
|
|
' definisco la finestra di dialogo per la scelta dei file
|
|
Dim fd As System.Windows.Forms.OpenFileDialog = New System.Windows.Forms.OpenFileDialog()
|
|
fd.Title = "Open File Dialog"
|
|
' indirizzo la scelta verso una cartella
|
|
If Not String.IsNullOrEmpty(Map.refOptionsVM.MyProjectDir) Then
|
|
fd.InitialDirectory = Map.refOptionsVM.MyProjectDir
|
|
ElseIf Not String.IsNullOrEmpty(OptionModule.m_sLastProject) Then
|
|
fd.InitialDirectory = Path.GetDirectoryName(OptionModule.m_sLastProject)
|
|
ElseIf Not String.IsNullOrWhiteSpace(Map.refAssemblyManagerVM.CurrProject.Name) Then
|
|
fd.InitialDirectory = Map.refAssemblyManagerVM.CurrProject.Name
|
|
Else
|
|
fd.InitialDirectory = IniFile.m_MyProjectDir
|
|
End If
|
|
' seleziono il filtro di apertura
|
|
fd.Filter = " (*.ddf)|*.ddf|(*.ddf)|*.ddf"
|
|
fd.FilterIndex = 2
|
|
fd.RestoreDirectory = True
|
|
' apro la finestra di dialogo
|
|
If fd.ShowDialog() <> System.Windows.Forms.DialogResult.OK Then
|
|
Return
|
|
End If
|
|
' salvo il nome del direttorio
|
|
sFilePath = Path.GetDirectoryName(fd.FileName)
|
|
' salvo il nome completo del file
|
|
sFilePathComplete = fd.FileName
|
|
Else
|
|
' dichiaro la finestra di scelta cartella di progetto
|
|
Dim FolderBrowserDialog As New System.Windows.Forms.FolderBrowserDialog
|
|
If Not String.IsNullOrWhiteSpace(Map.refAssemblyManagerVM.CurrProject.Name) Then
|
|
FolderBrowserDialog.SelectedPath = Map.refAssemblyManagerVM.CurrProject.Name
|
|
ElseIf Not String.IsNullOrEmpty(OptionModule.m_sLastProject) Then
|
|
FolderBrowserDialog.SelectedPath = Path.GetDirectoryName(OptionModule.m_sLastProject)
|
|
Else
|
|
FolderBrowserDialog.SelectedPath = IniFile.m_MyProjectDir
|
|
End If
|
|
' mostriamo la finestra di dialogo aperta nel direttorio selzionato sopra
|
|
If FolderBrowserDialog.ShowDialog <> Forms.DialogResult.OK Then
|
|
' se la risposta è diversa da OK esce
|
|
Return
|
|
End If
|
|
' salvo il nome del direttorio
|
|
sFilePath = FolderBrowserDialog.SelectedPath
|
|
End If
|
|
End If
|
|
|
|
Dim CurrProject As Project = Map.refAssemblyManagerVM.CurrProject
|
|
' salvo il riferimento al progetto corrente
|
|
m_CurrProject = CurrProject
|
|
' salvo path progetto
|
|
CurrProject.Name = sFilePath
|
|
' Ripulisco lista porte
|
|
CurrProject.AssemblyList.Clear()
|
|
|
|
' caricamento elenco porte
|
|
If Not bIsSingleDoor Then
|
|
' Aggiungo porte trovate nella cartella ad un vettore
|
|
Dim DDFFileArray() As String = Directory.GetFiles(sFilePath)
|
|
' ripulisco il nome della porta (cancello tutto il percorso del file lasciando solo il nome del file)
|
|
For DDFIndex = 0 To DDFFileArray.Count - 1
|
|
If Path.GetExtension(DDFFileArray(DDFIndex)).ToLower = ".ddf" Then
|
|
' lo aggiungo alla lista delle porte
|
|
Dim Local_Assembly As New AssemblyName
|
|
Local_Assembly.Name = DDFFileArray(DDFIndex)
|
|
Local_Assembly.IsModified = False
|
|
CurrProject.AssemblyList.Add(Local_Assembly)
|
|
End If
|
|
Next
|
|
Else
|
|
' carcio la singola porta
|
|
Dim Local_Assembly As New AssemblyName
|
|
Local_Assembly.Name = sFilePathComplete
|
|
Local_Assembly.IsModified = False
|
|
CurrProject.AssemblyList.Add(Local_Assembly)
|
|
End If
|
|
|
|
' Notifico aggiornamento DoorList e Name per aggiornare la grafica
|
|
'CurrProject.NotifyPropertyChanged("Name")
|
|
CurrProject.NotifyPropertyChanged("AssemblyList")
|
|
' Se c'è almeno una porta la visualizzo
|
|
If CurrProject.AssemblyList.Count > 0 Then
|
|
Dim bAssemblyIsSelected As Boolean = False
|
|
If Not String.IsNullOrWhiteSpace(sFilePathComplete) Then
|
|
For Each ItemFile In CurrProject.AssemblyList
|
|
If sFilePathComplete = ItemFile.Name Then
|
|
CurrProject.SelAssemblyName = ItemFile
|
|
bAssemblyIsSelected = True
|
|
Exit For
|
|
End If
|
|
Next
|
|
End If
|
|
If Not bAssemblyIsSelected Then
|
|
CurrProject.SelAssemblyName = CurrProject.AssemblyList(0)
|
|
End If
|
|
Else
|
|
Map.refPartPageVM.CurrPart = Nothing
|
|
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nNothingSelected
|
|
EgtNewFile()
|
|
EgtZoom(ZM.ALL)
|
|
End If
|
|
' carico il nome del direttorio e la visbilità della lista delle porte
|
|
If bIsSingleDoor Then
|
|
Map.refMainWindowVM.ProjectNameMsg = CurrProject.SelAssemblyName.Name
|
|
Map.refAssemblyManagerVM.VisibilityDoorList = Visibility.Collapsed
|
|
Else
|
|
Map.refMainWindowVM.ProjectNameMsg = CurrProject.Name
|
|
Map.refAssemblyManagerVM.VisibilityDoorList = Visibility.Visible
|
|
End If
|
|
' aggiorno la grafica
|
|
CurrProject.NotifyPropertyChanged("Name")
|
|
' salvo il nome del file corrente in lettura
|
|
If Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) AndAlso
|
|
Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name) Then
|
|
WriteMainPrivateProfileString(S_LAUNCHERWINDOW, K_LASTPROJECT, Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name)
|
|
Else
|
|
WriteMainPrivateProfileString(S_LAUNCHERWINDOW, K_LASTPROJECT, Map.refAssemblyManagerVM.CurrProject.Name)
|
|
End If
|
|
' Aggiungo alla lista dei recenti/ verifico se esite anche se posso salvare un indirizzo comlpeto
|
|
Map.refOptionsVM.MyProjectDir = sFilePath
|
|
If bIsSingleDoor Then
|
|
m_MruFiles.Add(CurrProject.SelAssemblyName.Name)
|
|
Else
|
|
m_MruFiles.Add(sFilePath)
|
|
End If
|
|
|
|
End Sub
|
|
|
|
#End Region ' OpenCommand
|
|
|
|
#Region "OpenMruFileCommand"
|
|
|
|
Public ReadOnly Property OpenMruFileCommand As ICommand
|
|
Get
|
|
If m_cmdOpenMruFile Is Nothing Then
|
|
m_cmdOpenMruFile = New Command(AddressOf OpenMruFile)
|
|
End If
|
|
Return m_cmdOpenMruFile
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub OpenMruFile(ByVal param As Object)
|
|
Dim sLastProject As String = DirectCast(param, String).Replace("__", "_")
|
|
OpenProject(sLastProject)
|
|
End Sub
|
|
|
|
#End Region ' OpenMruFileCommand
|
|
|
|
#Region "SaveCommand"
|
|
|
|
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
|
|
|
|
Public Sub Save()
|
|
' Verifico esista elemento selezionato
|
|
If IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) Then
|
|
' Impossibile savare un file se non esiste una porta! Errore
|
|
MessageBox.Show(EgtMsg(50128), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Exclamation)
|
|
Return
|
|
End If
|
|
' Eseguo salvataggio
|
|
Map.refAssemblyManagerVM.Save(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName)
|
|
If DdfFile.DDFIsCorrect Then Map.refSceneManagerVM.RefreshBtn() ' aggiorno l'immagine solo se il salvataggio è andato a buon fine
|
|
End Sub
|
|
|
|
#End Region ' SaveCommand
|
|
|
|
#Region "OptionsCommand"
|
|
|
|
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
|
|
|
|
Public Sub Options(ByVal param As Object)
|
|
Dim OptionsWindow As New OptionsV
|
|
OptionsWindow.Height = 650
|
|
OptionsWindow.Width = 650
|
|
OptionsWindow.DataContext = New OptionsVM()
|
|
OptionsWindow.Owner = Application.Current.MainWindow
|
|
OptionsWindow.ShowDialog()
|
|
End Sub
|
|
|
|
#End Region ' OptionsCommand
|
|
|
|
#Region "LastProject"
|
|
|
|
Public ReadOnly Property LastProjectCommand As ICommand
|
|
Get
|
|
If m_CmdLastProject Is Nothing Then
|
|
m_CmdLastProject = New Command(AddressOf OpenLastProject)
|
|
End If
|
|
Return m_CmdLastProject
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub OpenLastProject()
|
|
'' Apro l'ultimo progetto
|
|
'Dim CurrName As String = String.Empty
|
|
'' verifico se esiste una precedente selezione
|
|
'If Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) Then
|
|
' If Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name) Then
|
|
' CurrName = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name
|
|
' End If
|
|
'End If
|
|
|
|
Dim CurrProject As Project = Map.refAssemblyManagerVM.CurrProject
|
|
' carico il percorso dell'ultimo progetto salvato (sul file Config.ini)
|
|
If IsNothing(CurrProject.Name) Then
|
|
If File.Exists(OptionModule.m_sLastProject) Then
|
|
CurrProject.Name = Path.GetDirectoryName(OptionModule.m_sLastProject)
|
|
ElseIf Path.HasExtension(OptionModule.m_sLastProject) AndAlso Directory.Exists(Path.GetDirectoryName(OptionModule.m_sLastProject)) Then
|
|
CurrProject.Name = Path.GetDirectoryName(OptionModule.m_sLastProject)
|
|
ElseIf Not Path.HasExtension(OptionModule.m_sLastProject) AndAlso Directory.Exists(OptionModule.m_sLastProject) Then
|
|
CurrProject.Name = OptionModule.m_sLastProject
|
|
End If
|
|
End If
|
|
|
|
' ripulisco la lista di porte
|
|
CurrProject.AssemblyList.Clear()
|
|
' verifico che esista la cartella
|
|
If Directory.Exists(CurrProject.Name) Then
|
|
' carico la singola porta dell'ultimo progetto come unica porta
|
|
If OptionModule.m_SingleDoor Then
|
|
Dim Local_Assembly As New AssemblyName
|
|
If File.Exists(OptionModule.m_sLastProject) Then
|
|
Local_Assembly.Name = OptionModule.m_sLastProject
|
|
Local_Assembly.IsModified = False
|
|
CurrProject.AssemblyList.Add(Local_Assembly)
|
|
Else
|
|
' Aggiungo il primo nome all'elenco
|
|
Dim DDFFileArray() As String = Directory.GetFiles(CurrProject.Name)
|
|
For DDFIndex = 0 To DDFFileArray.Count - 1
|
|
If Path.GetExtension(DDFFileArray(DDFIndex)).ToLower = ".ddf" Then
|
|
OptionModule.m_sLastProject = DDFFileArray(DDFIndex)
|
|
Local_Assembly.Name = OptionModule.m_sLastProject
|
|
Local_Assembly.IsModified = False
|
|
CurrProject.AssemblyList.Add(Local_Assembly)
|
|
Exit For
|
|
End If
|
|
Next
|
|
End If
|
|
Map.refAssemblyManagerVM.VisibilityDoorList = Visibility.Collapsed
|
|
Else
|
|
' carico un vettore con i file della cartella
|
|
Dim DDFFileArray() As String = Directory.GetFiles(CurrProject.Name)
|
|
' ripulisco il nome della porta (cancello tutto il percorso del file lasciando solo il nome del file)
|
|
For DDFIndex = 0 To DDFFileArray.Count - 1
|
|
If Path.GetExtension(DDFFileArray(DDFIndex)).ToLower = ".ddf" Then
|
|
' lo aggiungo alla lista delle porte
|
|
Dim Local_Assembly As New AssemblyName
|
|
Local_Assembly.Name = DDFFileArray(DDFIndex)
|
|
Local_Assembly.IsModified = False
|
|
CurrProject.AssemblyList.Add(Local_Assembly)
|
|
End If
|
|
Next
|
|
Map.refAssemblyManagerVM.VisibilityDoorList = Visibility.Visible
|
|
End If
|
|
|
|
' Notifico aggiornamento DoorList e Name per aggiornare la grafica
|
|
CurrProject.NotifyPropertyChanged("Name")
|
|
CurrProject.NotifyPropertyChanged("AssemblyList")
|
|
Map.refMainWindowVM.ProjectNameMsg = CurrProject.Name
|
|
Map.refOptionsVM.MyProjectDir = CurrProject.Name
|
|
'Map.refMainWindowVM.ModifyTitle(False)
|
|
|
|
' Se c'è almeno una porta la visualizzo
|
|
If CurrProject.AssemblyList.Count > 0 Then
|
|
'If Not String.IsNullOrEmpty(CurrName) Then
|
|
' ' ricerco nell'elenco la porta salvata
|
|
' For IndexListAss As Integer = 0 To CurrProject.AssemblyList.Count - 1
|
|
' If CurrName = CurrProject.AssemblyList(IndexListAss).Name Then
|
|
' CurrProject.SelAssemblyName = CurrProject.AssemblyList(IndexListAss)
|
|
' Return
|
|
' End If
|
|
' Next
|
|
'End If
|
|
|
|
' provo a caricare l'ultimo file aperto
|
|
If File.Exists(OptionModule.m_sLastProject) Then
|
|
For Each ItemFile In CurrProject.AssemblyList
|
|
Dim Index As Integer = 1
|
|
If ItemFile.Name = OptionModule.m_sLastProject Then
|
|
CurrProject.SelAssemblyName = ItemFile
|
|
If OptionModule.m_SingleDoor Then Map.refMainWindowVM.ProjectNameMsg = OptionModule.m_sLastProject
|
|
Return
|
|
End If
|
|
Index = Index + 1
|
|
Next
|
|
End If
|
|
' se non esiste il file allora provo a caricare il primo della lista
|
|
If File.Exists(CurrProject.AssemblyList(0).Name) Then
|
|
CurrProject.SelAssemblyName = CurrProject.AssemblyList(0)
|
|
If OptionModule.m_SingleDoor Then Map.refMainWindowVM.ProjectNameMsg = CurrProject.AssemblyList(0).Name
|
|
Else
|
|
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nNothingSelected
|
|
End If
|
|
|
|
Else
|
|
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nNothingSelected
|
|
End If
|
|
Else
|
|
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nNothingSelected
|
|
End If
|
|
End Sub
|
|
|
|
#End Region ' LastProject
|
|
|
|
#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, Path.GetFileName(IniFile.m_sDoorsDirPath))
|
|
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 "CreateTemplate"
|
|
Public ReadOnly Property CreateTemplateCommand As ICommand
|
|
Get
|
|
If m_CmdCreateTemplate Is Nothing Then
|
|
m_CmdCreateTemplate = New Command(AddressOf CreateTemplate)
|
|
End If
|
|
Return m_CmdCreateTemplate
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub CreateTemplate()
|
|
' se esite una porta, allora rendo possibile la creazione di un template della porta corrente
|
|
If Not IsNothing(Map.refPartPageVM.CurrPart) Then
|
|
' Stampo il file correte nella cartella Template
|
|
Dim SaveFileDialog As New MySaveFileDialogVM
|
|
Dim SaveFileDialogWnd As New EgtWPFLib5.SaveFileDialogV(Application.Current.MainWindow, SaveFileDialog)
|
|
SaveFileDialog.Title = EgtMsg(50417)
|
|
SaveFileDialog.Directory = IniFile.m_TemplateDir & "\"
|
|
SaveFileDialog.Extension = DDT_EXTENSION
|
|
'SaveFileDialog.FileName = m_CurrProject.Name & "\"
|
|
' se decido di chiuedere la finestra
|
|
If Not SaveFileDialogWnd.ShowDialog Then
|
|
Return
|
|
End If
|
|
' Controllo se ha estensione il nome della porta
|
|
If Path.HasExtension(SaveFileDialog.FileName) Then
|
|
Dim sExtension As String = Path.GetExtension(SaveFileDialog.FileName)
|
|
If Not sExtension.ToLower = DDT_EXTENSION Then
|
|
SaveFileDialog.FileName = SaveFileDialog.FileName.Replace(sExtension, DDT_EXTENSION)
|
|
End If
|
|
Else
|
|
SaveFileDialog.FileName &= DDT_EXTENSION
|
|
End If
|
|
If OptionModule.m_ConfigurationSoftware = ConfigType.Door Then
|
|
DdfFile.WriteDDFPart(Map.refPartPageVM.CurrPart, SaveFileDialog.FileName, False, False)
|
|
Else
|
|
DdfFile.WriteDDFAssembly(Map.refAssemblyPageVM.CurrAssembly, SaveFileDialog.FileName, False)
|
|
End If
|
|
Else
|
|
MessageBox.Show(EgtMsg(50155), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Exclamation)
|
|
End If
|
|
End Sub
|
|
|
|
#End Region ' CreateTemplate
|
|
|
|
#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)
|
|
If Not OptionModule.m_SmartHelp = HelpPage.WebBrowserPC Then GuideWindow.Show()
|
|
End Sub
|
|
|
|
#End Region ' Guide
|
|
|
|
#Region "Copy"
|
|
|
|
Public ReadOnly Property CopyCommand As ICommand
|
|
Get
|
|
If m_cmdCopy Is Nothing Then
|
|
m_cmdCopy = New Command(AddressOf CopyDDF)
|
|
End If
|
|
Return m_cmdCopy
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub CopyDDF()
|
|
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
|
|
' Do you want to copy all files ? {0} (No to copy only the current file)
|
|
Dim sMsg As String = String.Format(EgtMsg(50187), vbCrLf & vbCrLf)
|
|
' Export to machine
|
|
Dim Result = MessageBox.Show(sMsg, EgtMsg(50188), MessageBoxButton.YesNoCancel, MessageBoxImage.Question)
|
|
Dim CurrProjetc As String = Map.refAssemblyManagerVM.CurrProject.Name
|
|
Dim MachinProject As String = IniFile.m_MachinProject
|
|
If String.IsNullOrEmpty(MachinProject) Then
|
|
' Machine Directory not found
|
|
MessageBox.Show(EgtMsg(50189), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return
|
|
End If
|
|
Select Case Result
|
|
Case MessageBoxResult.Yes
|
|
For IndexFile As Integer = 0 To Map.refAssemblyManagerVM.CurrProject.AssemblyList.Count - 1
|
|
' controllo che abbia estensione ddf
|
|
If Path.GetExtension(Map.refAssemblyManagerVM.CurrProject.AssemblyList(IndexFile).Name) = ".ddf" Then
|
|
Dim SouFile As String = Map.refAssemblyManagerVM.CurrProject.AssemblyList(IndexFile).Name
|
|
Dim DestFile As String = Path.Combine(MachinProject, Path.GetFileName(SouFile))
|
|
Try
|
|
File.Copy(SouFile, DestFile, True)
|
|
Catch ex As System.IO.IOException
|
|
' Error in copying: {0}
|
|
MessageBox.Show(String.Format(EgtMsg(50189), ex.Message))
|
|
Exit For
|
|
End Try
|
|
End If
|
|
Next
|
|
Case MessageBoxResult.No
|
|
Dim SouFile As String = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name
|
|
Dim DestFile As String = Path.Combine(MachinProject, Path.GetFileName(SouFile))
|
|
Try
|
|
File.Copy(SouFile, DestFile, True)
|
|
Catch ex As System.IO.IOException
|
|
' Error in copying: {0}
|
|
MessageBox.Show(String.Format(EgtMsg(50189), ex.Message))
|
|
End Try
|
|
Case Else
|
|
End Select
|
|
End Sub
|
|
|
|
#End Region ' Copy
|
|
|
|
#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()
|
|
' questo test potrebbe essere sostituito con il controllo : If IsNothing(Map.refPartPageVM.CurrPart) Then Return
|
|
If IsNothing(Map.refAssemblyManagerVM.CurrProject) OrElse
|
|
IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) Then
|
|
' 50191 = Impossible to copy a door if there is not a door!
|
|
MessageBox.Show(EgtMsg(50191), EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning)
|
|
Return
|
|
End If
|
|
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 LocalCurrProject As New Project
|
|
LocalCurrProject = Map.refAssemblyManagerVM.CurrProject
|
|
' Creo nuovo assembly
|
|
' Lancio la finestra per chiedere il nome dell'assemblato
|
|
Dim SaveFileDialog As New MySaveFileDialogVM
|
|
Dim SaveFileDialogWnd As New EgtWPFLib5.SaveFileDialogV(Application.Current.MainWindow, SaveFileDialog)
|
|
' New Door
|
|
SaveFileDialog.Title = EgtMsg(50113)
|
|
SaveFileDialog.Directory = LocalCurrProject.Name
|
|
SaveFileDialog.Extension = DDF_EXTENSION
|
|
' Se annullo esco
|
|
If Not SaveFileDialogWnd.ShowDialog Then Return
|
|
' Controllo se il nome della porta ha estensione
|
|
If Path.HasExtension(SaveFileDialog.FileName) Then
|
|
Dim sExtension As String = Path.GetExtension(SaveFileDialog.FileName)
|
|
If Not sExtension.ToLower = DDF_EXTENSION Then
|
|
SaveFileDialog.FileName = SaveFileDialog.FileName.Replace(sExtension, DDF_EXTENSION)
|
|
End If
|
|
Else
|
|
SaveFileDialog.FileName &= DDF_EXTENSION
|
|
End If
|
|
' controllo che il nome non sia presente nella lista degli assemblati
|
|
Dim bNameExist As Boolean = False
|
|
Dim IndexDoorList As Integer
|
|
For IndexDoorList = 0 To LocalCurrProject.AssemblyList.Count - 1
|
|
If LocalCurrProject.AssemblyList(IndexDoorList).Name = SaveFileDialog.FileName Then
|
|
' se il nome è nella lista allora esco dal ciclo e rendo falsa la variabile bNameExist
|
|
bNameExist = True
|
|
Exit For
|
|
End If
|
|
bNameExist = False
|
|
Next
|
|
' se il nome è nella lista allora sovrascrivo la porta esistente
|
|
If bNameExist Then
|
|
' elimino la porta esistente
|
|
If File.Exists(SaveFileDialog.FileName) Then
|
|
Try
|
|
File.Delete(SaveFileDialog.FileName)
|
|
Catch ex As FileNotFoundException
|
|
' non è un problema
|
|
Catch ex As Exception
|
|
' non è un problema
|
|
End Try
|
|
End If
|
|
' elimino dalla lista
|
|
LocalCurrProject.AssemblyList.RemoveAt(IndexDoorList)
|
|
' ''CurrProject.NotifyPropertyChanged("AssemblyList")
|
|
End If
|
|
' aggiungo il nome del file alla lista degli assemblati
|
|
Dim Local_AssemblyName As New AssemblyName
|
|
Local_AssemblyName.Name = SaveFileDialog.FileName
|
|
LocalCurrProject.AssemblyList.Add(Local_AssemblyName)
|
|
' Seleziono AssembyName creato
|
|
Try
|
|
File.Copy(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name, Local_AssemblyName.Name, True)
|
|
Catch ex As System.IO.IOException
|
|
' Error in copying: {0}
|
|
MessageBox.Show(String.Format(EgtMsg(50190), ex.Message))
|
|
' interrompo la copia e la creazione del nuovo file
|
|
File.Delete(Local_AssemblyName.Name)
|
|
Return
|
|
End Try
|
|
LocalCurrProject.SelAssemblyName = Local_AssemblyName
|
|
Map.refAssemblyManagerVM.Save(LocalCurrProject.SelAssemblyName)
|
|
Map.refAssemblyManagerVM.Open(LocalCurrProject.AssemblyList(LocalCurrProject.AssemblyList.Count - 1))
|
|
End Sub
|
|
|
|
|
|
#End Region ' Duplica
|
|
|
|
#Region "Reload"
|
|
|
|
Public ReadOnly Property RefreshDirCommand As ICommand
|
|
Get
|
|
If m_cmdRefreshDir Is Nothing Then
|
|
m_cmdRefreshDir = New Command(AddressOf RefreshDir)
|
|
End If
|
|
Return m_cmdRefreshDir
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub RefreshDir()
|
|
|
|
End Sub
|
|
|
|
|
|
#End Region ' Reload
|
|
|
|
#Region "Hardware"
|
|
|
|
Public ReadOnly Property HardwareCommand As ICommand
|
|
Get
|
|
If m_cmdHardware Is Nothing Then
|
|
m_cmdHardware = New Command(AddressOf GoToHardwarePage)
|
|
End If
|
|
Return m_cmdHardware
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub GoToHardwarePage()
|
|
' se decido di annullare l'operazione di salvataggio
|
|
If Not Map.refAssemblyManagerVM.ManageModified() Then Return
|
|
' prima di continuare salvo il riferimento all'ultima cartella aperta
|
|
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nHardwarePage
|
|
' nascondo la visibilità del bottone goback dalla lista dei bottoni
|
|
Map.refCompoPanelHardwareVM.GoBackVisibility = Visibility.Collapsed
|
|
Map.refHardwarePageVM.VisibilityGeneral = Visibility.Collapsed
|
|
' disabilito DimensioningPanel
|
|
Map.refDimensioningPanelVM.SetDimensioningPanel_Visibility(False)
|
|
' creo una porta per il disegno dell'Hardware
|
|
Map.refHardwarePageVM.CreateDoor()
|
|
' creo un pezzo di telaio per il disegno dell'hardware
|
|
Map.refHardwarePageVM.CreateJamb()
|
|
Map.refSceneManagerVM.RefreshBtn()
|
|
' carico la lista dei nomi delle geometrie
|
|
CompoMatch.LoadTableGeometry()
|
|
Map.refHardwareHelpSceneHostV.CleanHelpProject()
|
|
Map.refRefreshPanelVM.ButtonVisibility = Visibility.Collapsed
|
|
End Sub
|
|
|
|
|
|
#End Region ' Hardware
|
|
|
|
#Region "PrintCommand"
|
|
|
|
Public ReadOnly Property PrintCommand As ICommand
|
|
Get
|
|
If m_cmdPrint Is Nothing Then
|
|
m_cmdPrint = New Command(AddressOf Print)
|
|
End If
|
|
Return m_cmdPrint
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub Print(ByVal param As Object)
|
|
' questo test potrebbe essere sostituito con il controllo : If IsNothing(Map.refPartPageVM.CurrPart) Then Return
|
|
If IsNothing(Map.refAssemblyManagerVM.CurrProject) OrElse
|
|
IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) Then
|
|
' 50193 = Impossible to print a door if there is not a door!
|
|
MessageBox.Show(EgtMsg(50193), EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning)
|
|
Return
|
|
End If
|
|
If Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified() Then
|
|
' Project must be saved before printing
|
|
MessageBox.Show(EgtMsg(50186), EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning)
|
|
Return
|
|
End If
|
|
Dim PrintWindow As New PrintWndV(Application.Current.MainWindow, New PrintWndVM)
|
|
PrintWindow.Height = 550
|
|
PrintWindow.Width = 650
|
|
PrintWindow.ShowDialog()
|
|
End Sub
|
|
|
|
#End Region ' PrintCommand
|
|
|
|
#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 |