Imports System.IO
Imports EgtUILib
Imports EgtWPFLib

Public Class BarCodeWD

   ' Riferimento alla MainWindow
   Private m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow)
   Private m_sBarCode As String = ""

   Sub New(Owner As Window)
      Me.Owner = Owner
      InitializeComponent()
   End Sub

   Friend Function GetBarCode() As String
      Return m_sBarCode
   End Function

   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
      m_sBarCode = BarCodeTxBx.Text
      DialogResult = True
   End Sub

   Private Sub ExitBtn_Click(sender As Object, e As RoutedEventArgs) Handles ExitBtn.Click
      m_sBarCode = ""
      DialogResult = False
   End Sub

End Class
