From bd6327586e08cc64628bcead372dfdaa81132d61 Mon Sep 17 00:00:00 2001 From: Emmanuele Sassi Date: Wed, 19 Oct 2022 09:00:43 +0200 Subject: [PATCH 1/3] - Modifica del nome lavorazione --- Icarus/MachiningDb/Machining.vb | 70 ++++++++-------------------- Icarus/MachiningDb/MachiningDbV.xaml | 33 +++++++++---- Icarus/MachiningDb/MachiningDbVM.vb | 39 ++++++++++++++-- 3 files changed, 78 insertions(+), 64 deletions(-) diff --git a/Icarus/MachiningDb/Machining.vb b/Icarus/MachiningDb/Machining.vb index 066c953..16ddae9 100644 --- a/Icarus/MachiningDb/Machining.vb +++ b/Icarus/MachiningDb/Machining.vb @@ -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 diff --git a/Icarus/MachiningDb/MachiningDbV.xaml b/Icarus/MachiningDb/MachiningDbV.xaml index 077db9b..e20c538 100644 --- a/Icarus/MachiningDb/MachiningDbV.xaml +++ b/Icarus/MachiningDb/MachiningDbV.xaml @@ -25,12 +25,27 @@ Command="{Binding Delete_Command}" Style="{StaticResource ToolBar_TextButton}"/> - - + + + + + + + + + - + Style="{StaticResource ToolBar_SmallButton}"/>--> diff --git a/Icarus/MachiningDb/MachiningDbVM.vb b/Icarus/MachiningDb/MachiningDbVM.vb index 8d7f237..b637160 100644 --- a/Icarus/MachiningDb/MachiningDbVM.vb +++ b/Icarus/MachiningDb/MachiningDbVM.vb @@ -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 From 708ffc576db71f4fd35627c69436ed64021b30c0 Mon Sep 17 00:00:00 2001 From: Emmanuele Sassi Date: Thu, 20 Oct 2022 20:40:53 +0200 Subject: [PATCH 2/3] - Gestione disattivazione interfaccia per db materiali e lavorazioni - Focus su nome lavorazione per edit --- Icarus/MachiningDb/Machining.vb | 1 + Icarus/MachiningDb/MachiningDbV.xaml | 28 ++++++------------------ Icarus/MachiningDb/MachiningDbVM.vb | 29 +++++++++++++++++++++++++ Icarus/TopPanel/TopPanelVM.vb | 32 ++++++++++++++++++++++++++-- 4 files changed, 67 insertions(+), 23 deletions(-) diff --git a/Icarus/MachiningDb/Machining.vb b/Icarus/MachiningDb/Machining.vb index 16ddae9..80b2252 100644 --- a/Icarus/MachiningDb/Machining.vb +++ b/Icarus/MachiningDb/Machining.vb @@ -79,6 +79,7 @@ Public Class Machining m_sName = value Map.refMachiningDbVM.SetNameVisibility(False) UpdateIsModified() + Map.refMachiningDbVM.SetIsEnabled(True) End Set End Property Public ReadOnly Property ghName As String diff --git a/Icarus/MachiningDb/MachiningDbV.xaml b/Icarus/MachiningDb/MachiningDbV.xaml index e20c538..35c7ca0 100644 --- a/Icarus/MachiningDb/MachiningDbV.xaml +++ b/Icarus/MachiningDb/MachiningDbV.xaml @@ -17,12 +17,15 @@ - + ItemsSource="{Binding SelectedItem.CathegoryList, ElementName=MachiningCombo}" + IsEnabled="{Binding IsEnabled}"> @@ -188,6 +173,7 @@ + + + + - + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --> - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +