8f912cae70
- Miglioramento comunicazione per prove su macchina. - Aggiunto componente checkbox nel dictionary. - Usato checkbox per parametro di lavorazione inveti.
110 lines
4.5 KiB
VB.net
110 lines
4.5 KiB
VB.net
Partial Class OmagCUTDictionary
|
|
Inherits ResourceDictionary
|
|
|
|
Dim m_MainWindow As MainWindow = Application.Current.MainWindow
|
|
|
|
' Evento della TextBox con Style che permette di aprire in automatico la calcolatrice
|
|
Friend Sub NumericKeyboard_PreviewMouseDown(sender As Object, e As MouseButtonEventArgs)
|
|
Dim NumericKeyboardWD As New NumericKeyboardWD
|
|
NumericKeyboardWD.Owner = m_MainWindow
|
|
' Se presente recupero label associata alla TextBox selezionata per scrivere il titolo
|
|
m_MainWindow.m_NumericKeyboardWD = NumericKeyboardWD
|
|
NumericKeyboardWD.m_CurrentTxBx = e.Source
|
|
Dim AssocLabel As Label = NumericKeyboardWD.m_CurrentTxBx.Tag
|
|
If IsNothing(AssocLabel) Then
|
|
NumericKeyboardWD.m_CurrentLbl = ""
|
|
Else
|
|
NumericKeyboardWD.m_CurrentLbl = AssocLabel.Content
|
|
End If
|
|
' Imposto nome nel Title e valore nella TextBox
|
|
NumericKeyboardWD.NumericKeyboardWDTextBox.Text = NumericKeyboardWD.m_CurrentTxBx.Text
|
|
NumericKeyboardWD.NumericKeyboardWDTitle.Text = NumericKeyboardWD.m_CurrentLbl
|
|
' Imposto Dimensioni e posizione della calcolatrice
|
|
NumericKeyboardWD.Top = m_MainWindow.Top + (m_MainWindow.Height / 12)
|
|
NumericKeyboardWD.Left = m_MainWindow.Left + (m_MainWindow.Width / 15 * 3)
|
|
NumericKeyboardWD.Height = m_MainWindow.Height / 12 * 5
|
|
NumericKeyboardWD.Width = m_MainWindow.Width / 15 * 5
|
|
' Visualizzo
|
|
NumericKeyboardWD.ShowDialog()
|
|
|
|
End Sub
|
|
|
|
Friend Sub Keyboard_PreviewMouseDown(sender As Object, e As MouseButtonEventArgs)
|
|
Dim Keyboard As New Keyboard
|
|
Keyboard.Owner = m_MainWindow
|
|
' Se presente recupero label associata alla TextBox selezionata per scrivere il titolo
|
|
Keyboard.m_CurrTxBx = e.Source
|
|
Dim AssocLabel As Label = Keyboard.m_CurrTxBx.Tag
|
|
If IsNothing(AssocLabel) Then
|
|
Keyboard.m_CurrTxBl = ""
|
|
Else
|
|
Keyboard.m_CurrTxBl = AssocLabel.Content
|
|
End If
|
|
' Imposto nome nel Title e valore nella TextBox
|
|
Keyboard.CurrTextTxBx.Text = Keyboard.m_CurrTxBx.Text
|
|
Keyboard.CurrNameTxBl.Text = Keyboard.m_CurrTxBl
|
|
' Imposto Dimensioni e posizione della calcolatrice
|
|
Keyboard.Top = m_MainWindow.Top + (m_MainWindow.Height / 2 - Keyboard.Height / 2)
|
|
Keyboard.Left = m_MainWindow.Left + (m_MainWindow.Width / 2 - Keyboard.Width / 2)
|
|
'Keyboard.Height = m_MainWindow.Height / 12 * 5
|
|
'Keyboard.Width = m_MainWindow.Width / 15 * 5
|
|
' Visualizzo
|
|
Keyboard.ShowDialog()
|
|
|
|
End Sub
|
|
|
|
' Evento della TextBox con Style che permette di aggiornare in automatico il componente con il nuovo valore
|
|
Private Sub NumericKeyboard_TextChanged(sender As Object, e As TextChangedEventArgs)
|
|
Select Case m_MainWindow.m_ActivePage
|
|
Case MainWindow.Pages.Draw
|
|
If Not m_MainWindow.m_DrawPageUC.m_bShowVar Then
|
|
m_MainWindow.m_DrawPageUC.UpdateView()
|
|
End If
|
|
Case MainWindow.Pages.RawPart
|
|
If Not m_MainWindow.m_RawPartPage.m_bShowVar Then
|
|
m_MainWindow.m_RawPartPage.UpdateRawPart()
|
|
End If
|
|
End Select
|
|
End Sub
|
|
|
|
End Class
|
|
|
|
Namespace ArithmeticConverterNameSpace
|
|
|
|
Public Class CheckboxConverter
|
|
Implements IMultiValueConverter
|
|
|
|
Public Function Convert(values() As Object, targetType As Type, parameter As Object, culture As Globalization.CultureInfo) As Object Implements IMultiValueConverter.Convert
|
|
If values.Length <> 2 Then
|
|
Throw New ArgumentException("There should be three values.")
|
|
End If
|
|
|
|
If String.IsNullOrEmpty(values(0).ToString) Then
|
|
values(0) = "0"
|
|
End If
|
|
|
|
If String.IsNullOrEmpty(values(1).ToString()) Then
|
|
values(2) = "0"
|
|
End If
|
|
|
|
Dim x As Double
|
|
If Not Double.TryParse(values(0).ToString(), x) Then
|
|
Throw New ArgumentException("values[0] must parse to double")
|
|
End If
|
|
|
|
Dim y As Double
|
|
If Not Double.TryParse(values(1).ToString(), y) Then
|
|
Throw New ArgumentException("values[0] must parse to double")
|
|
End If
|
|
|
|
Return (x / y) - 1
|
|
|
|
End Function
|
|
|
|
Public Function ConvertBack(value As Object, targetTypes() As Type, parameter As Object, culture As Globalization.CultureInfo) As Object() Implements IMultiValueConverter.ConvertBack
|
|
Throw New NotImplementedException()
|
|
End Function
|
|
End Class
|
|
|
|
End Namespace
|