2aa90a57ab
- migliorie varie per foto - aggiunto salvataggio e recupero con nome basato su indice ciclico.
95 lines
3.5 KiB
VB.net
95 lines
3.5 KiB
VB.net
Imports EgtUILib
|
|
|
|
Public Class SimulationPageUC
|
|
|
|
Dim m_MainWindow As MainWindow = Application.Current.MainWindow
|
|
Dim m_CurrProjPage As CurrentProjectPageUC
|
|
|
|
' Dichiarazione flag PlayPauseBtn
|
|
Private m_bPlay As Boolean = False
|
|
|
|
' Flag di progetto da caricare prima di simulare
|
|
Private m_bToReload As Boolean = False
|
|
|
|
Private Sub SimulationPage_Initialized(sender As Object, e As EventArgs)
|
|
|
|
PlayPauseImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("/Resources/Play.png", UriKind.Relative))
|
|
|
|
End Sub
|
|
|
|
Private Sub SimulationPage_Loaded(sender As Object, e As RoutedEventArgs)
|
|
m_CurrProjPage = m_MainWindow.m_CurrentProjectPageUC
|
|
' Disabilito impostazione modificato
|
|
EgtDisableModified()
|
|
' Salvo il progetto corrente
|
|
SaveFile()
|
|
' Nascondo eventuali pezzi in parcheggio
|
|
HideParkedParts()
|
|
' Visualizzo tutta la macchina
|
|
EgtShowOnlyTable(False)
|
|
' Imposto vista 3d isometrica di tutto
|
|
EgtSetView(VT.ISO_SE, False)
|
|
EgtZoom(ZM.ALL)
|
|
End Sub
|
|
|
|
Private Sub PlayPauseBtn_Click(sender As Object, e As RoutedEventArgs) Handles PlayPauseBtn.Click
|
|
If m_bPlay Then
|
|
' Metto in pausa
|
|
m_bPlay = False
|
|
PlayPauseImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("/Resources/Play.png", UriKind.Relative))
|
|
Else
|
|
' Ricarico il progetto, se necessario
|
|
If ReloadFile(True) Then
|
|
EgtDraw()
|
|
End If
|
|
' Metto in play
|
|
m_bPlay = True
|
|
PlayPauseImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("/Resources/Pause.png", UriKind.Relative))
|
|
' Eseguo
|
|
m_bToReload = True
|
|
EgtLuaExecFile("C:\EgtData\OmagCut\Config\Simulate.lua")
|
|
' Metto in pausa
|
|
m_bPlay = False
|
|
PlayPauseImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("/Resources/Play.png", UriKind.Relative))
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub ExitBtnUC_Click(sender As Object, e As RoutedEventArgs)
|
|
' Ricarico il progetto corrente
|
|
ReloadFile(False)
|
|
' Imposto vista 2D
|
|
EgtSetView(VT.TOP, False)
|
|
EgtZoom(ZM.ALL)
|
|
' Abilito impostazione modificato
|
|
EgtEnableModified()
|
|
' Esco dalla pagina
|
|
m_MainWindow.m_CurrentProjectPageUC.CurrentProjectPageGrid.Children.Remove(Me)
|
|
m_CurrProjPage.CurrProjGrid.Visibility = Windows.Visibility.Visible
|
|
m_MainWindow.m_CurrentProjectPageUC.CurrentProjectPageGrid.Children.Add(m_MainWindow.m_CadCutPageUC)
|
|
m_MainWindow.m_ActivePage = MainWindow.Pages.CadCut
|
|
End Sub
|
|
|
|
Private Sub SaveFile()
|
|
Dim sPath As String = m_MainWindow.GetTempDir() & "\" & "SimuProj.nge"
|
|
m_CurrProjPage.SaveFile(sPath)
|
|
m_bToReload = False
|
|
End Sub
|
|
|
|
Private Function ReloadFile(ByVal bForSimu As Boolean) As Boolean
|
|
If Not m_bToReload Then
|
|
Return False
|
|
End If
|
|
' Ricarico
|
|
Dim sPath As String = m_MainWindow.GetTempDir() & "\" & "SimuProj.nge"
|
|
m_CurrProjPage.LoadFile(sPath)
|
|
' Se per simulazione, nascondo pezzi in parcheggio e visualizzo tutta la macchina
|
|
If bForSimu Then
|
|
HideParkedParts()
|
|
EgtShowOnlyTable(False)
|
|
End If
|
|
m_bToReload = False
|
|
Return True
|
|
End Function
|
|
|
|
End Class
|