3eb8929578
- aggiunta gestione mm/inch in interfaccia utente (da fare verso macchina e in generazione CN).
79 lines
2.8 KiB
VB.net
79 lines
2.8 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)
|
|
' Recupero dati da sorgente
|
|
Dim sTitle As String = String.Empty
|
|
Dim sText As String = String.Empty
|
|
Dim TxBx As TextBox = CType(e.Source, TextBox)
|
|
If Not IsNothing(TxBx) Then
|
|
sText = TxBx.Text
|
|
Dim AssocLabel As Label = TxBx.Tag
|
|
If Not IsNothing(AssocLabel) Then
|
|
sTitle = AssocLabel.Content
|
|
End If
|
|
End If
|
|
' Creo calcolatrice
|
|
Dim NumericKeyboardWD As New NumericKeyboardWD(sTitle, sText, e.Source)
|
|
' La visualizzo
|
|
NumericKeyboardWD.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
|