Files
OmagCUT/BarCodeWD.xaml.vb
T
Dario Sassi 69b0eff518 OmagCUT 1.9e4 :
- modifiche per lettura barcode.
2018-05-18 07:16:56 +00:00

53 lines
1.9 KiB
VB.net

Imports System.IO
Imports EgtUILib
Imports EgtWPFLib
Public Class BarCodeWD
' Riferimento alla MainWindow
Private m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow)
Sub New(Owner As Window)
Me.Owner = Owner
InitializeComponent()
End Sub
Private Sub SaveNameWD_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
Me.Top = Owner.Top + Owner.Height / 2 - Me.Height / 2
Me.Left = Owner.Left + Owner.Width / 2 - Me.Width / 2
BarCodeTxbl.Text = EgtMsg(90881) 'Codice a barre
End Sub
Private Sub SaveNameWD_Rendered(sender As Object, e As EventArgs) Handles Me.ContentRendered
BarCodeTxBx.Focus()
BarCodeTxBx.OpenKeyboard(BarCodeTxBx, BarCodeTxBx)
End Sub
Private Sub OkBtn_Click(sender As Object, e As RoutedEventArgs) Handles OkBtn.Click
Dim nRawId As Integer = GetCurrentRaw()
If nRawId <> GDB_ID.NULL Then
' Cancello eventuale vecchio BarCode
EgtErase(EgtGetFirstNameInGroup(nRawId, NAME_BARCODE))
' Se definito, inserisco nuovo BarCode
If Not String.IsNullOrWhiteSpace(BarCodeTxBx.Text) Then
Dim ptRawCen As Point3d
GetRawCenter(ptRawCen)
Dim ptRawMin, ptRawMax As Point3d
GetRawBox(ptRawMin, ptRawMax)
Dim ptText As New Point3d(ptRawCen.x, ptRawCen.y, ptRawMax.z)
Dim nText As Integer = EgtCreateTextAdv(nRawId, ptText, 0, BarCodeTxBx.Text, "", 500, False, 50.0, 1, 0, INS_POS.MC, GDB_RT.GLOB)
EgtSetName(nText, NAME_BARCODE)
EgtSetColor(nText, New Color3d(255, 0, 0))
End If
' Aggiorno visualizzazione
EgtDraw()
End If
Close()
End Sub
Private Sub ExitBtn_Click(sender As Object, e As RoutedEventArgs) Handles ExitBtn.Click
Close()
End Sub
End Class