diff --git a/Icarus/Icarus.vbproj b/Icarus/Icarus.vbproj
index 686b25d..99db10e 100644
--- a/Icarus/Icarus.vbproj
+++ b/Icarus/Icarus.vbproj
@@ -164,6 +164,10 @@
ImportExportMachiningPanelV.xaml
+
+ ImportLoadingWndV.xaml
+
+
InstrumentPanelV.xaml
@@ -369,6 +373,10 @@
Designer
XamlIntelliSenseFileGenerator
+
+ Designer
+ MSBuild:Compile
+
MSBuild:Compile
Designer
diff --git a/Icarus/ImportLoadingWnd/ImportLoadingWndV.xaml b/Icarus/ImportLoadingWnd/ImportLoadingWndV.xaml
new file mode 100644
index 0000000..bf69ce3
--- /dev/null
+++ b/Icarus/ImportLoadingWnd/ImportLoadingWndV.xaml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Icarus/ImportLoadingWnd/ImportLoadingWndV.xaml.vb b/Icarus/ImportLoadingWnd/ImportLoadingWndV.xaml.vb
new file mode 100644
index 0000000..a9c3795
--- /dev/null
+++ b/Icarus/ImportLoadingWnd/ImportLoadingWndV.xaml.vb
@@ -0,0 +1,14 @@
+Public Class ImportLoadingWndV
+
+ Private WithEvents m_ImportLoadingWndVM As ImportLoadingWndVM
+
+ Sub New(Owner As Window, ImportLoadingWndVM As ImportLoadingWndVM)
+ MyBase.New(Owner)
+ ' This call is required by the designer.
+ InitializeComponent()
+ Me.DataContext = ImportLoadingWndVM
+ ' Assegno al riferimento locale al VM il VM preso dal DataContext
+ m_ImportLoadingWndVM = ImportLoadingWndVM
+ End Sub
+
+End Class
diff --git a/Icarus/ImportLoadingWnd/ImportLoadingWndVM.vb b/Icarus/ImportLoadingWnd/ImportLoadingWndVM.vb
new file mode 100644
index 0000000..9b66be3
--- /dev/null
+++ b/Icarus/ImportLoadingWnd/ImportLoadingWndVM.vb
@@ -0,0 +1,91 @@
+Imports System.Collections.ObjectModel
+Imports EgtUILib.EgtInterface
+Imports EgtWPFLib5
+
+Public Class ImportLoadingWndVM
+ Inherits VMBase
+
+#Region "FIELDS & PROPERTIES"
+
+ ' Funzioni di callback per output in interfaccia da LUA
+ Private m_ProcEventsCallback As New ProcessEventsCallback(AddressOf ProcessEvents)
+
+ Private m_bStopLoading As Boolean = False
+
+ Private m_Loading_Value As Double
+ Public Property Loading_Value As Double
+ Get
+ Return m_Loading_Value
+ End Get
+ Set(value As Double)
+ m_Loading_Value = value
+ End Set
+ End Property
+
+ ' Definizione comandi
+ Private m_cmdStop As ICommand
+
+#End Region ' FIELDS & PROPERTIES
+
+#Region "MESSAGES"
+
+ Public ReadOnly Property Loading_Msg As String
+ Get
+ Return "Importing file..."
+ End Get
+ End Property
+
+#End Region ' MESSAGES
+
+#Region "CONSTRUCTORS"
+
+ Sub New()
+ ' Creo riferimento a questa classe in Map
+ Map.SetRefImportLoadingWndVM(Me)
+ End Sub
+
+#End Region ' CONSTRUCTORS
+
+#Region "METHODS"
+
+ Friend Function ProcessEvents(ByVal nProg As Integer, ByVal nPause As Integer) As Integer
+ m_Loading_Value = nProg
+ NotifyPropertyChanged(NameOf(Loading_Value))
+ ' Costringo ad aggiornare
+ UpdateUI()
+ ' Eventuale attesa
+ Threading.Thread.Sleep(nPause)
+ ' Ritorno eventuale stop
+ If m_bStopLoading Then
+ m_bStopLoading = False
+ Return 1
+ Else
+ Return 0
+ End If
+ Return 0
+ End Function
+
+#End Region ' METHODS
+
+#Region "COMMANDS"
+
+#Region "Stop"
+
+ Public ReadOnly Property Stop_Command As ICommand
+ Get
+ If m_cmdStop Is Nothing Then
+ m_cmdStop = New Command(AddressOf StopLoading)
+ End If
+ Return m_cmdStop
+ End Get
+ End Property
+
+ Public Sub StopLoading()
+ m_bStopLoading = True
+ End Sub
+
+#End Region ' Stop
+
+#End Region ' COMMANDS
+
+End Class
diff --git a/Icarus/MainWindow/MainWindowVM.vb b/Icarus/MainWindow/MainWindowVM.vb
index ef0879a..5adf916 100644
--- a/Icarus/MainWindow/MainWindowVM.vb
+++ b/Icarus/MainWindow/MainWindowVM.vb
@@ -15,6 +15,9 @@ Public Class MainWindowVM
End Get
End Property
+ ' Funzioni di callback per output in interfaccia da LUA
+ Private m_ProcEventsCallback As New ProcessEventsCallback(AddressOf ProcessEvents)
+
' Variabile che indica che il programma è stato avviato correttamente (sia la mappa che l'ambiente Egt)
Private m_bInitStatus As Boolean
Friend ReadOnly Property bInitStatus As Boolean
@@ -74,6 +77,8 @@ Public Class MainWindowVM
m_MainWindowM = New MainWindowM
' inizializzo machine panel
m_MachinePanelVM = New MachinePanelVM
+ ' Installo funzione gestione eventi per lua
+ EgtSetProcessEvents(m_ProcEventsCallback)
End Sub
#End Region ' CONSTRUCTOR
@@ -142,6 +147,17 @@ Public Class MainWindowVM
End If
End Sub
+ Private Function ProcessEvents(ByVal nProg As Integer, ByVal nPause As Integer) As Integer
+ If Map.refSliceManagerVM.bCalculating Then
+ Map.refSliceManagerVM.ProcessEvents(nProg, nPause)
+ End If
+ If Not IsNothing(Map.refImportLoadingWndVM) Then
+ Map.refImportLoadingWndVM.ProcessEvents(nProg, nPause)
+ End If
+ Map.refMyStatusBarVM.ProcessEvents(nProg, nPause)
+ Return 0
+ End Function
+
Friend Sub CloseApplication()
If (Keyboard.Modifiers And ModifierKeys.Alt) = ModifierKeys.Alt OrElse Keyboard.IsKeyDown(Key.F4) Then
Return
diff --git a/Icarus/SceneHost/MySceneHostVM.vb b/Icarus/SceneHost/MySceneHostVM.vb
index 1a4a06d..dc0df95 100644
--- a/Icarus/SceneHost/MySceneHostVM.vb
+++ b/Icarus/SceneHost/MySceneHostVM.vb
@@ -353,6 +353,9 @@ Public Class MySceneHostVM
Map.refSliderManagerVM.SetLayerAdvancementIsEnabled(False)
Map.refInstrumentPanelVM.SetEdgeAnalysisIsEnabled(False)
Map.refSliderManagerVM.SetSliderVisibility(False)
+ ' mostro finestra di caricamento
+ Dim ImportLoadingWnd As ImportLoadingWndV = New ImportLoadingWndV(Application.Current.MainWindow, New ImportLoadingWndVM)
+ ImportLoadingWnd.Show()
' importo la nuova geometria
If MainController.InsertProject(sFile, False) Then
Map.refViewLayerManagerVM.SetViewLayerManagerIsEnabled(True)
@@ -372,6 +375,8 @@ Public Class MySceneHostVM
Map.refInstrumentPanelVM.SetEdgeAnalysisIsEnabled(True)
Map.refSliderManagerVM.SetSliderVisibility(True)
End If
+ ' chiudo finestra di caricamento
+ ImportLoadingWnd.Close()
EgtDraw()
End Sub
diff --git a/Icarus/SliceManager/SliceManagerVM.vb b/Icarus/SliceManager/SliceManagerVM.vb
index d7deb01..0d79e94 100644
--- a/Icarus/SliceManager/SliceManagerVM.vb
+++ b/Icarus/SliceManager/SliceManagerVM.vb
@@ -199,8 +199,6 @@ Public Class SliceManagerVM
Sub New()
' Creo riferimento a questa classe in EgtCAM5Map
Map.SetRefSliceManagerVM(Me)
- ' Installo funzione gestione eventi per lua
- EgtSetProcessEvents(m_ProcEventsCallback)
UpdateState(False)
End Sub
@@ -235,7 +233,7 @@ Public Class SliceManagerVM
NotifyPropertyChanged(NameOf(Mass_Visibility))
End Sub
- Private Function ProcessEvents(ByVal nProg As Integer, ByVal nPause As Integer) As Integer
+ Friend Function ProcessEvents(ByVal nProg As Integer, ByVal nPause As Integer) As Integer
' Se previsto, imposto progress
If nProg >= 0 Then
Dim dPartialProgress As Integer = 0
diff --git a/Icarus/StatusBar/MyStatusBarVM.vb b/Icarus/StatusBar/MyStatusBarVM.vb
index b5d9bd8..e1a5ed2 100644
--- a/Icarus/StatusBar/MyStatusBarVM.vb
+++ b/Icarus/StatusBar/MyStatusBarVM.vb
@@ -8,7 +8,6 @@ Public Class MyStatusBarVM
Inherits EgtWPFLib5.StatusBarVM
' Funzioni di callback per output in interfaccia da LUA
- Private m_ProcEventsCallback As New ProcessEventsCallback(AddressOf ProcessEvents)
Private m_OutTextCallback As New OutTextCallback(AddressOf OutText)
Private m_bStopProgress As Boolean
@@ -115,8 +114,6 @@ Public Class MyStatusBarVM
Sub New()
' Creo riferimento a questa classe in Map
Map.SetRefMyStatusBarVM(Me)
- ' Installo funzione gestione eventi per lua
- EgtSetProcessEvents(m_ProcEventsCallback)
' Installo funzione output testo su status per lua
EgtSetOutText(m_OutTextCallback)
' imposto stato di visualizzazione della griglia
@@ -163,7 +160,7 @@ Public Class MyStatusBarVM
Return True
End Function
- Private Function ProcessEvents(ByVal nProg As Integer, ByVal nPause As Integer) As Integer
+ Friend Function ProcessEvents(ByVal nProg As Integer, ByVal nPause As Integer) As Integer
' Se previsto, imposto progress
If nProg > 0 Then SetLoadingProgress(Math.Min(nProg, 100))
' Costringo ad aggiornare
diff --git a/Icarus/Utility/Map.vb b/Icarus/Utility/Map.vb
index 45aa856..f00f69c 100644
--- a/Icarus/Utility/Map.vb
+++ b/Icarus/Utility/Map.vb
@@ -34,6 +34,7 @@ Module Map
Private m_refSplashScreen As SplashScreen
Private m_refManagePartPanelVM As ManagePartPanelVM
Private m_refMachineViewPanelVM As MachineViewPanelVM
+ Private m_refImportLoadingWndVM As ImportLoadingWndVM
#Region "Get"
@@ -240,6 +241,12 @@ Module Map
End Get
End Property
+ Public ReadOnly Property refImportLoadingWndVM As ImportLoadingWndVM
+ Get
+ Return m_refImportLoadingWndVM
+ End Get
+ End Property
+
#End Region ' Get
#Region "Set"
@@ -403,6 +410,11 @@ Module Map
Return Not IsNothing(m_refMachineViewPanelVM)
End Function
+ Friend Function SetRefImportLoadingWndVM(ImportLoadingWndVM As ImportLoadingWndVM) As Boolean
+ m_refImportLoadingWndVM = ImportLoadingWndVM
+ Return Not IsNothing(m_refImportLoadingWndVM)
+ End Function
+
#End Region ' Set
#Region "Init"