using System; using System.Windows; using System.Windows.Controls; using XCommon.Log; using XCore; using XImagingXhandler.XDAL; namespace XHandler.View.MethodProperty { /// /// 超声探测页面 /// public partial class UltrasonicProperty : System.Windows.Controls.UserControl { #region 变量 private AspirateBll aspirateBll = new AspirateBll(); private int mark = 0; public MethodUltrasonic methodUltrasonic = null; #endregion #region 构造函数 public UltrasonicProperty(MethodEx method) { mark = 0; InitializeComponent(); methodUltrasonic = new MethodUltrasonic(); methodUltrasonic.name = method.method_name; methodUltrasonic.label = method.method_name; methodUltrasonic.status = (method.isEnabled == true ? "enable" : "disable"); methodUltrasonic.strIndex = method.strIndex; this.DataContext = methodUltrasonic; if (method.tag != null) { methodUltrasonic = (MethodUltrasonic)method.tag; } } #endregion #region 页面初始化 private void UserControl_Loaded(object sender, RoutedEventArgs e) { mark += 1; try { if (mark > 1) { return; } tbxCommandLabel.Text = methodUltrasonic.label; tbxCommandName.Text = methodUltrasonic.name; gridProperty.Children.Clear(); UltrasonicChildProperty property = new UltrasonicChildProperty(methodUltrasonic.ultrasonicData); gridProperty.Children.Add(property); } catch (Exception ex) { LoggerHelper.ErrorLog("ERROR:", ex); } } #endregion #region 命令名称变更事件 private void tbxCommandName_TextChanged(object sender, TextChangedEventArgs e) { try { methodUltrasonic.name = tbxCommandName.Text; methodUltrasonic.label = tbxCommandLabel.Text; } catch (Exception ex) { LoggerHelper.ErrorLog("ERROR:", ex); } } #endregion } }