Imports System.Collections.ObjectModel
Imports EgtUILib

Public Class CompoTrfData

   ' 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 CompoTrfData_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
      OrdCodeTxBl.Text = EgtMsg(MSG_DRAWPAGEUC + 10)    'Order Code
      OrdDescTxBl.Text = EgtMsg(MSG_DRAWPAGEUC + 11)    'Order Description
      PartCodeTxBl.Text = EgtMsg(MSG_DRAWPAGEUC + 16)   'Part Code
      MatCodeTxBl.Text = EgtMsg(MSG_DRAWPAGEUC + 12)    'Material Code
      SurfCodeTxBl.Text = EgtMsg(MSG_DRAWPAGEUC + 13)   'Surface Code
      ThicknessTxBl.Text = EgtMsg(MSG_DRAWPAGEUC + 14)  'Thickness
   End Sub

   Private Sub OkBtn_Click(sender As Object, e As RoutedEventArgs) Handles OkBtn.Click
      DialogResult = True
      Close()
   End Sub

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

   Friend Sub SetData(sOrdCode As String, sOrdDesc As String, sPartCode As String, sMatCode As String, sSurfCode As String, dTh As Double)
      OrdCodeTxBx.Text = sOrdCode
      OrdDescTxBx.Text = sOrdDesc
      PartCodeTxBx.Text = sPartCode
      MatCodeTxBx.Text = sMatCode
      SurfCodeTxBx.Text = sSurfCode
      ThicknessTxBx.Text = LenToString(dTh, 2)
   End Sub

   Friend Sub GetData(ByRef sOrdCode As String, ByRef sOrdDesc As String, ByRef sPartCode As String, ByRef sMatCode As String, ByRef sSurfCode As String, ByRef dTh As Double)
      sOrdCode = OrdCodeTxBx.Text
      sOrdDesc = OrdDescTxBx.Text
      sPartCode = PartCodeTxBx.Text
      sMatCode = MatCodeTxBx.Text
      sSurfCode = SurfCodeTxBx.Text
      StringToLen(ThicknessTxBx.Text, dTh)
   End Sub

End Class