- aggiunta finestra di caricamento import

- spostato processEvent in main che rimanda alle varie parti del programma
This commit is contained in:
Emmanuele Sassi
2023-04-03 18:05:01 +02:00
parent fa737c7c80
commit 209cab548b
9 changed files with 186 additions and 7 deletions
+8
View File
@@ -164,6 +164,10 @@
<DependentUpon>ImportExportMachiningPanelV.xaml</DependentUpon>
</Compile>
<Compile Include="ImportExportMachiningPanel\ImportExportMachiningPanelVM.vb" />
<Compile Include="ImportLoadingWnd\ImportLoadingWndV.xaml.vb">
<DependentUpon>ImportLoadingWndV.xaml</DependentUpon>
</Compile>
<Compile Include="ImportLoadingWnd\ImportLoadingWndVM.vb" />
<Compile Include="InstrumentPanel\InstrumentPanelV.xaml.vb">
<DependentUpon>InstrumentPanelV.xaml</DependentUpon>
</Compile>
@@ -369,6 +373,10 @@
<SubType>Designer</SubType>
<Generator>XamlIntelliSenseFileGenerator</Generator>
</Page>
<Page Include="ImportLoadingWnd\ImportLoadingWndV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="InstrumentPanel\InstrumentPanelV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -0,0 +1,38 @@
<EgtWPFLib5:EgtMainWindow x:Class="ImportLoadingWndV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
Title="New Project"
SizeToContent="WidthAndHeight"
WindowStartupLocation="CenterOwner"
Style="{StaticResource Dialog_Window}">
<Grid Margin="2.5,2.5,2.5,2.5">
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding Loading_Msg}"
Margin="20,20,20,2.5"
Style="{StaticResource DialogWindow_TextBlock}"/>
<Grid Grid.Row="1"
Margin="2.5,2.5,2.5,2.5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<ProgressBar Value="{Binding Loading_Value}"
Width="200"
Margin="0,0,2.5,20"
Style="{StaticResource Icarus_ProgressBar}"/>
<!--<Button Grid.Column="1"
Grid.RowSpan="2"
Command="{Binding Stop_Command}"
Margin="2.5,0,0,0"
Style="{StaticResource TopPanel_Button}">
<Image Source="\Resources\SliceManager\StopCalculation.png"
Style="{StaticResource Button_Image}"/>
</Button>-->
</Grid>
</Grid>
</EgtWPFLib5:EgtMainWindow>
@@ -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
@@ -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
+16
View File
@@ -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
+5
View File
@@ -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
+1 -3
View File
@@ -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
+1 -4
View File
@@ -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
+12
View File
@@ -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"