a4b5cd4834
- Cambiati nomi classi e file.
151 lines
5.2 KiB
VB.net
151 lines
5.2 KiB
VB.net
Imports System.Collections.ObjectModel
|
|
Imports EgtUILib
|
|
|
|
Namespace EgtCAM5
|
|
|
|
Public Class DoorPanelVM
|
|
Inherits ViewModelBase
|
|
|
|
Public ReadOnly Property MruDoorNames As ObservableCollection(Of String)
|
|
Get
|
|
Return IniFile.m_MruDoors.m_FileNames
|
|
End Get
|
|
End Property
|
|
|
|
' Definizione comandi
|
|
Private m_cmdDoors As ICommand
|
|
Private m_cmdDMach As ICommand
|
|
Private Shared m_cmdOpenMruDoor As ICommand
|
|
Private m_cmdMTableDb As ICommand
|
|
|
|
#Region "COMMANDS"
|
|
|
|
#Region "DoorsCommand"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do Import.
|
|
''' </summary>
|
|
Public ReadOnly Property DoorsCommand As ICommand
|
|
Get
|
|
If m_cmdDoors Is Nothing Then
|
|
m_cmdDoors = New RelayCommand(AddressOf Doors)
|
|
End If
|
|
Return m_cmdDoors
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the Door. This method is invoked by the DoorsCommand.
|
|
''' </summary>
|
|
Public Sub Doors(ByVal param As Object)
|
|
Application.Msn.NotifyColleagues(Application.DOORSSCRIPT, String.Empty)
|
|
End Sub
|
|
|
|
#End Region ' DoorsCommand
|
|
|
|
#Region "OpenMruDoorCommand"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do Open.
|
|
''' </summary>
|
|
Public Shared ReadOnly Property OpenMruDoorCommand As ICommand
|
|
Get
|
|
If m_cmdOpenMruDoor Is Nothing Then
|
|
m_cmdOpenMruDoor = New RelayCommand(AddressOf OpenMruDoor)
|
|
End If
|
|
Return m_cmdOpenMruDoor
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the Open. This method is invoked by the OpenCommand.
|
|
''' </summary>
|
|
Public Shared Sub OpenMruDoor(ByVal param As Object)
|
|
Application.Msn.NotifyColleagues(Application.DOORSSCRIPT, DirectCast(param, String).Replace("__", "_"))
|
|
End Sub
|
|
|
|
#End Region ' OpenMruFileCommand
|
|
|
|
#Region "DMachCommand"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do Import.
|
|
''' </summary>
|
|
Public ReadOnly Property DMachCommand As ICommand
|
|
Get
|
|
If m_cmdDMach Is Nothing Then
|
|
m_cmdDMach = New RelayCommand(AddressOf DMach)
|
|
End If
|
|
Return m_cmdDMach
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the Dmach. This method is invoked by the DMachCommand.
|
|
''' </summary>
|
|
Public Sub DMach(ByVal param As Object)
|
|
Application.Msn.NotifyColleagues(Application.DMACHSCRIPT)
|
|
End Sub
|
|
|
|
#End Region ' DMachCommand
|
|
|
|
#Region "MTableDbCommand"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do Exec.
|
|
''' </summary>
|
|
Public ReadOnly Property MTableDbCommand As ICommand
|
|
Get
|
|
If m_cmdMTableDb Is Nothing Then
|
|
m_cmdMTableDb = New RelayCommand(AddressOf MTableDb)
|
|
End If
|
|
Return m_cmdMTableDb
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the Exec. This method is invoked by the ExecCommand.
|
|
''' </summary>
|
|
Public Sub MTableDb(ByVal param As Object)
|
|
' Leggo dal file ini il direttorio delle MTable
|
|
Dim sTablesDir As String = String.Empty
|
|
If GetPrivateProfileString(S_DOORS, K_TABLESDIR, "", sTablesDir) = 0 Then
|
|
' Se non lo trovo mando messaggio di errore e chiudo la finestra
|
|
MessageBox.Show(EgtMsg(MSG_DOORSERRORS + 4), EgtMsg(MSG_DOORSERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return
|
|
End If
|
|
IniFile.m_sTablesRoot = IniFile.m_sDoorsDirPath & "\" & sTablesDir
|
|
' Verifico che la cartella indicata esista
|
|
If Not My.Computer.FileSystem.DirectoryExists(IniFile.m_sTablesRoot) Then
|
|
' Se non la trovo mando messaggio di errore e chiudo la finestra
|
|
MessageBox.Show(EgtMsg(MSG_DOORSERRORS + 5), EgtMsg(MSG_DOORSERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return
|
|
End If
|
|
' Verifico che ci sia il file ini per scrivere le tabelle
|
|
If Not My.Computer.FileSystem.FileExists(IniFile.m_sTablesRoot & "\" & MTABLETEMPLATE_FILE) OrElse Not My.Computer.FileSystem.FileExists(IniFile.m_sTablesRoot & "\" & GEONAMELIST_FILE) _
|
|
OrElse Not My.Computer.FileSystem.FileExists(IniFile.m_sTablesRoot & "\" & OPERATIONLIST_FILE) Then
|
|
' Se non la trovo mando messaggio di errore e chiudo la finestra
|
|
MessageBox.Show(EgtMsg(MSG_DOORSERRORS + 6), EgtMsg(MSG_DOORSERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return
|
|
End If
|
|
' verifico
|
|
If Not EgtVerifyMachinesDir() Then Return
|
|
|
|
Dim MTableDb As New MTableDbV(Application.Current.MainWindow, New MTableDbVM)
|
|
MTableDb.ShowDialog()
|
|
|
|
'Dim MTableDbWindow As New MTableDbView
|
|
'MTableDbWindow.Height = 614
|
|
'MTableDbWindow.Width = 1024
|
|
'MTableDbWindow.DataContext = New MTableDbViewModel
|
|
'MTableDbWindow.Owner = Application.Current.MainWindow
|
|
'MTableDbWindow.ShowDialog()
|
|
End Sub
|
|
|
|
#End Region ' MTableDbCommand
|
|
|
|
#End Region
|
|
|
|
End Class
|
|
|
|
End Namespace |