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 NEIntelligentControl2.Windows { /// /// 自定义挂牌内容输入窗口 /// public partial class CustomValueWindow : Window { public string Value { get; set; } private string _Title = "[检修]"; public CustomValueWindow() { InitializeComponent(); } public static string ShowWindow() { CustomValueWindow cvw = new CustomValueWindow(); cvw.Owner = Application.Current.MainWindow; var b = cvw.ShowDialog(); if (b == true) { return cvw.Value; } return null; } private void Button_Click(object sender, RoutedEventArgs e) { switch (((Control)sender).Tag) { case "cancel":// 取消 this.DialogResult = false; break; case "ok":// 确定 this.Value = _Title + _TBMain.Text?.Trim(); this.DialogResult = true; break; default:return; } } private void Window_Loaded(object sender, RoutedEventArgs e) { _TBMain.Focus(); } private void RadioButton_Click(object sender, RoutedEventArgs e) { _Title = ((RadioButton)(sender)).Tag as string; } } }