123 lines
2.9 KiB
C#
123 lines
2.9 KiB
C#
using System;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Input;
|
|
using System.Windows.Threading;
|
|
|
|
namespace ProductionUiCordonelLegacy.UserControls.FinalTest
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for UcDialog.xaml
|
|
/// </summary>
|
|
public partial class UcBarcodeInput : UserControl
|
|
{
|
|
|
|
public event EventHandler<String> BarcodeInput;
|
|
|
|
public UcBarcodeInput()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public class DialogOption
|
|
{
|
|
public DialogOption(String headLine, String desc, Action selectedAction)
|
|
{
|
|
HeadLine = headLine;
|
|
Desc = desc;
|
|
SelectedAction = selectedAction;
|
|
}
|
|
private Action SelectedAction;
|
|
private String HeadLine = "Hl";
|
|
private String Desc = "descr";
|
|
public UIElement GeneratBtn()
|
|
{
|
|
var btn = new Button();
|
|
btn.Content = HeadLine;
|
|
btn.Click += (sender, args) => { SelectedAction.Invoke(); };
|
|
|
|
return btn;
|
|
|
|
}
|
|
|
|
public UIElement GeneratInfo()
|
|
{
|
|
var lbl = new Label();
|
|
lbl.Content = Desc;
|
|
lbl.Width = 800;
|
|
return lbl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
internal void SetDesc(String v)
|
|
{
|
|
lblDescription.Dispatcher.Invoke(DispatcherPriority.Send,
|
|
new Action(() =>
|
|
{
|
|
|
|
lblDescription.Content = v;
|
|
}
|
|
));
|
|
|
|
SetFocusMe();
|
|
}
|
|
|
|
internal void SetFocusMe()
|
|
{
|
|
Dispatcher.Invoke(DispatcherPriority.Send,
|
|
new Action(() =>
|
|
{
|
|
txtHiddenInput.Focus();
|
|
}
|
|
));
|
|
}
|
|
|
|
public void inputKey(String input)
|
|
{
|
|
Dispatcher.Invoke(DispatcherPriority.Send,
|
|
new Action(() =>
|
|
{
|
|
BarcodeInput?.Invoke(this,input);
|
|
}
|
|
));
|
|
}
|
|
|
|
private void txtHiddenInput_KeyDown(Object sender, KeyEventArgs e)
|
|
{
|
|
//if (e.Key == Key.Enter)
|
|
//{
|
|
|
|
// BarcodeInput?.Invoke(sender, e);
|
|
//}
|
|
//else
|
|
//{
|
|
// lblInput.Content = txtHiddenInput.Text;
|
|
//}
|
|
|
|
|
|
}
|
|
|
|
private void UserControl_MouseDown(Object sender, MouseButtonEventArgs e)
|
|
{
|
|
Dispatcher.Invoke(DispatcherPriority.Send,
|
|
new Action(() =>
|
|
{
|
|
//txtHiddenInput.Focus();
|
|
}
|
|
));
|
|
}
|
|
|
|
private void LblInput_MouseDown(Object sender, MouseButtonEventArgs e)
|
|
{
|
|
Dispatcher.Invoke(DispatcherPriority.Send,
|
|
new Action(() =>
|
|
{
|
|
//txtHiddenInput.Focus();
|
|
}
|
|
));
|
|
}
|
|
}
|
|
}
|