diff --git a/Constants/ConstMsg.vb b/Constants/ConstMsg.vb
index 6add164..cf82c97 100644
--- a/Constants/ConstMsg.vb
+++ b/Constants/ConstMsg.vb
@@ -19,6 +19,7 @@
Public Const MSG_SETUP As Integer = MSG_EGTCAM5 + 1450
Public Const MSG_SETUPERRORS As Integer = MSG_EGTCAM5 + 1470
Public Const MSG_OPTIONPAGE As Integer = MSG_EGTCAM5 + 1500
+ Public Const MSG_STATUSBAR As Integer = MSG_EGTCAM5 + 1800
Public Const MSG_DOORS As Integer = MSG_EGTCAM5 + 3000
Public Const MSG_DOORSERRORS As Integer = MSG_EGTCAM5 + 3100
Public Const MSG_GUNSTOCK As Integer = MSG_EGTCAM5 + 3200
diff --git a/IniFile.vb b/IniFile.vb
index 157d2e4..e98d516 100644
--- a/IniFile.vb
+++ b/IniFile.vb
@@ -16,6 +16,7 @@ Public Module IniFile
Friend Enum ProjectModeOpt As Integer
DRAW = 1
MACHINING = 2
+ ONLYDRAW = 3
End Enum
Public Enum SceneSelModeOpt As Integer
@@ -92,6 +93,8 @@ Public Module IniFile
Friend m_ToolsDbSceneContext As Integer = 0
' Variabile che dice se sono abilitati i gruppi di lavorazione
Friend m_bMachiningGroup As Boolean
+ ' Variabile che indica se il programma e' riuscito ad avviarsi
+ Friend m_bFailedRun As Boolean
Public Function GetPrivateProfileInt(IpAppName As String, IpKeyName As String, nDefault As Integer) As Integer
Return EgtUILib.GetPrivateProfileInt(IpAppName, IpKeyName, nDefault, m_sIniFile)
diff --git a/MainWindow/MainWindowViewModel.vb b/MainWindow/MainWindowViewModel.vb
index dbce3f2..cc6596e 100644
--- a/MainWindow/MainWindowViewModel.vb
+++ b/MainWindow/MainWindowViewModel.vb
@@ -126,7 +126,7 @@ Namespace EgtCAM5
Public ReadOnly Property CloseApplicationCommand() As ICommand
Get
If m_cmdCloseApplication Is Nothing Then
- m_cmdCloseApplication = New RelayCommand(AddressOf CloseApplication, AddressOf CanCloseApplication)
+ m_cmdCloseApplication = New RelayCommand(AddressOf CloseApplication)
End If
Return m_cmdCloseApplication
End Get
@@ -136,6 +136,12 @@ Namespace EgtCAM5
''' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
'''
Public Sub CloseApplication(ByVal param As Object)
+ If m_bScriptRunning Then
+ If Not IniFile.m_bFailedRun Then
+ 'MessageBox.Show("Can't exit now. Wait until the end of the script execution", "", MessageBoxButton.OK, MessageBoxImage.Stop)
+ Return
+ End If
+ End If
'' Gestisco eventuale file corrente modificato
Application.Msn.NotifyColleagues(Application.MANAGEMODIFIED)
If m_allowWindowToClose Then
@@ -162,19 +168,6 @@ Namespace EgtCAM5
End If
End Sub
- '''
- ''' Returns true if the application can be closed
- '''
- Private Function CanCloseApplication(ByVal param As Object) As Boolean
- '' Impedisco uscita se script in esecuzione
- 'If m_bScriptRunning Then
- ' m_bStopScript = True
- ' E.Cancel = True
- ' Return
- 'End If
- Return True
- End Function
-
#End Region ' CloseApplicationCommand
#Region "cmdMainWindow_ContentRendered"
@@ -197,6 +190,10 @@ Namespace EgtCAM5
Public Sub MainWindow_ContentRendered(ByVal param As Object)
' Notify the ContentRendered event
Application.Msn.NotifyColleagues(Application.MAINWINDOW_CONTENTRENDERED)
+ ' se sono in modalità solo cad
+ If IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then
+ Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, "Impossible finding Machines dir. EgtCAM5 will run in CAD-ONLY mode.")
+ End If
End Sub
#End Region ' ContentRendered Command
@@ -369,6 +366,8 @@ Namespace EgtCAM5
EgtLuaRequire(sLuaBaseLib)
' imposto IniFile a EgtInterface
EgtSetIniFile(m_sIniFile)
+ ' verifico se avviare programma in modalità CAD-ONLY
+ IniFile.m_ProjectMode = If(GetPrivateProfileInt(S_GENERAL, K_ONLYDRAW, 0) = 0, ProjectModeOpt.DRAW, ProjectModeOpt.ONLYDRAW)
' Impostazioni MruLists
m_MruFiles.Init(S_MRUFILES, 8)
m_MruScripts.Init(S_MRUSCRIPTS, 8)
diff --git a/ProjectPage/DrawPanel/DrawPanelViewModel.vb b/ProjectPage/DrawPanel/DrawPanelViewModel.vb
index 1627632..3c91fb3 100644
--- a/ProjectPage/DrawPanel/DrawPanelViewModel.vb
+++ b/ProjectPage/DrawPanel/DrawPanelViewModel.vb
@@ -397,10 +397,12 @@ Namespace EgtCAM5
ModifyIsExpanded = If(GetPrivateProfileInt(S_GENERAL, K_MODIFY, 0) = 0, False, True)
TransformIsExpanded = If(GetPrivateProfileInt(S_GENERAL, K_TRANSFORM, 0) = 0, False, True)
Application.Msn.Register(Application.CLOSEAPPLICATION, Sub()
- WritePrivateProfileString(S_GENERAL, K_DRAW2D, If(m_Draw2DIsExpanded, "1", "0"))
- WritePrivateProfileString(S_GENERAL, K_DRAW3D, If(m_Draw3DIsExpanded, "1", "0"))
- WritePrivateProfileString(S_GENERAL, K_MODIFY, If(m_ModifyIsExpanded, "1", "0"))
- WritePrivateProfileString(S_GENERAL, K_TRANSFORM, If(m_TransformIsExpanded, "1", "0"))
+ If Not IniFile.m_bFailedRun Then
+ WritePrivateProfileString(S_GENERAL, K_DRAW2D, If(m_Draw2DIsExpanded, "1", "0"))
+ WritePrivateProfileString(S_GENERAL, K_DRAW3D, If(m_Draw3DIsExpanded, "1", "0"))
+ WritePrivateProfileString(S_GENERAL, K_MODIFY, If(m_ModifyIsExpanded, "1", "0"))
+ WritePrivateProfileString(S_GENERAL, K_TRANSFORM, If(m_TransformIsExpanded, "1", "0"))
+ End If
End Sub)
Application.Msn.Register(Application.SETCURRLAYER, Sub(CurrLayer As Integer)
@@ -1409,7 +1411,7 @@ Namespace EgtCAM5
#End Region ' Commands
Private Sub OnIdle()
- If IniFile.m_ProjectMode = ProjectModeOpt.DRAW Then
+ If IniFile.m_ProjectMode = ProjectModeOpt.DRAW OrElse IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then
Application.Msn.NotifyColleagues(Application.GETCURRLAYER)
bLayerOk = m_CurrentLayer <> GDB_ID.NULL
If Not IniFile.m_ProjectSceneContext = 0 Then
diff --git a/ProjectPage/ProjectView.xaml.vb b/ProjectPage/ProjectView.xaml.vb
index 1607cec..02a7914 100644
--- a/ProjectPage/ProjectView.xaml.vb
+++ b/ProjectPage/ProjectView.xaml.vb
@@ -63,7 +63,7 @@ Public Class ProjectView
ViewPanel.Visibility = Visibility.Visible
InstrumentPanel.Visibility = Visibility.Visible
GridPanel.Visibility = Visibility.Visible
- DbPanel.Visibility = Visibility.Visible
+ DbPanel.Visibility = If(IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW, Visibility.Collapsed, Visibility.Visible)
ExecutePanel.Visibility = Visibility.Visible
SpecialPanel.Visibility = If(m_bSpecial, Visibility.Visible, Visibility.Collapsed)
DoorsPanel.Visibility = If(m_bDoors, Visibility.Visible, Visibility.Collapsed)
diff --git a/ProjectPage/ProjectViewModel.vb b/ProjectPage/ProjectViewModel.vb
index 1dde185..4e6fc9c 100644
--- a/ProjectPage/ProjectViewModel.vb
+++ b/ProjectPage/ProjectViewModel.vb
@@ -139,11 +139,13 @@ Namespace EgtCAM5
' Box di avviso chiave mancante
MsgBox(EgtMsg(MSG_MISSINGKEYWD + 2) & vbCrLf & EgtMsg(MSG_MISSINGKEYWD + 3), MsgBoxStyle.OkOnly, EgtMsg(MSG_MISSINGKEYWD + 1))
' Chiudo il programma
+ IniFile.m_bFailedRun = True
Application.Msn.NotifyColleagues(Application.CLOSEAPPLICATIONCOMMAND)
' Verifico abilitazione prodotto
ElseIf (IniFile.m_nKeyOptions And KEY_OPT.BASE) = 0 Then
MsgBox(EgtMsg(MSG_MISSINGKEYWD + 5), MsgBoxStyle.OkOnly, EgtMsg(MSG_MISSINGKEYWD + 1))
' Chiudo il programma
+ IniFile.m_bFailedRun = True
Application.Msn.NotifyColleagues(Application.CLOSEAPPLICATIONCOMMAND)
Else
IniFile.m_ProjectSceneContext = m_ProjectScene.GetCtx
@@ -792,18 +794,20 @@ Namespace EgtCAM5
Private Sub ManageClosingApplication()
Application.Msn.Register(Application.CLOSEAPPLICATION, Sub()
- ' Salvo modo di visualizzazione
- WritePrivateProfileString(S_SCENE, K_SHOWMODE, EgtGetShowMode().ToString)
- ' Salvo stato visualizzazione direzione curve
- WritePrivateProfileString(S_SCENE, K_CURVEDIR, If(EgtGetShowCurveDirection(), 1, 0).ToString)
- ' Salvo stato visualizzazione griglia
- WritePrivateProfileString(S_GRID, K_DRAWSHOWGRID, If(IniFile.m_bDrawShowGrid, 1, 0).ToString)
- WritePrivateProfileString(S_GRID, K_MACHININGSHOWGRID, If(IniFile.m_bMachiningShowGrid, 1, 0).ToString)
- ' Salvo stato unità di misura per interfaccia utente
- WritePrivateProfileString(S_SCENE, K_MMUNITS, If(IniFile.m_bMmUnits, 1, 0).ToString)
- ' Salvo dimensioni griglie in Mm e Inch
- WritePrivateProfileString(S_GRID, K_SNAPSTEP, DoubleToString(IniFile.dSnapStepMm, 4))
- WritePrivateProfileString(S_GRID, K_SNAPSTEPINCH, DoubleToString(IniFile.dSnapStepInch, 4))
+ If Not IniFile.m_bFailedRun Then
+ ' Salvo modo di visualizzazione
+ WritePrivateProfileString(S_SCENE, K_SHOWMODE, EgtGetShowMode().ToString)
+ ' Salvo stato visualizzazione direzione curve
+ WritePrivateProfileString(S_SCENE, K_CURVEDIR, If(EgtGetShowCurveDirection(), 1, 0).ToString)
+ ' Salvo stato visualizzazione griglia
+ WritePrivateProfileString(S_GRID, K_DRAWSHOWGRID, If(IniFile.m_bDrawShowGrid, 1, 0).ToString)
+ WritePrivateProfileString(S_GRID, K_MACHININGSHOWGRID, If(IniFile.m_bMachiningShowGrid, 1, 0).ToString)
+ ' Salvo stato unità di misura per interfaccia utente
+ WritePrivateProfileString(S_SCENE, K_MMUNITS, If(IniFile.m_bMmUnits, 1, 0).ToString)
+ ' Salvo dimensioni griglie in Mm e Inch
+ WritePrivateProfileString(S_GRID, K_SNAPSTEP, DoubleToString(IniFile.dSnapStepMm, 4))
+ WritePrivateProfileString(S_GRID, K_SNAPSTEPINCH, DoubleToString(IniFile.dSnapStepInch, 4))
+ End If
End Sub)
End Sub
@@ -824,7 +828,7 @@ Namespace EgtCAM5
Private Sub OnMouseSelectedAll(ByVal sender As Object) Handles m_ProjectScene.OnMouseSelectedAll
' Se in modalità Draw seleziono tutto
- If IniFile.m_ProjectMode = ProjectModeOpt.DRAW Then
+ If IniFile.m_ProjectMode = ProjectModeOpt.DRAW OrElse IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then
m_Controller.MouseSelectedAll()
Return
End If
@@ -892,7 +896,7 @@ Namespace EgtCAM5
Private Sub OnMouseDeselectedAll(ByVal sender As Object) Handles m_ProjectScene.OnMouseDeselectedAll
' Se in modalità Draw seleziono tutto
- If IniFile.m_ProjectMode = ProjectModeOpt.DRAW Then
+ If IniFile.m_ProjectMode = ProjectModeOpt.DRAW OrElse IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then
m_Controller.MouseDeselectedAll()
Return
End If
@@ -925,7 +929,7 @@ Namespace EgtCAM5
Private Sub OnMouseDown(ByVal sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles m_ProjectScene.OnMouseDownScene
' Se in modalità Draw accetto tutto
- If IniFile.m_ProjectMode = ProjectModeOpt.DRAW Then Return
+ If IniFile.m_ProjectMode = ProjectModeOpt.DRAW OrElse IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then Return
' Sono in modalità Machining
' se non posso selezionare nulla o in lavorazione esco
If m_SceneSelType = SceneSelTypeOpt.NULL OrElse m_SceneSelType = SceneSelTypeOpt.MACHINING Then Return
@@ -981,7 +985,7 @@ Namespace EgtCAM5
Private Sub OnMyMouseMoveScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles m_ProjectScene.OnMouseMoveScene
' Se in modalità Draw esco
- If IniFile.m_ProjectMode = ProjectModeOpt.DRAW Then
+ If IniFile.m_ProjectMode = ProjectModeOpt.DRAW OrElse IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then
If bEnhancedSelIsActive Then
EnhancedMouseMoveScene(e)
End If
@@ -1195,7 +1199,7 @@ Namespace EgtCAM5
Private Sub OnMyMouseUpScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles m_ProjectScene.OnMouseUpScene
' Se in modalità Draw esco
- If IniFile.m_ProjectMode = ProjectModeOpt.DRAW Then
+ If IniFile.m_ProjectMode = ProjectModeOpt.DRAW OrElse IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then
If bEnhancedSelIsActive Then
EnhancedMouseUpScene(e)
End If
@@ -1281,7 +1285,7 @@ Namespace EgtCAM5
' Se oggetto già rifiutato non faccio le verifiche
If Not bOk Then Return
' Se in modalità Draw accetto tutto
- If IniFile.m_ProjectMode = ProjectModeOpt.DRAW Then
+ If IniFile.m_ProjectMode = ProjectModeOpt.DRAW OrElse IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then
' Se attiva enhanced selection rifiuto tutto
If bEnhancedSelIsActive Then
bOk = False
diff --git a/StatusBar/StatusBarViewModel.vb b/StatusBar/StatusBarViewModel.vb
index c9401b9..8bf23a6 100644
--- a/StatusBar/StatusBarViewModel.vb
+++ b/StatusBar/StatusBarViewModel.vb
@@ -253,6 +253,9 @@ Namespace EgtCAM5
Else
GridDimensionText = LenToString(IniFile.dSnapStepInch, 4)
End If
+ If IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then
+ MachineListIsEnabled = False
+ End If
End Sub)
Application.Msn.Register(Application.MACHININGMODE_ISCHECKED, Sub()
StatusOutput = String.Empty
@@ -339,7 +342,7 @@ Namespace EgtCAM5
Public ReadOnly Property StatusGridCommand As ICommand
Get
If m_cmdStatusGrid Is Nothing Then
- m_cmdStatusGrid = New RelayCommand(AddressOf StatusGrid, AddressOf CanStatusGrid)
+ m_cmdStatusGrid = New RelayCommand(AddressOf StatusGrid)
End If
Return m_cmdStatusGrid
End Get
@@ -350,7 +353,7 @@ Namespace EgtCAM5
'''
Public Sub StatusGrid(ByVal param As Object)
Dim bGridState As Boolean
- If IniFile.m_ProjectMode = ProjectModeOpt.DRAW Then
+ If IniFile.m_ProjectMode = ProjectModeOpt.DRAW OrElse IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then
IniFile.m_bDrawShowGrid = Not IniFile.m_bDrawShowGrid
bGridState = m_bDrawShowGrid
ElseIf IniFile.m_ProjectMode = ProjectModeOpt.MACHINING Then
@@ -361,13 +364,6 @@ Namespace EgtCAM5
EgtDraw()
End Sub
- '''
- ''' Returns always true.
- '''
- Private Function CanStatusGrid(ByVal param As Object) As Boolean
- Return True
- End Function
-
#End Region ' StatusGridCommand
#Region "CurrPosTypeCommand"
@@ -378,7 +374,7 @@ Namespace EgtCAM5
Public ReadOnly Property CurrPosTypeCommand As ICommand
Get
If m_cmdCurrPosType Is Nothing Then
- m_cmdCurrPosType = New RelayCommand(AddressOf CurrPosType, AddressOf CanCurrPosType)
+ m_cmdCurrPosType = New RelayCommand(AddressOf CurrPosType)
End If
Return m_cmdCurrPosType
End Get
@@ -391,13 +387,6 @@ Namespace EgtCAM5
Application.Msn.NotifyColleagues(Application.STATUSCURRPOSTYPECOMMAND)
End Sub
- '''
- ''' Returns always true.
- '''
- Private Function CanCurrPosType(ByVal param As Object) As Boolean
- Return True
- End Function
-
#End Region ' CurrPosTypeCommand
#Region "StatusUnitsCommand"
@@ -436,7 +425,7 @@ Namespace EgtCAM5
Public ReadOnly Property StatusStopCommand As ICommand
Get
If m_cmdStatusStop Is Nothing Then
- m_cmdStatusStop = New RelayCommand(AddressOf StatusStop, AddressOf CanStatusStop)
+ m_cmdStatusStop = New RelayCommand(AddressOf StatusStop)
End If
Return m_cmdStatusStop
End Get
@@ -449,13 +438,6 @@ Namespace EgtCAM5
m_bStopScript = True
End Sub
- '''
- ''' Returns always true.
- '''
- Private Function CanStatusStop(ByVal param As Object) As Boolean
- Return True
- End Function
-
#End Region ' StatusStopCommand
#Region "ClearStatusOutputCommand"
@@ -497,7 +479,11 @@ Namespace EgtCAM5
Private Sub SearchMachine()
' Se direttorio base macchine non definito o non esiste, ritorno
If String.IsNullOrWhiteSpace(IniFile.m_sMachinesRoot) Or
- Not Directory.Exists(IniFile.m_sMachinesRoot) Then Return
+ Not Directory.Exists(IniFile.m_sMachinesRoot) Then
+ IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW
+ EgtOutLog(EgtMsg(MSG_STATUSBAR + 1))
+ Return
+ End If
' Cerco le macchine
Dim TempArray As String() = Directory.GetDirectories(IniFile.m_sMachinesRoot)
For i As Integer = 0 To TempArray.Count - 1
diff --git a/TopCommandBar/TopCommandBarView.xaml b/TopCommandBar/TopCommandBarView.xaml
index 37ea0db..a8748dd 100644
--- a/TopCommandBar/TopCommandBarView.xaml
+++ b/TopCommandBar/TopCommandBarView.xaml
@@ -41,8 +41,10 @@
-
-
+
+
diff --git a/TopCommandBar/TopCommandBarViewModel.vb b/TopCommandBar/TopCommandBarViewModel.vb
index 345c5f5..4d639e9 100644
--- a/TopCommandBar/TopCommandBarViewModel.vb
+++ b/TopCommandBar/TopCommandBarViewModel.vb
@@ -133,6 +133,17 @@ Namespace EgtCAM5
End Set
End Property
+ Private m_MachiningIsEnabled As Boolean
+ Public Property MachiningIsEnabled As Boolean
+ Get
+ Return m_MachiningIsEnabled
+ End Get
+ Set(value As Boolean)
+ m_MachiningIsEnabled = value
+ OnPropertyChanged("MachiningIsEnabled")
+ End Set
+ End Property
+
#End Region ' Fields & Properties
#Region "CONSTRUCTOR"
@@ -157,6 +168,14 @@ Namespace EgtCAM5
MessageBox.Show(EgtMsg(10008), EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error)
End If
End Sub)
+ Application.Msn.Register(Application.MAINWINDOW_CONTENTRENDERED, Sub()
+ If IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then
+ MachiningIsEnabled = False
+ Else
+ MachiningIsEnabled = True
+ End If
+ End Sub)
+
End Sub
#End Region