- Introdotta scelta macchina su nuovo progetto

- Gestita barra caricamento calcolo intersezioni
This commit is contained in:
Emmanuele Sassi
2022-10-04 11:58:29 +02:00
parent ea2da7bae2
commit fbf5ff294e
13 changed files with 241 additions and 19 deletions
@@ -0,0 +1,71 @@
<EgtWPFLib5:EgtCustomWindow x:Class="ChooseMachineWndV"
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"
xmlns:Icarus="clr-namespace:Icarus"
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
WindowStyle="None" ResizeMode="NoResize"
SizeToContent="WidthAndHeight"
MinWidth="500"
WindowStartupLocation="CenterOwner"
IsClosable="False"
IsMinimizable="False"
IsResizable="False"
Title="ProjectType">
<StackPanel Margin="5,5,5,0">
<Border Grid.Row="1"
BorderThickness="1"
BorderBrush="DarkGray"
Background="White"
Margin="5">
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid HorizontalAlignment="Center"
Grid.Row="0"
Margin="15">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding ChooseMachine_Msg}"
Style="{StaticResource OptionTextBlock}"
Grid.Row="0" Grid.ColumnSpan="2"/>
<Rectangle Height="22" Grid.Row="1"/>
<ComboBox ItemsSource="{Binding MachineList}" DisplayMemberPath="Name"
SelectedItem="{Binding SelMachine}" SelectedValuePath="Name"
Grid.Row="2"
Style="{StaticResource BtlData_ComboBox}"/>
</Grid>
<Grid Grid.Row="2" Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Button Content="Ok"
Command="{Binding Ok_Command}"
IsDefault="True"
Grid.Column="1"
Style="{StaticResource EgtWPFLib5_InputButton}"/>
<Button Content="Cancel"
IsCancel="True"
Grid.Column="3"
Style="{StaticResource EgtWPFLib5_InputButton}"/>
</Grid>
</Grid>
</Border>
</StackPanel>
</EgtWPFLib5:EgtCustomWindow>
@@ -0,0 +1,18 @@
Public Class ChooseMachineWndV
Private WithEvents m_ChooseMachineWndVM As ChooseMachineWndVM
Sub New(Owner As Window, ChooseMachineWndVM As ChooseMachineWndVM)
MyBase.New(Owner)
' This call is required by the designer.
InitializeComponent()
Me.DataContext = ChooseMachineWndVM
' Assegno al riferimento locale al VM il VM preso dal DataContext
m_ChooseMachineWndVM = ChooseMachineWndVM
End Sub
Private Sub CloseWindow(bDialogResult As Boolean) Handles m_ChooseMachineWndVM.m_CloseWindow
Me.DialogResult = bDialogResult
End Sub
End Class
@@ -0,0 +1,77 @@
Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtUILib
Imports EgtWPFLib5
Public Class ChooseMachineWndVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
Friend Event m_CloseWindow(bDialogResult As Boolean)
' recupero la lista delle Macchine da MachinePanel
Private m_MachineList As ObservableCollection(Of Machine) = Map.refMachinePanelVM.MachineList
Public ReadOnly Property MachineList As ObservableCollection(Of Machine)
Get
Return m_MachineList
End Get
End Property
' La Macchina selezionata di default sarà quella correntemente selezionata in MachinePanel
Private m_SelMachine As Machine = MachineList.FirstOrDefault(Function(x) x.Name = Map.refMachinePanelVM.SelectedMachine.Name)
Public Property SelMachine As Machine
Get
Return m_SelMachine
End Get
Set(value As Machine)
If value IsNot m_SelMachine Then
m_SelMachine = value
End If
End Set
End Property
' Definizione comandi
Private m_cmdOk As ICommand
#End Region ' FIELDS & PROPERTIES
#Region "MESSAGES"
Public ReadOnly Property ChooseMachine_Msg As String
Get
Return "Macchina: "
End Get
End Property
#End Region ' MESSAGES
#Region "COMMANDS"
#Region "Ok"
Public ReadOnly Property Ok_Command As ICommand
Get
If m_cmdOk Is Nothing Then
m_cmdOk = New Command(AddressOf Ok)
End If
Return m_cmdOk
End Get
End Property
Public Sub Ok()
If Not IsNothing(SelMachine) Then
' setto la macchina
Map.refMachinePanelVM.SelectedMachine = MachineList(MachineList.IndexOf(SelMachine))
RaiseEvent m_CloseWindow(True)
Else
' se non seleziono nessuna macchina lo segnalo con un MessageBox
MessageBox.Show("No machine selected", "Error", MessageBoxButton.OK, MessageBoxImage.Error)
End If
End Sub
#End Region ' Ok
#End Region ' COMMANDS
End Class
+3
View File
@@ -133,6 +133,9 @@
' parametri riferimento
Public Const KEY_REFERENCE = "Reference"
' macchina in progetto
Public Const KEY_MACHINE_NAME = "MachineName"
Public Const FILE_PATH = "FilePath"
End Module
@@ -89,7 +89,6 @@ Public Class CurrMachining
If Guid.TryParse(sCurrGuid, m_sCurrGUID) Then
Dim CurrMachiningInDb As MachiningIndex = Map.refTopPanelVM.MachiningList.FirstOrDefault(Function(x) x.sGUID = m_sCurrGUID)
If IsNothing(CurrMachiningInDb) Then
MessageBox.Show("Machining not found in Db!", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning)
m_nIndex = 0
Else
m_nIndex = CurrMachiningInDb.nIndex
+8
View File
@@ -90,6 +90,10 @@
<Compile Include="AboutBoxWindow\AboutBoxV.xaml.vb">
<DependentUpon>AboutBoxV.xaml</DependentUpon>
</Compile>
<Compile Include="ChooseMachineWnd\ChooseMachineWndV.xaml.vb">
<DependentUpon>ChooseMachineWndV.xaml</DependentUpon>
</Compile>
<Compile Include="ChooseMachineWnd\ChooseMachineWndVM.vb" />
<Compile Include="ChooseReferenceWnd\ChooseReferenceWndV.xaml.vb">
<DependentUpon>ChooseReferenceWndV.xaml</DependentUpon>
</Compile>
@@ -262,6 +266,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="ChooseMachineWnd\ChooseMachineWndV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="ChooseReferenceWnd\ChooseReferenceWndV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
+12 -6
View File
@@ -11,15 +11,21 @@
<Grid Margin="0,0,5,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<!--<TextBlock Grid.Row="0" Grid.Column="0" Text="Macchina corrente" VerticalAlignment="Center" Margin="0,0,5,0"/>-->
<!--Combobox per selezionare la macchina corrente-->
<ComboBox ItemsSource="{Binding Path=MachineList}" DisplayMemberPath="Name"
SelectedItem="{Binding Path=SelectedMachine}" SelectedValuePath="Name"
Height="22" Width="150"
Grid.Row="0" Grid.Column="1"/>
<!--<ComboBox ItemsSource="{Binding Path=MachineList}"
SelectedItem="{Binding Path=SelectedMachine}"
DisplayMemberPath="Name"
SelectedValuePath="Name"
Height="22" Width="150"
Grid.Row="0" Grid.Column="1"/>-->
<!--<Rectangle HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Fill="LightGray"/>-->
<TextBlock Text="{Binding SelectedMachine.Name}"
Style="{StaticResource OptionTextBlock}"/>
</Grid>
<!--<StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Center">
<Button Command="{Binding ToolDbCommand}" ToolTip="{Binding ToolDBToolTip}"
+19 -2
View File
@@ -148,7 +148,7 @@ Public Class ProjManagerVM
Public ReadOnly Property New_Command As ICommand
Get
If m_cmdNew Is Nothing Then
m_cmdNew = New Command(AddressOf NewProject)
m_cmdNew = New Command(AddressOf NewProjectCmd)
End If
Return m_cmdNew
End Get
@@ -157,7 +157,24 @@ Public Class ProjManagerVM
''' <summary>
''' Execute the Save. This method is invoked by the SaveCommand.
''' </summary>
Public Sub NewProject()
Public Sub NewProjectCmd()
NewProject(True)
End Sub
Friend Sub NewProject(bDialog As Boolean)
Dim NewProjMachine As Machine
If bDialog AndAlso Map.refMachinePanelVM.MachineList.Count > 0 Then
Dim ChooseMachineWndVM As New ChooseMachineWndVM
Dim ChooseMachineWnd As New ChooseMachineWndV(Application.Current.MainWindow, ChooseMachineWndVM)
Dim bResult As Boolean = ChooseMachineWnd.ShowDialog()
If IsNothing(bResult) OrElse Not bResult Then Return
NewProjMachine = ChooseMachineWndVM.SelMachine
Else
NewProjMachine = Map.refMachinePanelVM.SelectedMachine
End If
' imposto la macchina
Map.refMachinePanelVM.SelectedMachine = NewProjMachine
' creo nuovo progetto
Map.refSceneHostVM.MainController.NewProject(True)
NotifyPropertyChanged(NameOf(MruFileNames))
End Sub
+1 -1
View File
@@ -60,7 +60,7 @@ Public Class SecondaryWindowVM
Map.refMyStatusBarVM.SetMeasureUnit(EgtUiUnitsAreMM)
EgtSetView(VT.ISO_SW, False)
' creo nuovo progetto di partenza
Map.refProjManagerVM.NewProject()
Map.refProjManagerVM.NewProject(False)
' leggo stati visualizzazione layer
Map.refViewLayerManagerVM.UpdateIsVisibleFromIni()
' resetto segnalazione modifiche
+9 -6
View File
@@ -8,12 +8,13 @@ Public Class SliceManagerVM
Private Enum CalcSteps As Integer
NULL = 0
SLICING = 1
CALC_PATHS = 2
CALC_TOOLPATHS = 3
CALC_SOLIDS = 4
CALCTSF = 5
GENERATE = 6
CALC_INTERSECTIONS = 1
SLICING = 2
CALC_PATHS = 3
CALC_TOOLPATHS = 4
CALC_SOLIDS = 5
CALCTSF = 6
GENERATE = 7
End Enum
' variabile che indica se sono in corso i calcoli
@@ -44,6 +45,8 @@ Public Class SliceManagerVM
Public ReadOnly Property sLoadingText As String
Get
Select Case m_SliceManagerState
Case CalcSteps.CALC_INTERSECTIONS
Return "Calculating Intersections..."
Case CalcSteps.SLICING
Return "Slicing..."
Case CalcSteps.CALC_PATHS
+15 -3
View File
@@ -222,8 +222,12 @@ Public Class TopPanelVM
Return m_SelMachining
End Get
Set(value As MachiningIndex)
' verifico se vecchia modificata e chiedo se salvare?
If Not IsNothing(value) Then
' verifico se selezionata none
If Not IsNothing(m_SelMachining) AndAlso m_SelMachining.sGUID = MachiningIndex.Empty().sGUID AndAlso value.sGUID <> MachiningIndex.Empty().sGUID AndAlso m_MachiningList.Contains(MachiningIndex.Empty()) Then
' e la rimuovo
m_MachiningList.Remove(MachiningIndex.Empty())
End If
WriteMainPrivateProfileString(S_PRINTING3D, K_CURRMACHINING, value.sGUID.ToString())
' imposto selezionata come corrente
If Not IsNothing(m_SelPart) AndAlso (IsNothing(m_SelMachining) OrElse value.sGUID <> m_SelMachining.sGUID) Then
@@ -234,6 +238,16 @@ Public Class TopPanelVM
End Set
End Property
Friend Sub SetSelMachining(SelMachining As MachiningIndex)
' verifico se precedentemente selezionata none
If Not IsNothing(m_SelMachining) AndAlso m_SelMachining.sGUID = MachiningIndex.Empty().sGUID AndAlso SelMachining.sGUID <> MachiningIndex.Empty().sGUID AndAlso m_MachiningList.Contains(MachiningIndex.Empty()) Then
' e la rimuovo
m_MachiningList.Remove(MachiningIndex.Empty())
End If
' se nuova lavorazione e' none
If SelMachining.sGUID = Guid.Empty Then
' aggiungo lavorazione vuota
MachiningList.Insert(0, MachiningIndex.Empty())
End If
m_SelMachining = SelMachining
NotifyPropertyChanged(NameOf(SelMachining))
End Sub
@@ -316,8 +330,6 @@ Public Class TopPanelVM
Friend Sub InitMachiningsList()
If IsNothing(m_SelMaterial) Then Return
MachiningList.Clear()
' aggiungo lavorazione vuota
MachiningList.Add(MachiningIndex.Empty())
' leggo ed aggiungo le altre
Dim nIndex As Integer = 1
Dim sGUID As String = ""
+2
View File
@@ -96,6 +96,8 @@ Public Module CurrentMachine
EgtSetName(nTabLayerId, TABLE)
Dim nTabOutlineId As Integer = EgtCreateRectangle2P(nTabLayerId, New Point3d(0, 0, 0), New Point3d(dTabX, dTabY, 0))
EgtSetName(nTabOutlineId, TABLE_OUTLINE)
' scrivo il nome macchina sulla tavola
EgtSetInfo(nTabPartId, KEY_MACHINE_NAME, CurrentMachine.sMachineName)
' Ripristino stato segnalazione modifica
DisableMgr.ReEnable()
End Sub
+6
View File
@@ -484,6 +484,12 @@
<Setter Property="HorizontalContentAlignment" Value="Right"/>
</Style>
<Style x:Key="Name_MachinePanel" TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}">
<Setter Property="Height" Value="22"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Right"/>
</Style>
<!-- ______________________________________________________________________________________________________________________________________________ -->
<!-- MachGroup -->