97 lines
2.7 KiB
C#
97 lines
2.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
using System.Windows.Documents;
|
|
using System.Windows.Input;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Shapes;
|
|
|
|
namespace HighWay.PrintLable
|
|
{
|
|
/// <summary>
|
|
/// CommodityPrompt.xaml 的交互逻辑
|
|
/// </summary>
|
|
public partial class CommodityPrompt : Window
|
|
{
|
|
public CommodityPrompt(string state, string prompt)
|
|
{
|
|
InitializeComponent();
|
|
|
|
if (state == "1")
|
|
{
|
|
btn_sure.Visibility = Visibility.Collapsed;
|
|
btn_cancel.Visibility = Visibility.Collapsed;
|
|
TxtEnter.Visibility = Visibility.Collapsed;
|
|
TxtEsc.Visibility = Visibility.Collapsed;
|
|
btn_ok.Visibility = Visibility.Visible;
|
|
}
|
|
txt_prompt.Text = prompt;
|
|
btn_sure.Focus();
|
|
}
|
|
private void Button_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
System.Windows.Controls.Button keybtn = sender as System.Windows.Controls.Button;
|
|
if (keybtn.Name == "btn_close")
|
|
{
|
|
this.DialogResult = false;
|
|
this.Close();
|
|
}
|
|
else if (keybtn.Name == "btn_sure")
|
|
{
|
|
this.DialogResult = true;
|
|
this.Close();
|
|
}
|
|
else if (keybtn.Name == "btn_cancel")
|
|
{
|
|
this.DialogResult = false;
|
|
this.Close();
|
|
}
|
|
else if (keybtn.Name == "btn_ok")
|
|
{
|
|
this.DialogResult = false;
|
|
this.Close();
|
|
}
|
|
}
|
|
|
|
private void Window_KeyDown_1(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.Key == Key.Escape)
|
|
{
|
|
Button_Click(btn_close, null);
|
|
return;
|
|
}
|
|
|
|
if (e.Key == Key.Enter)
|
|
{
|
|
if (btn_sure.Visibility == Visibility.Visible)
|
|
{
|
|
Button_Click(btn_sure, null);
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
if (e.Key == Key.Enter)
|
|
{
|
|
Button_Click(btn_close, null);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
else if (e.SystemKey == Key.F4)
|
|
{
|
|
e.Handled = true;
|
|
}
|
|
}
|
|
|
|
private void Button_Click_1(object sender, RoutedEventArgs e)
|
|
{
|
|
Button_Click(btn_close, null);
|
|
}
|
|
}
|
|
}
|