5a5229821a
- corretta visualizzazione spessore lastra dopo tastatura per mm/inches - corretta visualizzazione min e max spessore materiale per mm/inches in lavorazioni - corretta visualizzazione step archi interni ed esterni per mm/inches in lavorazione lama - correzioni varie a componenti interni.
231 lines
8.5 KiB
VB.net
231 lines
8.5 KiB
VB.net
Imports EgtUILib
|
|
|
|
Public Class CompoDimensionUC
|
|
|
|
' Constants
|
|
Private Const NUM_VAR As Integer = 10
|
|
|
|
'Riferimento alla MainWindow
|
|
Private m_MainWindow As MainWindow = Application.Current.MainWindow
|
|
|
|
' Riferimento alla pagina Draw
|
|
Private m_DrawPage As DrawPageUC
|
|
|
|
' Riferimento alla pagina di selezione dei componenti interni
|
|
Friend m_InternalCompoPage As InternalComponentPageUC
|
|
|
|
Private Sub CompoDimensionUC_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
|
|
'Creazione delle Page UserControl
|
|
m_InternalCompoPage = New InternalComponentPageUC
|
|
'Posizionemento nella griglia delle Page UserControl
|
|
m_InternalCompoPage.SetValue(Grid.ColumnSpanProperty, 2)
|
|
m_InternalCompoPage.SetValue(Grid.RowSpanProperty, 4)
|
|
|
|
InternComponentBtn.Content = EgtMsg(MSG_COMPONENTPAGEUC + 37) ' Componenti interni
|
|
AddBtn.Content = EgtMsg(MSG_COMPONENTPAGEUC + 38) ' Aggiungi
|
|
CancelBtn.Content = EgtMsg(MSG_COMPONENTPAGEUC + 39) ' Rimuovi
|
|
End Sub
|
|
|
|
Private Sub CompoDimensionUC_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
|
|
' Riferimento alla drawPage
|
|
m_DrawPage = m_MainWindow.m_DrawPageUC
|
|
|
|
' Imposto questa come pagina correntemente visualizzata nella drawpage
|
|
m_DrawPage.m_ActiveComponentPage = DrawPageUC.Pages.CompoDimension
|
|
|
|
' Se componente interno disabilito il bottone di ok della drawpage
|
|
If m_DrawPage.m_bInternalCompo Then
|
|
m_DrawPage.OkBtn.IsEnabled = False
|
|
End If
|
|
' se componenti con buchi interni visualizzo bottoni appositi
|
|
Dim sCompo As String = m_DrawPage.sCompoName.Substring(0, m_DrawPage.sCompoName.Length - 6)
|
|
If sCompo = "PCucina" Or sCompo = "PBagno" Then
|
|
ShowInternalBtn(True)
|
|
Else
|
|
ShowInternalBtn(False)
|
|
End If
|
|
|
|
' Se componente interno visualizzo bottoni aggiungi rimuovi
|
|
ShowAddRemoveBtn(m_DrawPage.m_bInternalCompo)
|
|
|
|
' Imposto contesto corrente e faccio uno ZoomAll della scena con il componente
|
|
EgtSetCurrentContext(m_MainWindow.m_DrawPageUC.DrawScene.GetCtx())
|
|
EgtZoom(ZM.ALL)
|
|
|
|
End Sub
|
|
|
|
Private Sub CompoDimensionUC_Unloaded(sender As Object, e As RoutedEventArgs) Handles Me.Unloaded
|
|
m_DrawPage.OkBtn.IsEnabled = True
|
|
End Sub
|
|
|
|
Friend Sub ShowInternalBtn(value As Boolean)
|
|
If value Then
|
|
InternComponentBtn.Visibility = Windows.Visibility.Visible
|
|
Else
|
|
InternComponentBtn.Visibility = Windows.Visibility.Hidden
|
|
End If
|
|
End Sub
|
|
|
|
Friend Sub ShowAddRemoveBtn(value As Boolean)
|
|
If value Then
|
|
m_DrawPage.SideAngleBtn.Visibility = Windows.Visibility.Hidden
|
|
m_DrawPage.BackBtn.Visibility = Windows.Visibility.Hidden
|
|
AddBtn.Visibility = Windows.Visibility.Visible
|
|
CancelBtn.Visibility = Windows.Visibility.Visible
|
|
Else
|
|
m_DrawPage.SideAngleBtn.Visibility = Windows.Visibility.Visible
|
|
m_DrawPage.BackBtn.Visibility = Windows.Visibility.Visible
|
|
AddBtn.Visibility = Windows.Visibility.Hidden
|
|
CancelBtn.Visibility = Windows.Visibility.Hidden
|
|
End If
|
|
End Sub
|
|
|
|
Friend Function GetNameEdit(ByVal nInd As Integer) As TextBlock
|
|
Select Case nInd
|
|
Case 1
|
|
Return Label1
|
|
Case 2
|
|
Return Label2
|
|
Case 3
|
|
Return Label3
|
|
Case 4
|
|
Return Label4
|
|
Case 5
|
|
Return Label5
|
|
Case 6
|
|
Return Label6
|
|
Case 7
|
|
Return Label7
|
|
Case 8
|
|
Return Label8
|
|
Case 9
|
|
Return Label9
|
|
Case Else
|
|
Return Label10
|
|
End Select
|
|
End Function
|
|
|
|
Friend Function GetValueEdit(ByVal nInd As Integer) As TextBox
|
|
Select Case nInd
|
|
Case 1
|
|
Return TextBox1
|
|
Case 2
|
|
Return TextBox2
|
|
Case 3
|
|
Return TextBox3
|
|
Case 4
|
|
Return TextBox4
|
|
Case 5
|
|
Return TextBox5
|
|
Case 6
|
|
Return TextBox6
|
|
Case 7
|
|
Return TextBox7
|
|
Case 8
|
|
Return TextBox8
|
|
Case 9
|
|
Return TextBox9
|
|
Case Else
|
|
Return TextBox10
|
|
End Select
|
|
End Function
|
|
|
|
Private Sub EgtTextBox_EgtOpening(sender As Object, e As RoutedEventArgs) Handles TextBox9.EgtOpening, TextBox10.EgtOpening
|
|
Dim SelectedTextBox As TextBox = e.Source
|
|
Select Case SelectedTextBox.Name
|
|
Case "TextBox9"
|
|
' Indice variabile associata al bottone
|
|
Dim nI As Integer = m_DrawPage.GetDefinedVarCount() - (NUM_VAR - 9) - 1
|
|
' Recupero tipo della variabile associata
|
|
If m_DrawPage.CVars(nI).m_nType = 1 Then
|
|
TextBox9.IsReadOnly = True
|
|
If TextBox9.Text = "False" Then
|
|
TextBox9.Text = "True"
|
|
Else
|
|
TextBox9.Text = "False"
|
|
End If
|
|
TextBox9.ActivateCalculator = False
|
|
m_DrawPage.UpdateView()
|
|
Else
|
|
TextBox9.ActivateCalculator = True
|
|
TextBox9.IsReadOnly = False
|
|
End If
|
|
Case "TextBox10"
|
|
' Indice variabile associata al bottone
|
|
Dim nI As Integer = m_DrawPage.GetDefinedVarCount() - (NUM_VAR - 10) - 1
|
|
' Recupero tipo della variabile associata
|
|
If m_DrawPage.CVars(nI).m_nType = 1 Then
|
|
TextBox10.IsReadOnly = True
|
|
If TextBox10.Text = "False" Then
|
|
TextBox10.Text = "True"
|
|
Else
|
|
TextBox10.Text = "False"
|
|
End If
|
|
TextBox10.ActivateCalculator = False
|
|
m_DrawPage.UpdateView()
|
|
Else
|
|
TextBox10.ActivateCalculator = True
|
|
TextBox10.IsReadOnly = False
|
|
End If
|
|
End Select
|
|
End Sub
|
|
|
|
Private Sub EgtCalculator_EgtClosed(sender As Object, e As EventArgs) Handles TextBox1.EgtClosed, TextBox2.EgtClosed, TextBox3.EgtClosed, TextBox4.EgtClosed, TextBox5.EgtClosed, TextBox6.EgtClosed, TextBox7.EgtClosed, TextBox8.EgtClosed,
|
|
TextBox9.EgtClosed, TextBox10.EgtClosed
|
|
m_DrawPage.UpdateView()
|
|
End Sub
|
|
|
|
Private Sub InternComponentBtn_Click(sender As Object, e As RoutedEventArgs) Handles InternComponentBtn.Click
|
|
' imposto contesto
|
|
EgtSetCurrentContext(m_DrawPage.DrawScene.GetCtx())
|
|
' Nascondo layer etichette e quotature
|
|
Dim Pz As Integer = EgtGetFirstGroupInGroup(GDB_ID.ROOT)
|
|
EgtSetStatus(EgtGetFirstNameInGroup(Pz, "LayAux"), GDB_ST.OFF)
|
|
EgtSetStatus(EgtGetFirstNameInGroup(Pz, "Etichette"), GDB_ST.OFF)
|
|
EgtSetStatus(EgtGetFirstNameInGroup(Pz, "Quotature"), GDB_ST.OFF)
|
|
EgtDraw()
|
|
|
|
m_DrawPage.VariablesGrd.Children.Remove(Me)
|
|
m_DrawPage.m_bInternalCompo = True
|
|
m_DrawPage.LeftButtonGrd.Children.Add(m_InternalCompoPage)
|
|
End Sub
|
|
|
|
Private Sub AddBtn_Click(sender As Object, e As RoutedEventArgs) Handles AddBtn.Click
|
|
' Se componente errato, non faccio alcunché
|
|
If Not m_DrawPage.m_bDrawOk Then Return
|
|
' Esco dalla pagina
|
|
m_DrawPage.VariablesGrd.Children.Remove(Me)
|
|
m_DrawPage.LeftButtonGrd.Children.Add(m_InternalCompoPage)
|
|
' Reset componente
|
|
m_MainWindow.m_DrawPageUC.ResetCompoName()
|
|
' Deseleziono oggetto corrente e aggiorno visualizzazione
|
|
EgtDeselectAll()
|
|
EgtDraw()
|
|
End Sub
|
|
|
|
Private Sub CancelBtn_Click(sender As Object, e As RoutedEventArgs) Handles CancelBtn.Click
|
|
' Se trovo componente corrente, lo cancello
|
|
Dim nCmp As Integer = 0
|
|
If EgtLuaGetGlobIntVar(DrawPageUC.LUA_CMP_INDEX, nCmp) And nCmp > 0 Then
|
|
Dim sCmp As String = nCmp.ToString()
|
|
' Lancio cancellazione
|
|
If Not EgtLuaExecLine(DrawPageUC.LUA_REMOVEHOLE & "(" & nCmp & ")") Then
|
|
EgtOutLog("Error in RemoveHole execution")
|
|
Return
|
|
End If
|
|
' altrimenti è errato ed è già stato cancellato, resetto errore di disegno
|
|
Else
|
|
m_DrawPage.m_bDrawOk = True
|
|
End If
|
|
' Sistemo interfaccia
|
|
m_DrawPage.VariablesGrd.Children.Remove(Me)
|
|
m_DrawPage.LeftButtonGrd.Children.Add(m_InternalCompoPage)
|
|
' Reset componente
|
|
m_MainWindow.m_DrawPageUC.ResetCompoName()
|
|
' Deseleziono oggetto corrente e aggiorno visualizzazione
|
|
EgtDeselectAll()
|
|
EgtDraw()
|
|
End Sub
|
|
|
|
End Class
|