Files
OmagCUT/CompoDimensionUC.xaml.vb
T
Emmanuele Sassi dc95f91044 OmagCUT :
- Cambiata gestione variabili all'interno della DrawPage:
  Ora ci sono due pagine una per le misure ed una per le inclinazioni.
- Aggiunta gestione inclinazioni nei componenti.
2016-02-22 11:21:01 +00:00

139 lines
4.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
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
' Nascondo bottoni per componenti interni
InternComponentBtn.Visibility = Windows.Visibility.Hidden
AddBtn.Visibility = Windows.Visibility.Hidden
CancelBtn.Visibility = Windows.Visibility.Hidden
' 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
End Sub
Friend Function ShowInternalBtn() As Boolean
InternComponentBtn.Visibility = Windows.Visibility.Visible
AddBtn.Visibility = Windows.Visibility.Visible
CancelBtn.Visibility = Windows.Visibility.Visible
Return True
End Function
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
End Class