Imports System.Windows.Forms.Integration Imports System.IO Imports EgtUILib Namespace EgtCAM5 Public Class ProjectViewModel Inherits TabViewModel #Region "FIELDS" 'PROJECT PAGE'S PANELS Private m_GridViewPanel As BaseWindowView Private m_DrawPanel As BaseWindowView Private m_DrawOptionPanel As BaseWindowView 'PROJECT PAGE'S SCENE FIELDS AND PROPERTIES ' Reference to the ProjectScene Private WithEvents m_ProjectScene As New Scene ' Reference to the ProjectSceneHost Private SceneHost As WindowsFormsHost ' Property used to bind the scene to the WindowsFormsHost in XAML Private m_bfirst As Boolean = True Public ReadOnly Property ProjectSceneHost As WindowsFormsHost Get If m_bfirst Then SceneHost = New WindowsFormsHost() With {.Child = m_ProjectScene} If Not m_ProjectScene.Init() Then EgtOutLog("Error in Project scene creation") ' Chiudo il programma Application.Msn.NotifyColleagues(Application.CLOSEAPPLICATION) End If IniFile.m_ProjectSceneContext = m_ProjectScene.GetCtx InitializeEgtProject() ' inizializzo gestore lavorazioni EgtInitMachMgr(IniFile.m_sMachinesRoot) EgtOpenFile("c:\EgtData\Varie\Temp\Fiera02.Nge") EgtZoom(ZM.ALL) m_bfirst = False End If Return SceneHost End Get End Property ' Scene controller Private WithEvents m_Controller As New Controller #End Region #Region "EGTUILIB FIELDS" Private m_bShowGrid As Boolean Private m_bShowGridFrame As Boolean 'Private m_bCPlaneTypePos As Boolean Private m_bMmUnits As Boolean 'Private WithEvents m_Controller As New Controller 'Private m_MruFiles As New MruList 'Private m_MruScripts As New MruList Private m_bScriptRunning As Boolean = False 'Private m_bStopExec As Boolean = False 'Private m_ProcEventsCallback As New ProcessEventsCallback(AddressOf ProcessEvents) 'Private m_OutTextCallback As New OutTextCallback(AddressOf OutText) ' Variabile per implementazione eventi Private m_InputText As String #End Region #Region "CONSTRUCTOR" Sub New() Me.sTabName = EgtMsg(MSG_MAINWINDOW + 1) m_GridViewPanel = New BaseWindowView m_GridViewPanel.DataContext = New GridViewPanelViewModel m_GridViewPanel.Show() m_DrawPanel = New BaseWindowView m_DrawPanel.DataContext = New DrawPanelViewModel m_DrawPanel.Show() m_DrawOptionPanel = New BaseWindowView m_DrawOptionPanel.DataContext = New DrawOptionPanelViewModel m_DrawOptionPanel.Show() ' Funzione che contiene la registrazione alle funzioni che permettono di visualizzare e nascondere le finestre di disegno ManagePanelVisibility() ' Inizializza i parametri della scena 'InitializeEgtProject() ' Funzione che contiene la registrazione di tutti le funzioni del DrawPanel RegisterDrawPanelCommands() ' Funzione che contiene la registrazione di tutti i comandi del DrawOptionPanel RegisterDrawOptionPanelCommands() ' Funzione che contiene la registrazione di tutti i comandi della StatusBar RegisterStatusBarCommands() End Sub #End Region #Region "METHODS" Private Sub InitializeEgtProject() 'Impostazioni Controller m_Controller.SetScene(m_ProjectScene) 'Dim bLuaReg As Boolean = (GetPrivateProfileInt(S_GENERAL, K_COMMANDLOG, 0, m_sIniFile) <> 0) 'Dim sCmdLogFile As String = CMDLOG_FILE_NAME.Replace("#", m_nInstance.ToString()) 'If Not m_Controller.SetCommandLog(bLuaReg, m_sTempDir, sCmdLogFile) Then ' EgtOutLog("Command log not started") ' 'If My.Application.CommandLineArgs.Count() = 0 Then ' ' MessageBox.Show("Command log not started", "TestEIn Warning", ' ' MessageBoxButtons.OK, MessageBoxIcon.Warning) ' 'End If 'End If '' imposto unità di misura per interfaccia utente 'm_bMmUnits = (GetPrivateProfileInt(S_SCENE, K_MMUNITS, 1, m_sIniFile) <> 0) 'UpdateStatusUnits() '' imposto visualizzazione riferimento globale 'Dim bShowGlobFrame As Boolean = (GetPrivateProfileInt(S_SCENE, K_SHOWGFRAME, 1, m_sIniFile) <> 0) 'EgtSetGlobFrameShow(bShowGlobFrame) ' imposto i dati della griglia LoadGridData() ' imposto stato di visualizzazione della griglia m_bShowGrid = (GetPrivateProfileInt(S_GRID, K_SHOWGRID, 1) <> 0) m_bShowGridFrame = (GetPrivateProfileInt(S_GRID, K_SHOWFRAME, 1) <> 0) Application.Msn.NotifyColleagues(Application.UPDATESTATUSGRID, New UpdateStatusGridParam(m_bShowGrid, m_bShowGridFrame)) '' imposto tipo coordinate 'm_bCPlaneTypePos = True 'Scene1.SetGridCursorPos(m_bCPlaneTypePos) '' modo di visualizzazione 'Dim nShowMode As Integer = GetPrivateProfileInt(S_SCENE, K_SHOWMODE, SM.SHADING, m_sIniFile) 'If nShowMode = SM.WIREFRAME Then ' btnWireFrame.Checked = True 'ElseIf nShowMode = SM.HIDDENLINE Then ' btnHiddenLine.Checked = True 'Else ' btnShading.Checked = True 'End If '' visualizzazione direzione curve 'Dim nShowCurveDir As Integer = GetPrivateProfileInt(S_SCENE, K_CURVEDIR, 0, m_sIniFile) 'chkCurveDir.Checked = (nShowCurveDir <> 0) '' visualizzazione avanzata dei triangoli costituenti le superfici 'Dim bShowTriaAdv As Boolean = (GetPrivateProfileInt(S_SCENE, K_SHOWTRIAADV, 1, m_sIniFile) <> 0) 'EgtSetShowTriaAdv(bShowTriaAdv) '' ObjTree non selezionato 'm_nObjTreeOldId = GDB_ID.NULL '' nascondo input box 'ResetInputBox() End Sub Private Sub LoadGridData() Dim dSnapStep As Double = GetPrivateProfileDouble(S_GRID, If(m_bMmUnits, K_SNAPSTEP, K_SNAPSTEPINCH), 10) Dim nMinLineSStep As Integer = GetPrivateProfileInt(S_GRID, K_MINLINESSTEP, 1) Dim nMajLineSStep As Integer = GetPrivateProfileInt(S_GRID, K_MAJLINESSTEP, 10) Dim nExtSStep As Integer = GetPrivateProfileInt(S_GRID, K_EXTSSTEP, 50) Dim MinLnColor As New Color3d(160, 160, 160) GetPrivateProfileColor(S_GRID, K_MINLNCOLOR, MinLnColor) Dim MajLnColor As New Color3d(160, 160, 160) GetPrivateProfileColor(S_GRID, K_MAJLNCOLOR, MajLnColor) EgtSetGridFrame(Frame3d.GLOB) EgtSetGridGeo(dSnapStep, nMinLineSStep, nMajLineSStep, nExtSStep) EgtSetGridColor(MinLnColor, MajLnColor) End Sub ''' ''' Method that manage the visibility of the ProjectPage's Panels ''' Sub ManagePanelVisibility() Application.Msn.Register(Application.PROJECTPAGE_SELECTED, Sub() m_GridViewPanel.Visibility = Visibility.Visible m_DrawPanel.Visibility = Visibility.Visible m_DrawOptionPanel.Visibility = Visibility.Visible End Sub) Application.Msn.Register(Application.PROJECTPAGE_DESELECTED, Sub() m_GridViewPanel.Visibility = Visibility.Hidden m_DrawPanel.Visibility = Visibility.Hidden m_DrawOptionPanel.Visibility = Visibility.Hidden End Sub) End Sub ''' ''' Method that manage the visibility of the ProjectPage's Panels ''' Sub RegisterDrawPanelCommands() Application.Msn.Register(Application.WIREFRAME, Sub() m_ProjectScene.WireFrame() End Sub) Application.Msn.Register(Application.HIDDENLINE, Sub() m_ProjectScene.HiddenLine() End Sub) Application.Msn.Register(Application.SHADING, Sub() m_ProjectScene.Shading() End Sub) Application.Msn.Register(Application.ZOOMALL, Sub() m_ProjectScene.ZoomAll() End Sub) Application.Msn.Register(Application.ZOOMIN, Sub() m_ProjectScene.ZoomIn() End Sub) Application.Msn.Register(Application.ZOOMOUT, Sub() m_ProjectScene.ZoomOut() End Sub) Application.Msn.Register(Application.TOPVIEW, Sub() m_ProjectScene.TopView() End Sub) Application.Msn.Register(Application.FRONTVIEW, Sub() m_ProjectScene.FrontView() End Sub) Application.Msn.Register(Application.LEFTVIEW, Sub() m_ProjectScene.LeftView() End Sub) Application.Msn.Register(Application.BACKVIEW, Sub() m_ProjectScene.BackView() End Sub) Application.Msn.Register(Application.RIGHTVIEW, Sub() m_ProjectScene.RightView() End Sub) Application.Msn.Register(Application.ISOVIEWSW, Sub() m_ProjectScene.IsoViewSW() End Sub) Application.Msn.Register(Application.ISOVIEWSE, Sub() m_ProjectScene.IsoViewSE() End Sub) Application.Msn.Register(Application.ISOVIEWNE, Sub() m_ProjectScene.IsoViewNE() End Sub) Application.Msn.Register(Application.ISOVIEWNW, Sub() m_ProjectScene.IsoViewNW() End Sub) Application.Msn.Register(Application.CURVEDIR, Sub() End Sub) Application.Msn.Register(Application.ANALYZE, Sub() End Sub) Application.Msn.Register(Application.GETDIST, Sub() End Sub) Application.Msn.Register(Application.CPLANETOP, Sub() m_Controller.SetLastInteger(Controller.GRID_TYPE.TOP) m_Controller.ExecuteCommand(Controller.CMD.GRID) End Sub) Application.Msn.Register(Application.CPLANEFRONT, Sub() m_Controller.SetLastInteger(Controller.GRID_TYPE.FRONT) m_Controller.ExecuteCommand(Controller.CMD.GRID) End Sub) Application.Msn.Register(Application.CPLANERIGHT, Sub() m_Controller.SetLastInteger(Controller.GRID_TYPE.RIGHT) m_Controller.ExecuteCommand(Controller.CMD.GRID) End Sub) Application.Msn.Register(Application.CPLANEBACK, Sub() m_Controller.SetLastInteger(Controller.GRID_TYPE.BACK) m_Controller.ExecuteCommand(Controller.CMD.GRID) End Sub) Application.Msn.Register(Application.CPLANELEFT, Sub() m_Controller.SetLastInteger(Controller.GRID_TYPE.LEFT) m_Controller.ExecuteCommand(Controller.CMD.GRID) End Sub) Application.Msn.Register(Application.CPLANEBOTTOM, Sub() m_Controller.SetLastInteger(Controller.GRID_TYPE.BOTTOM) m_Controller.ExecuteCommand(Controller.CMD.GRID) End Sub) Application.Msn.Register(Application.CPLANEVIEW, Sub() m_Controller.SetLastInteger(Controller.GRID_TYPE.VIEW) m_Controller.ExecuteCommand(Controller.CMD.GRID) End Sub) Application.Msn.Register(Application.CPLANEELEVATION, Sub() m_Controller.ExecuteCommand(Controller.CMD.GRID_ELEVATION) End Sub) Application.Msn.Register(Application.CPLANEORIGIN, Sub() m_Controller.ExecuteCommand(Controller.CMD.GRID_ORIGIN) End Sub) Application.Msn.Register(Application.CPLANEROTATE, Sub() If (Keyboard.Modifiers And ModifierKeys.Shift) <> ModifierKeys.Shift Then m_Controller.ExecuteCommand(Controller.CMD.GRID_ROTATE) Else m_Controller.ExecuteCommand(Controller.CMD.GRID_ROTATE3D) End If End Sub) Application.Msn.Register(Application.CPLANE3P, Sub() m_Controller.ExecuteCommand(Controller.CMD.GRID_3P) End Sub) Application.Msn.Register(Application.CPLANEPERPOBJ, Sub() m_Controller.ExecuteCommand(Controller.CMD.GRID_PERPCURVE) End Sub) Application.Msn.Register(Application.CPLANEOBJ, Sub() m_Controller.ExecuteCommand(Controller.CMD.GRID_OBJ) End Sub) Application.Msn.Register(Application.POINT, Sub() If (Keyboard.Modifiers And ModifierKeys.Control) = ModifierKeys.Control Then m_Controller.ExecuteCommand(Controller.CMD.FRAME) ElseIf (Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift Then m_Controller.ExecuteCommand(Controller.CMD.VECTOR) Else m_Controller.ExecuteCommand(Controller.CMD.POINT) End If End Sub) Application.Msn.Register(Application.LINE2P, Sub() If (Keyboard.Modifiers And ModifierKeys.Control) = ModifierKeys.Control Then m_Controller.SetContinue() 'EmitStripStatusOutput(EgtMsg(399)) ' Continue : 'L' with line, 'A' with arc End If m_Controller.ExecuteCommand(Controller.CMD.LINE2P) End Sub) Application.Msn.Register(Application.LINEPDL, Sub() If (Keyboard.Modifiers And ModifierKeys.Shift) <> ModifierKeys.Shift Then m_Controller.ExecuteCommand(Controller.CMD.LINEPDL) Else m_Controller.ExecuteCommand(Controller.CMD.LINEPVL) End If End Sub) Application.Msn.Register(Application.CIRCLE, Sub() If (Keyboard.Modifiers And ModifierKeys.Shift) <> ModifierKeys.Shift Then m_Controller.ExecuteCommand(Controller.CMD.CIRCLECP) Else m_Controller.ExecuteCommand(Controller.CMD.CIRCLECD) End If End Sub) Application.Msn.Register(Application.ARCCSE, Sub() m_Controller.ExecuteCommand(Controller.CMD.ARCCSE) End Sub) Application.Msn.Register(Application.ARC3P, Sub() m_Controller.ExecuteCommand(Controller.CMD.ARC3P) End Sub) Application.Msn.Register(Application.ARCPDP, Sub() If (Keyboard.Modifiers And ModifierKeys.Shift) <> ModifierKeys.Shift Then If (Keyboard.Modifiers And ModifierKeys.Control) = ModifierKeys.Control Then m_Controller.SetContinue() 'EmitStripStatusOutput(EgtMsg(399)) ' Continue : 'L' with line, 'A' with arc End If m_Controller.ExecuteCommand(Controller.CMD.ARCPDP) Else m_Controller.ExecuteCommand(Controller.CMD.ARCPVP) End If End Sub) Application.Msn.Register(Application.FILLET, Sub() If (Keyboard.Modifiers And ModifierKeys.Shift) <> ModifierKeys.Shift Then m_Controller.ExecuteCommand(Controller.CMD.FILLET) Else m_Controller.ExecuteCommand(Controller.CMD.CHAMFER) End If End Sub) Application.Msn.Register(Application.RECTANGLE2P, Sub() m_Controller.ExecuteCommand(Controller.CMD.RECTANGLE2P) End Sub) Application.Msn.Register(Application.POLYGON, Sub() If (Keyboard.Modifiers And ModifierKeys.Shift) <> ModifierKeys.Shift Then m_Controller.ExecuteCommand(Controller.CMD.POLYGON) Else m_Controller.ExecuteCommand(Controller.CMD.POLYGONSIDE) End If End Sub) Application.Msn.Register(Application.TEXT, Sub() If (Keyboard.Modifiers And ModifierKeys.Shift) <> ModifierKeys.Shift Then m_Controller.ExecuteCommand(Controller.CMD.TEXT) Else m_Controller.ExecuteCommand(Controller.CMD.TEXTPLUS) End If End Sub) Application.Msn.Register(Application.PLANE, Sub() If (Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift Then m_Controller.ExecuteCommand(Controller.CMD.REGION) Else m_Controller.ExecuteCommand(Controller.CMD.PLANE) End If End Sub) Application.Msn.Register(Application.EXTRUDE, Sub() m_Controller.ExecuteCommand(Controller.CMD.EXTRUDE) End Sub) Application.Msn.Register(Application.REVOLVE, Sub() m_Controller.ExecuteCommand(Controller.CMD.REVOLVE) End Sub) Application.Msn.Register(Application.SCREW, Sub() m_Controller.ExecuteCommand(Controller.CMD.SCREW) End Sub) Application.Msn.Register(Application.RULED, Sub() m_Controller.ExecuteCommand(Controller.CMD.RULED) End Sub) Application.Msn.Register(Application.MERGESURF, Sub() m_Controller.ExecuteCommand(Controller.CMD.MERGESURF) End Sub) Application.Msn.Register(Application.EXPLODESURF, Sub() m_Controller.ExecuteCommand(Controller.CMD.EXPLODESURF) End Sub) Application.Msn.Register(Application.INVERTSURF, Sub() m_Controller.ExecuteCommand(Controller.CMD.INVERTSURF) End Sub) Application.Msn.Register(Application.DELETE, Sub() m_Controller.SetLastInteger(GDB_ID.SEL) m_Controller.ExecuteCommand(Controller.CMD.DELETE) End Sub) Application.Msn.Register(Application.CHANGELAYER, Sub() m_Controller.ExecuteCommand(Controller.CMD.CHANGELAYER) End Sub) Application.Msn.Register(Application.CHANGECOLOR, Sub() If (Keyboard.Modifiers And ModifierKeys.Control) = ModifierKeys.Control Then m_Controller.ExecuteCommand(Controller.CMD.CHANGEALPHA) ElseIf (Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift Then m_Controller.ExecuteCommand(Controller.CMD.RESETCOLOR) Else m_Controller.ExecuteCommand(Controller.CMD.CHANGECOLOR) End If End Sub) Application.Msn.Register(Application.INVERTCURVE, Sub() m_Controller.ExecuteCommand(Controller.CMD.INVERTCURVE) End Sub) Application.Msn.Register(Application.CHANGESTARTCURVE, Sub() m_Controller.ExecuteCommand(Controller.CMD.CHANGESTARTCURVE) End Sub) Application.Msn.Register(Application.EXTENDCURVE, Sub() m_Controller.ExecuteCommand(Controller.CMD.TRIMEXTENDCURVE) End Sub) Application.Msn.Register(Application.BREAKCURVE, Sub() If (Keyboard.Modifiers And ModifierKeys.Shift) <> ModifierKeys.Shift Then m_Controller.ExecuteCommand(Controller.CMD.BREAKCURVE) Else m_Controller.ExecuteCommand(Controller.CMD.SPLITCURVE) End If End Sub) Application.Msn.Register(Application.JOINCURVE, Sub() If (Keyboard.Modifiers And ModifierKeys.Shift) <> ModifierKeys.Shift Then m_Controller.SetLastBoolean(False) Else m_Controller.SetLastBoolean(True) End If m_Controller.ExecuteCommand(Controller.CMD.JOINCURVE) End Sub) Application.Msn.Register(Application.EXPLODECURVE, Sub() m_Controller.ExecuteCommand(Controller.CMD.EXPLODECURVE) End Sub) Application.Msn.Register(Application.SETCURVETH, Sub() m_Controller.ExecuteCommand(Controller.CMD.SETCURVETHICKNESS) End Sub) Application.Msn.Register(Application.MOVE, Sub() m_Controller.ExecuteCommand(Controller.CMD.MOVE) End Sub) Application.Msn.Register(Application.ROTATE, Sub() If (Keyboard.Modifiers And ModifierKeys.Shift) <> ModifierKeys.Shift Then m_Controller.ExecuteCommand(Controller.CMD.ROTATE) Else m_Controller.ExecuteCommand(Controller.CMD.ROTATE3D) End If End Sub) Application.Msn.Register(Application.MIRROR, Sub() If (Keyboard.Modifiers And ModifierKeys.Shift) <> ModifierKeys.Shift Then m_Controller.ExecuteCommand(Controller.CMD.MIRROR) Else m_Controller.ExecuteCommand(Controller.CMD.MIRROR3D) End If End Sub) Application.Msn.Register(Application.SCALE, Sub() If (Keyboard.Modifiers And ModifierKeys.Shift) <> ModifierKeys.Shift Then m_Controller.ExecuteCommand(Controller.CMD.SCALE) Else m_Controller.ExecuteCommand(Controller.CMD.SCALE3D) End If End Sub) Application.Msn.Register(Application.OFFSET, Sub() m_Controller.ExecuteCommand(Controller.CMD.OFFSET) End Sub) End Sub Sub RegisterDrawOptionPanelCommands() Application.Msn.Register(Application.NOTIFYINPUTTEXT, Sub(sInputText As String) m_InputText = sInputText End Sub) Application.Msn.Register(Application.SETLASTBOOLEAN, Sub(bBoolean As Boolean) m_Controller.SetLastBoolean(bBoolean) End Sub) Application.Msn.Register(Application.SHOW, Sub(sString As String) m_Controller.Show(sString) End Sub) Application.Msn.Register(Application.DONE, Sub(sString As String) m_Controller.Done(sString) End Sub) End Sub Sub RegisterStatusBarCommands() Application.Msn.Register(Application.STATUSGRIDCOMMAND, Sub() m_bShowGrid = Not m_bShowGrid Application.Msn.NotifyColleagues(Application.UPDATESTATUSGRID, New UpdateStatusGridParam(m_bShowGrid, m_bShowGridFrame)) EgtDraw() End Sub) End Sub #End Region #Region "SCENE EVENTS" Private Sub OnCursorPos(ByVal sender As Object, ByVal sCursorPos As String) Handles m_ProjectScene.OnCursorPos Application.Msn.NotifyColleagues(Application.NOTIFYCURRPOS, sCursorPos) End Sub Private Sub OnMouseSelectedAll(ByVal sender As Object) Handles m_ProjectScene.OnMouseSelectedAll m_Controller.MouseSelectedAll() End Sub Private Sub OnMouseDeselectedAll(ByVal sender As Object) Handles m_ProjectScene.OnMouseDeselectedAll m_Controller.MouseDeselectedAll() End Sub Private Sub OnMouseSelectedObj(ByVal sender As Object, ByVal nId As Integer, ByVal bLast As Boolean) Handles m_ProjectScene.OnMouseSelectedObj m_Controller.MouseSelectedObj(nId, bLast) End Sub Private Sub OnMouseSelectedPart(ByVal sender As Object, ByVal nId As Integer) Handles m_ProjectScene.OnMouseSelectedPart m_Controller.MouseSelectedPart(nId) End Sub Private Sub OnMouseSelectedLayer(ByVal sender As Object, ByVal nId As Integer) Handles m_ProjectScene.OnMouseSelectedLayer m_Controller.MouseSelectedLayer(nId) End Sub Private Sub OnMouseSelectedPath(ByVal sender As Object, ByVal nId As Integer, ByVal bHaltOnFork As Boolean) Handles m_ProjectScene.OnMouseSelectedPath m_Controller.MouseSelectedPath(nId, bHaltOnFork) End Sub Private Sub OnMousePointFromSelection(ByVal sender As Object, ByVal nId As Integer, ByVal PtP As Point3d, ByVal nAux As Integer) Handles m_ProjectScene.OnMousePointFromSelection m_Controller.SetPointFromSelection(nId, PtP, nAux) End Sub Private Sub OnMouseDone(ByVal sender As Object) Handles m_ProjectScene.OnMouseDone m_Controller.Done(m_InputText) End Sub Private Sub OnMouseSelectedPoint(ByVal sender As Object, ByVal PtP As Point3d, ByVal nSep As SEP, ByVal nId As Integer) Handles m_ProjectScene.OnMouseSelectedPoint Dim bDone As Boolean = (Keyboard.Modifiers And ModifierKeys.Control) <> ModifierKeys.Control m_Controller.MouseSelectedPoint(PtP, nSep, nId, bDone) End Sub Private Sub OnMouseSelectedDir(ByVal sender As Object, ByVal VtDir As Vector3d) Handles m_ProjectScene.OnMouseSelectedDir m_Controller.SetLastVector3d(VtDir) End Sub Private Sub OnMouseMoveSelPoint(ByVal sender As Object, ByVal PtP As Point3d) Handles m_ProjectScene.OnMouseMoveSelPoint m_Controller.MouseMoveInSelectionPoint(PtP) End Sub ' Private Sub OnMouseAnalyzed(ByVal sender As Object, ByVal nId As Integer) Handles m_ProjectScene.OnMouseAnalyzed ' UpdateObjInObjTree(nId) ' SelectIdInObjTree(nId) ' End Sub Private Sub OnShowDistance(ByVal sender As Object, ByVal sDistance As String) Handles m_ProjectScene.OnShowDistance Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, sDistance) End Sub #End Region #Region "CONTROLLER EVENTS" Private Sub OnNewProject(ByVal sender As Object, ByVal bOk As Boolean) Handles m_Controller.OnNewProject If Not bOk Then MessageBox.Show(EgtMsg(10002), EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error on new file - Error End If End Sub ' Private Sub OnOpeningProject(ByVal sender As Object) Handles m_Controller.OnOpeningProject ' ClearObjTree() ' End Sub Private Sub OnOpenProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) Handles m_Controller.OnOpenProject WritePrivateProfileString(S_GENERAL, K_LASTNGEDIR, Path.GetDirectoryName(sFile)) 'If bOk Then ' m_MruFiles.Add(sFile) 'Else ' m_MruFiles.Remove(sFile) ' Dim sMsg As String = EgtMsg(10003) & " '" & sFile & "'" 'Error opening file ' MessageBox.Show(sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) 'Error 'End If End Sub Private Sub OnSavingProject(ByVal sender As Object) Handles m_Controller.OnSavingProject End Sub Private Sub OnSavedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) Handles m_Controller.OnSavedProject WritePrivateProfileString(S_GENERAL, K_LASTNGEDIR, Path.GetDirectoryName(sFile)) 'If bOk Then ' m_MruFiles.Add(sFile) 'Else ' m_MruFiles.Remove(sFile) ' Dim sMsg As String = EgtMsg(10004) & " '" & sFile & "'" 'Error saving file ' MessageBox.Show(sMsg, EgtMsg(10001), MessageBoxButtons.OK, MessageBoxIcon.Error) ' Error 'End If End Sub Private Sub OnSavingObject(ByVal sender As Object) Handles m_Controller.OnSavingObject End Sub Private Sub OnSavedObject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) Handles m_Controller.OnSavedObject WritePrivateProfileString(S_GENERAL, K_LASTNGEOBJDIR, Path.GetDirectoryName(sFile)) 'If bOk Then ' m_MruFiles.Add(sFile) 'Else ' m_MruFiles.Remove(sFile) ' Dim sMsg As String = EgtMsg(10004) & " '" & sFile & "'" 'Error saving file ' MessageBox.Show(sMsg, EgtMsg(10001), MessageBoxButtons.OK, MessageBoxIcon.Error) ' Error 'End If End Sub Private Sub OnImportingProject(ByVal sender As Object, ByVal bOkType As Boolean) Handles m_Controller.OnImportingProject If bOkType Then 'ClearObjTree() Else MessageBox.Show(EgtMsg(10005), EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' File type unknown - Error End If End Sub Private Sub OnImportedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) Handles m_Controller.OnImportedProject WritePrivateProfileString(S_GENERAL, K_LASTIMPDIR, Path.GetDirectoryName(sFile)) If Not bOk Then Dim sMsg As String = EgtMsg(10006) & " '" & sFile & "'" 'Error importing file MessageBox.Show(sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error End If End Sub Private Sub OnExportingProject(ByVal sender As Object) Handles m_Controller.OnExportingProject End Sub Private Sub OnExportedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) Handles m_Controller.OnExportedProject WritePrivateProfileString(S_GENERAL, K_LASTEXPDIR, Path.GetDirectoryName(sFile)) If Not bOk Then Dim sMsg As String = EgtMsg(10007) & " '" & sFile & "'" 'Error exporting file MessageBox.Show(sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error End If End Sub Private Sub OnExecutingScript(ByVal sender As Object) Handles m_Controller.OnExecutingScript 'ClearObjTree() 'Abilito progress e bottone stop Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSPROGRESS, 0) Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSSTOP, True) ' Dichiaro script in esecuzione m_bScriptRunning = True End Sub Private Sub OnExecutedScript(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean, ByVal sError As String) Handles m_Controller.OnExecutedScript ' Salvo path dello script in lista recenti WritePrivateProfileString(S_GENERAL, K_LASTLUADIR, Path.GetDirectoryName(sFile)) 'If bOk Then ' m_MruScripts.Add(sFile) 'Else ' m_MruScripts.Remove(sFile) ' MessageBox.Show(sError, EgtMsg(10001), MessageBoxButtons.OK, MessageBoxIcon.Error) ' Error 'End If ' Disabilito progress e bottone stop Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSPROGRESS, 0) Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSSTOP, False) '' Dichiaro terminata esecuzione script m_bScriptRunning = False End Sub Private Sub OnPrepareInputBox(ByVal sTitle As String, ByVal sLabel As String, ByVal sCheckLabel As String, ByVal bShowCombo As Boolean, ByVal bShowBtn As Boolean) Handles m_Controller.PrepareInputBox Application.Msn.NotifyColleagues(Application.PREPAREINPUTBOX, New PrepareInputBoxParam(sTitle, sLabel, sCheckLabel, bShowCombo, bShowBtn)) End Sub Private Sub OnSetInputBoxText(ByVal sText As String) Handles m_Controller.SetInputBoxText Application.Msn.NotifyColleagues(Application.SETINPUTBOXTEXT, sText) End Sub Private Sub OnSetInputBoxCheck(ByVal bCheck As Boolean) Handles m_Controller.SetInputBoxCheck Application.Msn.NotifyColleagues(Application.SETINPUTBOXCHECK, bCheck) End Sub Private Sub OnAddInputBoxCombo(ByVal sText As String, ByVal bSelected As Boolean) Handles m_Controller.AddInputBoxCombo Application.Msn.NotifyColleagues(Application.ADDINPUTBOXCOMBO, New AddInputBoxComboParam(sText, bSelected)) End Sub Private Sub OnUpdateUI(ByVal sender As Object, ByVal bReloadUI As Boolean) Handles m_Controller.UpdateUI ' pulisco input e relativi messaggi Application.Msn.NotifyColleagues(Application.RESETINPUTBOX) If m_Controller.GetContinue() Then Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, (EgtMsg(399))) ' Continue : 'L' with line, 'A' with arc Else Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, ("")) End If ' aggiorno dati correnti 'EmitTitle() 'EmitCurrPartLayer() 'If bReloadUI Then ' LoadObjTree() 'Else ' UpdateObjTree() 'End If End Sub Private Sub OutputInfo(ByVal sender As Object, ByVal sText As String) Handles m_Controller.OutputInfo Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, sText) End Sub #End Region End Class End Namespace