diff --git a/Constants/ConstIni.vb b/Constants/ConstIni.vb index 784e6aa..c35f867 100644 --- a/Constants/ConstIni.vb +++ b/Constants/ConstIni.vb @@ -77,6 +77,7 @@ Module ConstIni Public Const S_COMPO As String = "Compo" Public Const K_COMPODIR As String = "CompoDir" + Public Const K_SIDEMODE As String = "SideMode" Public Const S_FLATPARTS As String = "FlatParts" Public Const K_FLPCURRDIR As String = "CurrDir" diff --git a/OptionWindow/OptionWindowV.xaml b/OptionWindow/OptionWindowV.xaml index 78a16aa..af8d33a 100644 --- a/OptionWindow/OptionWindowV.xaml +++ b/OptionWindow/OptionWindowV.xaml @@ -10,6 +10,10 @@ + + + + @@ -27,7 +31,14 @@ SelectedIndex="{Binding SelMeasureUnit}" Height="25"/> - + + + + + diff --git a/OptionWindow/OptionWindowVM.vb b/OptionWindow/OptionWindowVM.vb index 2136c66..8c808ee 100644 --- a/OptionWindow/OptionWindowVM.vb +++ b/OptionWindow/OptionWindowVM.vb @@ -33,6 +33,26 @@ Public Class OptionWindowVM End Get End Property + Private m_SideModeList As List(Of String) + Public ReadOnly Property SideModeList As List(Of String) + Get + Return m_SideModeList + End Get + End Property + + Private m_SelSideModeIndex As Integer + Public Property SelSideModeIndex As Integer + Get + Return m_SelSideModeIndex + End Get + Set(value As Integer) + If value <> m_SelSideModeIndex Then + m_SelSideModeIndex = value + WriteMainPrivateProfileString(S_COMPO, K_SIDEMODE, m_SelSideModeIndex) + End If + End Set + End Property + Public Property SelMeasureUnit As Integer Get Return If(EgtUiUnitsAreMM(), MeasureUnitOpt.MM, MeasureUnitOpt.INCH) @@ -78,6 +98,12 @@ Public Class OptionWindowVM End Get End Property + Public ReadOnly Property SideAngleHdr As String + Get + Return EgtMsg(MSG_OPTIONSPAGEUC + 5) + End Get + End Property + #End Region #End Region ' FIELDS & PROPERTIES @@ -99,6 +125,10 @@ Public Class OptionWindowVM End If nIndex += 1 End While + ' Carico messaggi per lista tipologie di definizione angolo d'inclinazione + m_SideModeList = New List(Of String)({EgtMsg(MSG_OPTIONSPAGEUC + 6), EgtMsg(MSG_OPTIONSPAGEUC + 7)}) + ' Carico valore da file ini + m_SelSideModeIndex = GetMainPrivateProfileInt(S_COMPO, K_SIDEMODE, 0) End Sub #End Region ' CONSTRUCTOR diff --git a/SideEntityControl/SideEntityControlV.xaml b/SideEntityControl/SideEntityControlV.xaml index 3f3acce..14a3e5e 100644 --- a/SideEntityControl/SideEntityControlV.xaml +++ b/SideEntityControl/SideEntityControlV.xaml @@ -16,13 +16,17 @@ + - + diff --git a/SideEntityControl/SideEntityControlVM.vb b/SideEntityControl/SideEntityControlVM.vb index bb5fcc8..8393f12 100644 --- a/SideEntityControl/SideEntityControlVM.vb +++ b/SideEntityControl/SideEntityControlVM.vb @@ -23,6 +23,8 @@ Public Class SideEntityControlVM ' Variabile che indica se sono in sideangle o drip Friend m_Mode As ModeOpt + Friend Shared m_SideAngleCheck As Boolean = False + ' Lista di tutte le entità inclinabili presenti nel progetto Private m_SideEntityList As ObservableCollection(Of SideEntity) Public Property SideEntityList As ObservableCollection(Of SideEntity) @@ -45,6 +47,21 @@ Public Class SideEntityControlVM End Set End Property + Private m_Parameter1_Visibility As Visibility + Public ReadOnly Property Parameter1_Visibility As Visibility + Get + If m_Mode = ModeOpt.SIDEANGLE Then + If m_SideAngleCheck Then + Return Visibility.Visible + Else + Return Visibility.Collapsed + End If + Else + Return Visibility.Visible + End If + End Get + End Property + Private m_Parameter1 As Double Public Property Parameter1 As String Get @@ -155,6 +172,7 @@ Public Class SideEntityControlVM m_Mode = Mode m_SideEntityList = If(IsNothing(SideEntityList), New ObservableCollection(Of SideEntity), New ObservableCollection(Of SideEntity)(SideEntityList)) NotifyPropertyChanged("SideEntityList") + m_SideAngleCheck = If(GetMainPrivateProfileInt(S_COMPO, K_SIDEMODE, 0) = 0, True, False) If CallingWindow = CallingWindowOpt.COMPO Then ' Imposto contesto corrente @@ -480,13 +498,13 @@ Public Class SideEntityControlVM Dim sEntityName As String = String.Empty EgtGetName(CurrLine, sEntityName) If m_CallingWindow = CallingWindowOpt.COMPO Then - m_SideEntityList.Add(New SideAngleEntity(CurrLine, sEntityName, TextLayer, 0)) + m_SideEntityList.Add(New SideAngleEntity(CurrLine, sEntityName, TextLayer, 0, m_Mode)) ' Cancello inclinazione nell'apposito campo info EgtRemoveInfo(CurrLine, INFO_SIDE_ANGLE) ' Creo testo con angolo di inclinazione 0 AddTextToLine(sEntityName & " = 0°", TextLayer, CurrLine, 10, dBBoxRad, True) Else - m_SideEntityList.Add(New SideAngleEntity(CurrLine, sEntityName, TextLayer, dSideAngleVal)) + m_SideEntityList.Add(New SideAngleEntity(CurrLine, sEntityName, TextLayer, dSideAngleVal, m_Mode)) ' Creo testo con angolo di inclinazione 0 AddTextToLine(sEntityName & " = " & DoubleToString(dSideAngleVal, 1) & "°", TextLayer, CurrLine, 10, dBBoxRad, True) End If @@ -507,13 +525,13 @@ Public Class SideEntityControlVM Dim sEntityName As String = String.Empty EgtGetName(CurrLine, sEntityName) If m_CallingWindow = CallingWindowOpt.COMPO Then - m_SideEntityList.Add(New DripEntity(CurrLine, sEntityName, TextLayer, False)) + m_SideEntityList.Add(New DripEntity(CurrLine, sEntityName, TextLayer, False, m_Mode)) ' Cancello gocciolatoio nell'apposito campo info EgtRemoveInfo(CurrLine, INFO_HAVE_DRIP) ' Creo testo entità AddTextToLine(sEntityName, TextLayer, CurrLine, 10, dBBoxRad, True) Else - m_SideEntityList.Add(New DripEntity(CurrLine, sEntityName, TextLayer, bHaveDripVal)) + m_SideEntityList.Add(New DripEntity(CurrLine, sEntityName, TextLayer, bHaveDripVal, m_Mode)) ' Creo testo con angolo di inclinazione 0 AddTextToLine(sEntityName, TextLayer, CurrLine, 10, dBBoxRad, True) End If @@ -816,12 +834,43 @@ Public MustInherit Class SideEntity End Get End Property + Private m_Mode As SideEntityControlVM.ModeOpt + Public ReadOnly Property Value_Visibility As Visibility + Get + If m_Mode = SideEntityControlVM.ModeOpt.SIDEANGLE Then + If SideEntityControlVM.m_SideAngleCheck Then + Return Visibility.Collapsed + Else + Return Visibility.Visible + End If + Else + Return Visibility.Visible + End If + End Get + End Property + + 'Private m_Check_Visibility As Visibility + Public ReadOnly Property Check_Visibility As Visibility + Get + If m_Mode = SideEntityControlVM.ModeOpt.SIDEANGLE Then + If SideEntityControlVM.m_SideAngleCheck Then + Return Visibility.Visible + Else + Return Visibility.Collapsed + End If + Else + Return Visibility.Visible + End If + End Get + End Property + Public MustOverride Property bIsChecked As Boolean - Sub New(nId As Integer, sEntityName As String, nTextId As Integer) + Sub New(nId As Integer, sEntityName As String, nTextId As Integer, Mode As SideEntityControlVM.ModeOpt) m_nGeomId = nId m_sEntityName = sEntityName m_nTextId = nTextId + m_Mode = Mode End Sub End Class @@ -834,6 +883,25 @@ Friend Class SideAngleEntity Friend Shared m_RefreshSideAngleText As Action Private m_dSideAngle As Double + Public Property GrphSideAngle As String + Get + Return DoubleToString(m_dSideAngle, 2) + End Get + Set(value As String) + If value <> m_dSideAngle Then + If Not String.IsNullOrWhiteSpace(value) Then + StringToDouble(value, m_dSideAngle) + Else + ' altrimenti lo imposto a zero + m_dSideAngle = 0 + End If + ' Lo modifico nella geometria e nella lista inclinazioni + m_ModifySideAngle(sEntityName, dSideAngle) + ' Aggiorno tutti i testi + m_RefreshSideAngleText() + End If + End Set + End Property Public Property dSideAngle As Double Get Return m_dSideAngle @@ -864,8 +932,8 @@ Friend Class SideAngleEntity End Set End Property - Sub New(nId As Integer, sEntityName As String, nTextId As Integer, dSideAngle As Double) - MyBase.New(nId, sEntityName, nTextId) + Sub New(nId As Integer, sEntityName As String, nTextId As Integer, dSideAngle As Double, Mode As SideEntityControlVM.ModeOpt) + MyBase.New(nId, sEntityName, nTextId, Mode) m_dSideAngle = dSideAngle End Sub @@ -906,8 +974,8 @@ Friend Class DripEntity End Set End Property - Sub New(nId As Integer, sEntityName As String, nTextId As Integer, bHaveDrip As Boolean) - MyBase.New(nId, sEntityName, nTextId) + Sub New(nId As Integer, sEntityName As String, nTextId As Integer, bHaveDrip As Boolean, Mode As SideEntityControlVM.ModeOpt) + MyBase.New(nId, sEntityName, nTextId, Mode) m_bHaveDrip = bHaveDrip End Sub