diff --git a/CompoWindow/CompoParamPage/CompoParamPageV.xaml b/CompoWindow/CompoParamPage/CompoParamPageV.xaml
index bf51cc1..9c58e41 100644
--- a/CompoWindow/CompoParamPage/CompoParamPageV.xaml
+++ b/CompoWindow/CompoParamPage/CompoParamPageV.xaml
@@ -12,10 +12,12 @@
Margin="0,0,0,5">
+ Style="{StaticResource CompoWindow_ToggleButton}"
+ Margin="0,0,2.5,0"/>
diff --git a/DxfImportWindow/DxfImportSceneHostV.xaml.vb b/DxfImportWindow/DxfImportSceneHostV.xaml.vb
index 07451d3..a038108 100644
--- a/DxfImportWindow/DxfImportSceneHostV.xaml.vb
+++ b/DxfImportWindow/DxfImportSceneHostV.xaml.vb
@@ -3,11 +3,28 @@ Imports EgtWPFLib5
Public Class DxfImportSceneHostV
+ ' Variabilee che contiene l'entità selezionata
+ Friend m_nSelectedPart As Integer = GDB_ID.NULL
+ ' Evento che viene lanciato quando cambia il pezzo selezionato
+ Public Event SelectedPartChanged(ByVal nPartId As Integer)
+ ' Proprietà che lancia l'evento quando cambia il valore della variabile
+ Private Property nSelectedPart As Integer
+ Get
+ Return m_nSelectedPart
+ End Get
+ Set(value As Integer)
+ m_nSelectedPart = value
+ RaiseEvent SelectedPartChanged(value)
+ End Set
+ End Property
+ 'Variabile che contiene l'entità selezionata precedente
+ Friend m_PrevSelPart As Integer = GDB_ID.NULL
+
Sub New()
' This call is required by the designer.
InitializeComponent()
- ' Imposto riferimento
- DxfImportWindowVM.m_refDxfImportSceneHostV = Me
+ ' Creo riferimento a questa classe in CompoWindowMap
+ DxfImportWindowMap.SetRefDxfImportSceneHostV(Me)
' Inizializzazione Scena
PreInitializeScene()
ImportDxfScene.Init()
@@ -84,4 +101,44 @@ Public Class DxfImportSceneHostV
EgtSetGridShow(bShowGrid, False)
End Sub
+#Region "EVENTS"
+
+ Private Sub OnMouseDownScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles ImportDxfScene.OnMouseDownScene
+ ' Solo con il tasto sinistro e se stato NULL
+ If e.Button <> Windows.Forms.MouseButtons.Left Or Not ImportDxfScene.IsStatusNull() Then Return
+ If Not DxfImportWindowMap.refDxfImportWindowVM.VerifyIfSelectPart() Then Return
+ ' Verifico se selezionato indicativo di pezzo
+ EgtSetObjFilterForSelWin(True, True, True, True, True)
+ Dim nSel As Integer
+ EgtSelect(e.Location, Scene.DIM_SEL, Scene.DIM_SEL, nSel)
+ Dim nId As Integer = EgtGetFirstObjInSelWin()
+ While nId <> GDB_ID.NULL
+ ' Recupero l'identificativo del pezzo cui appartiene
+ Dim nPartId As Integer = EgtGetParent(EgtGetParent(nId))
+ If EgtIsPart(nPartId) Then
+ Dim nStat As Integer = GDB_ST.ON_
+ EgtGetStatus(nPartId, nStat)
+ If nStat = GDB_ST.SEL Then
+ EgtDeselectObj(nPartId)
+ m_PrevSelPart = nSelectedPart
+ nSelectedPart = GDB_ID.NULL
+ Else
+ EgtDeselectAll()
+ EgtSelectObj(nPartId)
+ m_PrevSelPart = nSelectedPart
+ nSelectedPart = nPartId
+ End If
+ EgtDraw()
+ Exit While
+ End If
+ nId = EgtGetNextObjInSelWin()
+ End While
+ End Sub
+
+ Private Sub Me_SelectedPartChanged(nPartId As Integer) Handles Me.SelectedPartChanged
+ DxfImportWindowMap.refDxfImportWindowVM.SelectedPartChanged()
+ End Sub
+
+#End Region ' EVENTS
+
End Class
diff --git a/DxfImportWindow/DxfImportWindowMap.vb b/DxfImportWindow/DxfImportWindowMap.vb
new file mode 100644
index 0000000..01269b6
--- /dev/null
+++ b/DxfImportWindow/DxfImportWindowMap.vb
@@ -0,0 +1,45 @@
+Friend Module DxfImportWindowMap
+
+ Private m_refDxfImportWindowVM As DxfImportWindowVM
+ Private m_refDxfImportSceneHostV As DxfImportSceneHostV
+
+#Region "Get"
+
+ Public ReadOnly Property refDxfImportWindowVM As DxfImportWindowVM
+ Get
+ Return m_refDxfImportWindowVM
+ End Get
+ End Property
+
+ Public ReadOnly Property refDxfImportSceneHostV As DxfImportSceneHostV
+ Get
+ Return m_refDxfImportSceneHostV
+ End Get
+ End Property
+
+#End Region ' Get
+
+#Region "Set"
+
+ Friend Function SetRefDxfImportSceneHostV(DxfImportSceneHostV As DxfImportSceneHostV) As Boolean
+ m_refDxfImportSceneHostV = DxfImportSceneHostV
+ Return Not IsNothing(m_refDxfImportSceneHostV)
+ End Function
+
+#End Region ' Set
+
+#Region "Init"
+
+ Friend Function BeginInit(DxfImportWindowVM As DxfImportWindowVM) As Boolean
+ m_refDxfImportWindowVM = DxfImportWindowVM
+ Return Not IsNothing(m_refDxfImportWindowVM)
+ End Function
+
+ Friend Function EndInit() As Boolean
+ ' Verifico se tutti i pezzi necessari sono stati caricati
+ Return Not IsNothing(m_refDxfImportWindowVM) AndAlso Not IsNothing(m_refDxfImportSceneHostV)
+ End Function
+
+#End Region ' Init
+
+End Module
diff --git a/DxfImportWindow/DxfImportWindowV.xaml b/DxfImportWindow/DxfImportWindowV.xaml
index d2a1d4a..7c1e9c6 100644
--- a/DxfImportWindow/DxfImportWindowV.xaml
+++ b/DxfImportWindow/DxfImportWindowV.xaml
@@ -10,14 +10,21 @@
-
+
-
+
-
+
-
-
-
-
-
+
+
+
+
-
+
-
+
+
+
diff --git a/DxfImportWindow/DxfImportWindowVM.vb b/DxfImportWindow/DxfImportWindowVM.vb
index d98b37c..0852285 100644
--- a/DxfImportWindow/DxfImportWindowVM.vb
+++ b/DxfImportWindow/DxfImportWindowVM.vb
@@ -11,8 +11,38 @@ Public Class DxfImportWindowVM
Private m_sFilePath As String = String.Empty
Private m_nFileType As Integer = FT.NULL
- ' Riferimento alla scena di import
- Friend Shared m_refDxfImportSceneHostV As DxfImportSceneHostV = Nothing
+ Private m_Open_IsEnabled As Boolean = True
+ Public Property Open_IsEnabled As Boolean
+ Get
+ Return m_Open_IsEnabled
+ End Get
+ Set(value As Boolean)
+ m_Open_IsEnabled = value
+ NotifyPropertyChanged("Open_IsEnabled")
+ End Set
+ End Property
+
+ Private m_Type_IsEnabled As Boolean = False
+ Public Property Type_IsEnabled As Boolean
+ Get
+ Return m_Type_IsEnabled
+ End Get
+ Set(value As Boolean)
+ m_Type_IsEnabled = value
+ NotifyPropertyChanged("Type_IsEnabled")
+ End Set
+ End Property
+
+ Private m_Measure_IsEnabled As Boolean = False
+ Public Property Measure_IsEnabled As Boolean
+ Get
+ Return m_Measure_IsEnabled
+ End Get
+ Set(value As Boolean)
+ m_Measure_IsEnabled = value
+ NotifyPropertyChanged("Measure_IsEnabled")
+ End Set
+ End Property
Private m_OkIsEnabled As Boolean = False
Public Property OkIsEnabled As Boolean
@@ -69,14 +99,76 @@ Public Class DxfImportWindowVM
End Set
End Property
- Private m_SideAngleIsEnabled As Boolean = False
- Public Property SideAngleIsEnabled As Boolean
+ Friend m_SideAngleEntityList As List(Of SideEntity)
+ Friend m_DripEntityList As List(Of SideEntity)
+
+ Private m_SideEntity_IsEnabled As Boolean = False
+ Public Property SideEntity_IsEnabled As Boolean
Get
- Return m_SideAngleIsEnabled
+ Return m_SideEntity_IsEnabled
End Get
Set(value As Boolean)
- m_SideAngleIsEnabled = value
- NotifyPropertyChanged("SideAngleIsEnabled")
+ m_SideEntity_IsEnabled = value
+ NotifyPropertyChanged("SideEntity_IsEnabled")
+ End Set
+ End Property
+
+ Private m_SideAngle_IsChecked As Boolean
+ Private m_SideEntityControlVM As SideEntityControlVM
+ Public Property SideAngle_IsChecked As Boolean
+ Get
+ Return m_SideAngle_IsChecked
+ End Get
+ Set(value As Boolean)
+ If m_Drip_IsChecked Then Return
+ m_SideAngle_IsChecked = value
+ If value Then
+ m_SideEntityControlVM = New SideEntityControlVM(SideEntityControlVM.CallingWindowOpt.DXFIMPORT, DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene, SideEntityControlVM.ModeOpt.SIDEANGLE, m_SideAngleEntityList)
+ SideEntityControl = New SideEntityControlV(m_SideEntityControlVM)
+ Open_IsEnabled = False
+ Type_IsEnabled = False
+ Measure_IsEnabled = False
+ OkIsEnabled = False
+ Else
+ m_SideAngleEntityList = m_SideEntityControlVM.SideEntityList.ToList
+ m_SideEntityControlVM.Close()
+ Open_IsEnabled = True
+ Type_IsEnabled = True
+ Measure_IsEnabled = True
+ OkIsEnabled = True
+ m_SideEntityControlVM = Nothing
+ SideEntityControl = Nothing
+ End If
+ NotifyPropertyChanged("SideAngle_IsChecked")
+ End Set
+ End Property
+
+ Private m_Drip_IsChecked As Boolean
+ Public Property Drip_IsChecked As Boolean
+ Get
+ Return m_Drip_IsChecked
+ End Get
+ Set(value As Boolean)
+ If m_SideAngle_IsChecked Then Return
+ m_Drip_IsChecked = value
+ If value Then
+ SideEntityControl = New SideEntityControlV(New SideEntityControlVM(SideEntityControlVM.CallingWindowOpt.COMPO, CompoWindowMap.refCompoSceneHostV.CompoScene, SideEntityControlVM.ModeOpt.DRIP, m_DripEntityList))
+ Else
+ m_DripEntityList = DirectCast(SideEntityControl.DataContext, SideEntityControlVM).SideEntityList.ToList
+ SideEntityControl = Nothing
+ End If
+ NotifyPropertyChanged("Drip_IsChecked")
+ End Set
+ End Property
+
+ Private m_SideEntityControl As SideEntityControlV
+ Public Property SideEntityControl As SideEntityControlV
+ Get
+ Return m_SideEntityControl
+ End Get
+ Set(value As SideEntityControlV)
+ m_SideEntityControl = value
+ NotifyPropertyChanged("SideEntityControl")
End Set
End Property
@@ -88,7 +180,9 @@ Public Class DxfImportWindowVM
Set(value As Boolean)
If value <> m_MmIsChecked Then
m_MmIsChecked = value
- LoadCurrFile()
+ If Not String.IsNullOrWhiteSpace(m_sFilePath) Then
+ LoadCurrFile()
+ End If
End If
End Set
End Property
@@ -192,6 +286,15 @@ Public Class DxfImportWindowVM
#End Region ' FIELDS & PROPERTIES
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ ' Avvio l'inizializzazione della mappa passandogli il riferimento al DxfImportWindowVM
+ DxfImportWindowMap.BeginInit(Me)
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
#Region "METHODS"
Private Function LoadCurrFile() As Boolean
@@ -217,7 +320,7 @@ Public Class DxfImportWindowVM
UseClosedCurveIsEnabled = True
ResetIsEnabled = False
OkIsEnabled = False
- SideAngleIsEnabled = False
+ SideEntity_IsEnabled = False
' Eseguo zoom
EgtZoom(ZM.ALL)
Return True
@@ -227,7 +330,7 @@ Public Class DxfImportWindowVM
' Scrivo testi per nesting
'm_SideAngleUC.WriteSideAngleForNest(ImportScene.GetCtx())
' Imposto riferimento sul centro geometrico di ogni pezzo
- VeinMatching.SetRefOnAllParts(m_refDxfImportSceneHostV.ImportDxfScene.GetCtx())
+ VeinMatching.SetRefOnAllParts(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
' Eventuale pulizia VeinMatching
VeinMatching.Clear()
' Vettore nomi file temporanei
@@ -283,6 +386,18 @@ Public Class DxfImportWindowVM
EgtZoom(ZM.ALL)
End Sub
+ Friend Function VerifyIfSelectPart() As Boolean
+ ' Solo se in modalità angoli o gocciolatoio su lati esterni
+ Return (SideAngle_IsChecked Or Drip_IsChecked)
+ End Function
+
+ Friend Sub SelectedPartChanged()
+ ' Se sono in modalità inclinazioni o gocciolatoio calcolo lati inclinabili e creo testi
+ If SideAngle_IsChecked() Or Drip_IsChecked() Then
+ m_SideEntityControlVM.ReLoadSideAnglePage(SideEntityControlVM.CallingWindowOpt.DXFIMPORT)
+ End If
+ End Sub
+
#End Region ' METHODS
#Region "COMMANDS"
@@ -313,6 +428,8 @@ Public Class DxfImportWindowVM
WriteMainPrivateProfileString(S_FLATPARTS, K_FLPCURRDIR, Path.GetDirectoryName(m_sFilePath))
' Carico il file
LoadCurrFile()
+ Type_IsEnabled = True
+ Measure_IsEnabled = True
End Sub
#End Region ' OpenDxfCommand
@@ -342,7 +459,7 @@ Public Class DxfImportWindowVM
ResetIsEnabled = True
OkIsEnabled = True
' abilito bottone angoli su lati esterni
- SideAngleIsEnabled = True
+ SideEntity_IsEnabled = True
End Sub
#End Region ' UseRegionCommand
@@ -372,7 +489,7 @@ Public Class DxfImportWindowVM
ResetIsEnabled = True
OkIsEnabled = True
' abilito bottone angoli su lati esterni
- SideAngleIsEnabled = True
+ SideEntity_IsEnabled = True
End Sub
#End Region ' UseLayerCommand
@@ -402,7 +519,7 @@ Public Class DxfImportWindowVM
ResetIsEnabled = True
OkIsEnabled = True
' abilito bottone angoli su lati esterni
- SideAngleIsEnabled = True
+ SideEntity_IsEnabled = True
End Sub
#End Region ' UseClosedCurveCommand
@@ -421,6 +538,8 @@ Public Class DxfImportWindowVM
Public Sub Reset(ByVal param As Object)
' Ricarico file corrente
LoadCurrFile()
+ ' abilito bottone angoli su lati esterni
+ SideEntity_IsEnabled = False
End Sub
#End Region ' ResetCommand
diff --git a/OmagOFFICE.vbproj b/OmagOFFICE.vbproj
index d74164f..56ff843 100644
--- a/OmagOFFICE.vbproj
+++ b/OmagOFFICE.vbproj
@@ -157,6 +157,7 @@
+ CsvWindowV.xaml
diff --git a/SideEntityControl/SideEntityControlVM.vb b/SideEntityControl/SideEntityControlVM.vb
index 1448f31..bb5fcc8 100644
--- a/SideEntityControl/SideEntityControlVM.vb
+++ b/SideEntityControl/SideEntityControlVM.vb
@@ -150,6 +150,7 @@ Public Class SideEntityControlVM
Sub New(CallingWindow As CallingWindowOpt, CallingWndScene As Scene, Mode As ModeOpt, SideEntityList As List(Of SideEntity))
SideAngleEntity.m_ModifySideAngle = AddressOf ModifySideAngle
SideAngleEntity.m_RefreshSideAngleText = AddressOf RefreshSideAngleText
+ m_CallingWindow = CallingWindow
m_CallingWndScene = CallingWndScene
m_Mode = Mode
m_SideEntityList = If(IsNothing(SideEntityList), New ObservableCollection(Of SideEntity), New ObservableCollection(Of SideEntity)(SideEntityList))
@@ -191,10 +192,15 @@ Public Class SideEntityControlVM
' Inizializzo lati per angoli (ne compilo la lista e aggiungo la scritta nel disegno)
InitSides()
RefreshSideAngleText()
+ If m_Mode = ModeOpt.SIDEANGLE Then
+ Dim nSelectedPart As Integer = DxfImportWindowMap.refDxfImportSceneHostV.m_nSelectedPart
+ If nSelectedPart <> GDB_ID.NULL Then
+ EgtSelectObj(nSelectedPart)
+ ReLoadSideAnglePage(SideEntityControlVM.CallingWindowOpt.DXFIMPORT)
+ End If
+ End If
End If
- '' Gestisco Checkbox e nomi in base al numero di lati inclinabili
- 'TxBlChBxView()
' Gestisco visualizzazione dei parametri
If m_Mode = ModeOpt.SIDEANGLE Then
Parameter23_Visibility = Windows.Visibility.Hidden
@@ -679,6 +685,76 @@ Public Class SideEntityControlVM
'A10.IsChecked = False
End Sub
+ Friend Sub ReLoadSideAnglePage(CallingWindow As CallingWindowOpt)
+ ' Ricavo nome pezzo precedentemente selezionato
+ Dim Part1 As Integer = DxfImportWindowMap.refDxfImportSceneHostV.m_PrevSelPart
+ EgtErase(EgtGetFirstNameInGroup(Part1, SIDE_ANGLE_LAYER))
+
+ m_SideEntityList.Clear()
+
+ If CallingWindow = CallingWindowOpt.COMPO Then
+
+ ' Imposto contesto corrente
+ EgtSetCurrentContext(m_CallingWndScene.GetCtx())
+ ' se la lista non è vuota la leggo e metto le inclinazioni giuste
+ If m_Mode = ModeOpt.SIDEANGLE Then
+ If m_SideEntityList.Count > 0 Then
+ ' Aggiorno indici che potrebbero essere cambiati se sono state modificate le misure
+ RefreshGeomId()
+ ' Aggiorno testi in base alla tabella
+ RefreshSideAngleText()
+ ' Aggiorno check e valori
+ 'RefreshCheckAndValue()
+ Else
+ ' Inizializzo lati per angoli (ne compilo la lista e aggiungo la scritta nel disegno)
+ InitSides()
+ End If
+ Else
+ If m_SideEntityList.Count > 0 Then
+ ' Aggiorno indici che potrebbero essere cambiati se sono state modificate le misure
+ RefreshGeomId()
+ ' Aggiorno testi in base alla tabella
+ RefreshSideAngleText()
+ Else
+ ' Inizializzo lati per angoli (ne compilo la lista e aggiungo la scritta nel disegno)
+ InitSides()
+ End If
+ End If
+
+ ElseIf CallingWindow = CallingWindowOpt.DXFIMPORT Then
+ ' Imposto contesto corrente
+ EgtSetCurrentContext(m_CallingWndScene.GetCtx())
+ ' Inizializzo
+ DeleteSideAngle()
+ ' Inizializzo lati per angoli (ne compilo la lista e aggiungo la scritta nel disegno)
+ InitSides()
+ RefreshSideAngleText()
+ End If
+
+ ' Gestisco visualizzazione dei parametri
+ If m_Mode = ModeOpt.SIDEANGLE Then
+ Parameter23_Visibility = Windows.Visibility.Hidden
+ Else
+ Parameter23_Visibility = Windows.Visibility.Visible
+ End If
+
+ ' Aggiorno valori
+ If m_Mode = ModeOpt.SIDEANGLE Then
+ Parameter1Msg = EgtMsg(MSG_IMPORTPAGEUC + 9) ' Angolo
+ Dim sVal As String = String.Empty
+ GetMainPrivateProfileString(S_SIDES, K_SIDEANGLE, "45", sVal)
+ SetParameter1(sVal)
+ Else
+ Parameter1Msg = EgtMsg(MSG_IMPORTPAGEUC + 10) ' Offset
+ m_dDripOffset = GetMainPrivateProfileDouble(S_SIDES, K_DRIPOFFSET, 20)
+ m_dDripDepth = GetMainPrivateProfileDouble(S_SIDES, K_DRIPDEPTH, 10)
+ m_dDripShort = GetMainPrivateProfileDouble(S_SIDES, K_DRIPSHORT, 0)
+ SetParameter1(LenToString(m_dDripOffset, 3))
+ SetParameter2(LenToString(m_dDripDepth, 3))
+ SetParameter3(LenToString(m_dDripShort, 3))
+ End If
+ End Sub
+
Friend Sub Close()
If m_CallingWindow = CallingWindowOpt.COMPO Then
' Ricavo nome primo pezzo
@@ -690,15 +766,12 @@ Public Class SideEntityControlVM
' Svuoto layer in cui sono presenti i testi con le inclinazioni dei lati
If m_Mode = ModeOpt.SIDEANGLE Then
EgtEmptyGroup(EgtGetFirstNameInGroup(Part1, SIDE_ANGLE_LAYER))
- EgtSaveFile("C:\Temp\rrrr.nge", NGE.CMPTEXT)
- Else
- EgtEmptyGroup(EgtGetFirstNameInGroup(Part1, SIDE_ANGLE_LAYER))
End If
-
ElseIf m_CallingWindow = CallingWindowOpt.DXFIMPORT Then
- '' Ricavo nome pezzo precedentemente selezionato
- 'Dim Part1 As Integer = m_MainWindow.m_ImportPageUC.m_PrevSelPart
- 'EgtErase(EgtGetFirstNameInGroup(Part1, SIDE_ANGLE_LAYER))
+ ' Ricavo nome pezzo precedentemente selezionato
+ Dim Part1 As Integer = DxfImportWindowMap.refDxfImportSceneHostV.m_nSelectedPart
+ EgtErase(EgtGetFirstNameInGroup(Part1, SIDE_ANGLE_LAYER))
+ EgtDeselectAll()
End If
If m_Mode = ModeOpt.SIDEANGLE Then
@@ -709,7 +782,6 @@ Public Class SideEntityControlVM
WriteMainPrivateProfileString(S_SIDES, K_DRIPSHORT, DoubleToString(m_dDripShort, 3))
End If
- Dim x = EgtSetCurrentContext(m_CallingWndScene.GetCtx())
EgtDraw()
End Sub