59 lines
1.5 KiB
C#
59 lines
1.5 KiB
C#
using System;
|
|
using System.Windows.Input;
|
|
using System.Windows.Threading;
|
|
|
|
namespace Xylem.Common.Production.ProductionUiCordonel.UserControls
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for UcDialog.xaml
|
|
/// </summary>
|
|
public partial class UcBarcodeInput : IUserControl
|
|
{
|
|
public event EventHandler<String> OnBarcodeInput;
|
|
|
|
public UcBarcodeInput()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Clear display for retry
|
|
/// </summary>
|
|
public void Clear()
|
|
{
|
|
Dispatcher.Invoke(DispatcherPriority.Send,
|
|
new Action(() =>
|
|
{
|
|
tbxScan.Text = "";
|
|
}
|
|
));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Set the focus to the text input box to enable scanner as keyboard IO
|
|
/// </summary>
|
|
internal void FocusMe()
|
|
{
|
|
Dispatcher.Invoke(DispatcherPriority.Send,
|
|
new Action(() =>
|
|
{
|
|
tbxScan.Focus();
|
|
}
|
|
));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Act on input and fire event it at [Return] key delimiter of line
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void txtHiddenInput_KeyDown(Object sender, KeyEventArgs e)
|
|
{
|
|
if (e.Key == Key.Enter)
|
|
{
|
|
OnBarcodeInput?.Invoke(sender, tbxScan.Text);
|
|
}
|
|
}
|
|
}
|
|
}
|