- Modifica del nome lavorazione

This commit is contained in:
Emmanuele Sassi
2022-10-19 09:00:43 +02:00
parent ff5ce8be86
commit bd6327586e
3 changed files with 78 additions and 64 deletions
+20 -50
View File
@@ -48,7 +48,7 @@ Public Class Machining
End Get
End Property
Friend Sub UpdateIsModified()
m_bIsModified = m_CathegoryList.Any(Function(x) x.MachiningParamList.Any(Function(y) y.bIsModified))
m_bIsModified = m_CathegoryList.Any(Function(x) x.MachiningParamList.Any(Function(y) y.bIsModified)) OrElse bIsModifiedName
NotifyPropertyChanged(NameOf(ghName))
End Sub
@@ -69,6 +69,7 @@ Public Class Machining
End Set
End Property
Private m_sOrigName As String = ""
Protected m_sName As String = ""
Public Property sName As String
Get
@@ -77,7 +78,7 @@ Public Class Machining
Set(value As String)
m_sName = value
Map.refMachiningDbVM.SetNameVisibility(False)
NotifyPropertyChanged(NameOf(ghName))
UpdateIsModified()
End Set
End Property
Public ReadOnly Property ghName As String
@@ -85,6 +86,11 @@ Public Class Machining
Return m_sName & If(m_bIsModified, "*", "")
End Get
End Property
Public ReadOnly Property bIsModifiedName As Boolean
Get
Return m_sName <> m_sOrigName
End Get
End Property
Sub New()
End Sub
@@ -98,6 +104,7 @@ Public Class Machining
m_sGUID = Guid.NewGuid.ToString()
m_sName = "PrintingParam"
End If
m_sOrigName = m_sName
m_CathegoryList.Add(New MachiningCathegory(MachiningCathegory.Cathegories.GENERAL, nIndex))
m_CathegoryList.Add(New MachiningCathegory(MachiningCathegory.Cathegories.LINK, nIndex))
m_CathegoryList.Add(New MachiningCathegory(MachiningCathegory.Cathegories.RIBS, nIndex))
@@ -111,13 +118,6 @@ Public Class Machining
Next
End Sub
'Sub New(nIndex As Integer, sGUID As String, sName As String)
' m_nIndex = nIndex
' m_sName = sName
' m_sGUID = sGUID
' ReadAllParams()
'End Sub
Sub New(sName As String, bSlicing45 As Boolean, dStrandH As Double, dStrandW As Double, nStrandCount As Integer, dOffset As Double, dStartPointOffsetOnSlice As Double,
dStrandOrder As MPAR_STRANDORDERS, dDirection As MPAR_DIRECTIONS, dLinkType As MPAR_LINKTYPES, dLinkParam As Double, dLinkZup As Double, dOffsetLeadPoint As Double,
dLeadIn As MPAR_LEADINOUT, dLeadInTangDist As Double, dLeadInOrthoDist As Double, dLeadOut As MPAR_LEADINOUT, dLeadOutTangDist As Double, dLeadOutOrthoDist As Double,
@@ -128,45 +128,14 @@ Public Class Machining
End Sub
'Private Sub ReadAllParams()
' m_bSlicing45 = ReadMachiningParamDouble(m_nIndex, MAC_SLICING45, 0)
' m_dStrandH = ReadMachiningParamDouble(m_nIndex, MAC_STRANDH, 0)
' m_dStrandW = ReadMachiningParamDouble(m_nIndex, MAC_STRANDW, 0)
' m_nStrandCount = ReadMachiningParamDouble(m_nIndex, MAC_STRANDCOUNT, 0)
' m_dOffset = ReadMachiningParamDouble(m_nIndex, MAC_OFFSET, 0)
' m_dStartPointOffsetOnSlice = ReadMachiningParamDouble(m_nIndex, MAC_STARTPOINTOFFSETONSLICE, 0)
' m_dStrandOrder = ReadMachiningParamDouble(m_nIndex, MAC_STRANDORDER, 0)
' m_dDirection = ReadMachiningParamDouble(m_nIndex, MAC_DIRECTION, 0)
' m_dLinkType = ReadMachiningParamDouble(m_nIndex, MAC_LINKTYPE, 0)
' m_dLinkParam = ReadMachiningParamDouble(m_nIndex, MAC_LINKPARAM, 0)
' m_dLinkZup = ReadMachiningParamDouble(m_nIndex, MAC_LINKZUP, 0)
' m_dOffsetLeadPoint = ReadMachiningParamDouble(m_nIndex, MAC_OFFSETLEADPOINT, 0)
' m_dLeadIn = ReadMachiningParamDouble(m_nIndex, MAC_LEADIN, 0)
' m_dLeadInTangDist = ReadMachiningParamDouble(m_nIndex, MAC_LEADINTANGDIST, 0)
' m_dLeadInOrthoDist = ReadMachiningParamDouble(m_nIndex, MAC_LEADINORTHODIST, 0)
' m_dLeadOut = ReadMachiningParamDouble(m_nIndex, MAC_LEADOUT, 0)
' m_dLeadOutTangDist = ReadMachiningParamDouble(m_nIndex, MAC_LEADOUTTANGDIST, 0)
' m_dLeadOutOrthoDist = ReadMachiningParamDouble(m_nIndex, MAC_LEADOUTORTHODIST, 0)
' m_dCoastingLen = ReadMachiningParamDouble(m_nIndex, MAC_COASTINGLEN, 0)
' m_dCoastingFeed = ReadMachiningParamDouble(m_nIndex, MAC_COASTINGFEED, 0)
' m_dWipeLen = ReadMachiningParamDouble(m_nIndex, MAC_WIPELEN, 0)
' m_dWipeFeedPu = ReadMachiningParamDouble(m_nIndex, MAC_WIPEFEEDPU, 0)
' m_dFloorCount = ReadMachiningParamDouble(m_nIndex, MAC_FLOORCOUNT, 0)
' m_dG0Feed = ReadMachiningParamDouble(m_nIndex, MAC_G0FEED, 0)
' m_dToolDiam = ReadMachiningParamDouble(m_nIndex, MAC_TOOLDIAM, 0)
' m_dRibsOverlap = ReadMachiningParamDouble(m_nIndex, MAC_RIBSOVERLAP, 0)
' m_dRibsStrandCount = ReadMachiningParamDouble(m_nIndex, MAC_RIBSSTRANDCOUNT, 0)
' m_dRibsLink = ReadMachiningParamDouble(m_nIndex, MAC_RIBSLINK, 0)
' m_dRibsInvertOrder = ReadMachiningParamDouble(m_nIndex, MAC_RIBSINVERTORDER, 0)
' m_dRibsInvertDirection = ReadMachiningParamDouble(m_nIndex, MAC_RIBSINVERTDIRECTION, 0)
' m_dRibsLeadInInvert = ReadMachiningParamDouble(m_nIndex, MAC_RIBSLEADININVERT, 0)
' m_dRibsLeadInLen = ReadMachiningParamDouble(m_nIndex, MAC_RIBSLEADINLEN, 0)
' m_dRibsLeadOutInvert = ReadMachiningParamDouble(m_nIndex, MAC_RIBSLEADOUTINVERT, 0)
' m_dRibsLeadOutLen = ReadMachiningParamDouble(m_nIndex, MAC_RIBSLEADOUTLEN, 0)
' m_dRibsLeadOutCoasting = ReadMachiningParamDouble(m_nIndex, MAC_RIBSLEADOUTCOASTING, 0)
' m_dRibsLeadOutWipe = ReadMachiningParamDouble(m_nIndex, MAC_RIBSLEADOUTWIPE, 0)
' m_dRibsLeadOutWipeDir = ReadMachiningParamDouble(m_nIndex, MAC_RIBSLEADOUTWIPEDIR, 0)
'End Sub
Private Sub SaveName()
m_sOrigName = m_sName
End Sub
Private Sub ResetName()
m_sName = m_sOrigName
NotifyPropertyChanged(NameOf(ghName))
End Sub
Friend Sub Save()
If bIsModified Then
@@ -180,12 +149,14 @@ Public Class Machining
End Sub
Private Sub SaveParams()
SaveName()
For Each Cathegory In m_CathegoryList
Cathegory.SaveParams()
Next
End Sub
Friend Sub ResetModification()
ResetName()
If bIsModified Then
' annullo le modifiche di tutti i parametri
ResetParams()
@@ -211,8 +182,7 @@ Public Class Machining
Friend Overridable Sub OnMachiningParamPropertyChanged(sender As Object, e As PropertyChangedEventArgs)
Select Case e.PropertyName
Case NameOf(sender.dValue), NameOf(sender.sValue), NameOf(sender.bValue), NameOf(sender.SelValue)
m_bIsModified = m_CathegoryList.Any(Function(x) x.MachiningParamList.Any(Function(y) y.bIsModified))
NotifyPropertyChanged(NameOf(ghName))
UpdateIsModified()
End Select
End Sub
+24 -9
View File
@@ -25,12 +25,27 @@
Command="{Binding Delete_Command}"
Style="{StaticResource ToolBar_TextButton}"/>
</UniformGrid>
<ComboBox Grid.Row="1"
Name="MachiningCombo"
ItemsSource="{Binding MachiningList}"
SelectedItem="{Binding SelMachining}"
DisplayMemberPath="ghName"/>
<Grid Grid.Row="2"
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<ComboBox Name="MachiningCombo"
ItemsSource="{Binding MachiningList}"
SelectedItem="{Binding SelMachining}"
DisplayMemberPath="ghName"
Visibility="{Binding Combo_Visibility}"
Style="{StaticResource FeatureComboBox}"/>
<EgtWPFLib5:EgtTextBox Text="{Binding SelectedItem.sName, ElementName=MachiningCombo, UpdateSourceTrigger=Explicit}"
Visibility="{Binding Name_Visibility}"
Style="{StaticResource OptionTextBox}"/>
<Button Grid.Column="1"
Command="{Binding EditName_Command}"
Style="{StaticResource ToolBar_Button}">
<Image Source="/Resources/TopPanel/Edit.png"/>
</Button>
</Grid>
<!--<Grid Grid.Row="2"
Visibility="{Binding Name_Visibility}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
@@ -40,7 +55,7 @@
<TextBlock Text="{Binding Name_Msg}"/>
<EgtWPFLib5:EgtTextBox Grid.Column="1"
Text="{Binding SelectedItem.sName, ElementName=MachiningCombo, UpdateSourceTrigger=Explicit}"/>
<!--<Button Grid.Column="2"
--><!--<Button Grid.Column="2"
Content="R"
Command="{Binding ResetParam_Command}"
CommandParameter="dCurrStrandH"
@@ -48,8 +63,8 @@
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center"
Margin="5,0,0,0"
Style="{StaticResource ToolBar_SmallButton}"/>-->
</Grid>
Style="{StaticResource ToolBar_SmallButton}"/>--><!--
</Grid>-->
<ScrollViewer Grid.Row="3"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Disabled">
+34 -5
View File
@@ -59,10 +59,13 @@ Public Class MachiningDbVM
Return m_Name_Visibility
End Get
End Property
Friend Sub SetNameVisibility(bValue As Boolean)
m_Name_Visibility = If(bValue, Visibility.Visible, Visibility.Collapsed)
NotifyPropertyChanged(NameOf(Name_Visibility))
End Sub
Private m_Combo_Visibility As Visibility = Visibility.Visible
Public ReadOnly Property Combo_Visibility As Visibility
Get
Return m_Combo_Visibility
End Get
End Property
' variabile che indica se una qualunque lavorazione e' stata modificata
Private m_bIsModified As Boolean = False
@@ -80,6 +83,7 @@ Public Class MachiningDbVM
Private m_cmdNew As ICommand
Private m_cmdSave As ICommand
Private m_cmdDelete As ICommand
Private m_cmdEditName As ICommand
#End Region ' FIELDS & PROPERTIES
@@ -109,6 +113,13 @@ Public Class MachiningDbVM
NotifyPropertyChanged(NameOf(SelMachining))
End Sub
Friend Sub SetNameVisibility(bValue As Boolean)
m_Name_Visibility = If(bValue, Visibility.Visible, Visibility.Collapsed)
m_Combo_Visibility = If(Not bValue, Visibility.Visible, Visibility.Collapsed)
NotifyPropertyChanged(NameOf(Name_Visibility))
NotifyPropertyChanged(NameOf(Combo_Visibility))
End Sub
#End Region ' METHODS
#Region "COMMANDS"
@@ -234,7 +245,7 @@ Public Class MachiningDbVM
End Property
Public Sub Delete()
If IsNothing( m_SelMachining) Then Return
If IsNothing(m_SelMachining) Then Return
' chiedo conferma
Select Case MessageBox.Show("Sei sicuro di voler cancellare la lavorazione selezionata?", "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning)
Case MessageBoxResult.Yes
@@ -247,6 +258,24 @@ Public Class MachiningDbVM
#End Region ' Delete
#Region "EditName"
Public ReadOnly Property EditName_Command As ICommand
Get
If m_cmdEditName Is Nothing Then
m_cmdEditName = New Command(AddressOf EditName)
End If
Return m_cmdEditName
End Get
End Property
Public Sub EditName()
If IsNothing(m_SelMachining) Then Return
SetNameVisibility(True)
End Sub
#End Region ' EditName
#End Region ' COMMANDS
End Class