You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.6 KiB
65 lines
1.6 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
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 DyeingComputer.Windows
|
|
{
|
|
/// <summary>
|
|
/// InputBox.xaml 的交互逻辑
|
|
/// </summary>
|
|
public partial class InputBox : Window
|
|
{
|
|
public InputBox()
|
|
{
|
|
InitializeComponent();
|
|
this.DataContext = this;
|
|
FocusManager.SetFocusedElement(Boxx, Boxx);
|
|
}
|
|
|
|
public string InputValue
|
|
{
|
|
get
|
|
{
|
|
return Boxx.Text;
|
|
}
|
|
set
|
|
{
|
|
this.Boxx.Text = value;
|
|
}
|
|
}
|
|
|
|
public event EventHandler Accept;
|
|
|
|
private void YES_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
var input = Boxx.Text.TrimStart(); //去除字符串前空格
|
|
if (input.Length == 0) //字长度不等于0有效
|
|
{
|
|
Boxx.Focus(); //聚焦元素
|
|
}
|
|
else
|
|
{
|
|
if (Accept != null)
|
|
{
|
|
Accept(this, EventArgs.Empty);
|
|
}
|
|
this.Close(); //关闭窗口
|
|
}
|
|
}
|
|
|
|
private void NO_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
this.Close(); //关闭窗口
|
|
}
|
|
}
|
|
}
|
|
|