using DataEntity.Share;
|
using Microsoft.Win32;
|
using System;
|
using System.Collections.Generic;
|
using System.Collections.ObjectModel;
|
using System.IO;
|
using System.Linq;
|
using System.Windows;
|
using System.Windows.Controls;
|
using XCommon.Log;
|
using XCore;
|
using XHandler.Class.DataEx;
|
using XHandler.Controls;
|
using XHandler.View.Com;
|
using XHandler.View.MethodProperty;
|
using XImagingXhandler.XDAL;
|
|
namespace XHandler.View.BacteriaProperty
|
{
|
/// <summary>
|
/// 子方法 方法属性页面
|
/// </summary>
|
public partial class SubMethodProperty : UserControl, IMethodProperty
|
{
|
#region 变量
|
private int mark = 0;
|
public MethodSubMethod MethodSubMethod = null;
|
public MethodEx method = null;
|
#endregion
|
|
#region 构造函数
|
/// <summary>
|
/// 构造函数
|
/// </summary>
|
/// <param name="method"></param>
|
public SubMethodProperty(MethodEx method)
|
{
|
InitializeComponent();
|
|
mark = 0;
|
MethodSubMethod = new MethodSubMethod();
|
MethodSubMethod.strIndex = method.strIndex;
|
MethodSubMethod.label = method.method_name; // 命令标签
|
MethodSubMethod.name = method.method_name; // 命令名称
|
MethodSubMethod.status = (method.isEnabled == true ? "enable" : "disable"); // 使能状态
|
this.method = method;
|
if (method.tag != null)
|
{
|
MethodSubMethod = (MethodSubMethod)method.tag;
|
}
|
else
|
{
|
method.tag = MethodSubMethod;
|
}
|
|
this.DataContext = MethodSubMethod;
|
}
|
#endregion
|
|
#region 界面初期表示事件
|
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
{
|
mark += 1;
|
try
|
{
|
if (mark > 1)
|
{
|
return;
|
}
|
|
|
}
|
catch (Exception ex)
|
{
|
LoggerHelper.ErrorLog("ERROR:", ex);
|
}
|
}
|
#endregion
|
|
#region 方法名称更改事件
|
/// <summary>
|
/// 方法名称更改事件
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
private void tbxCommandName_TextChanged(object sender, TextChangedEventArgs e)
|
{
|
try
|
{
|
if (mark != 0)
|
{
|
MethodSubMethod.name = tbxCommandName.Text;
|
}
|
}
|
catch (Exception ex)
|
{
|
LoggerHelper.ErrorLog("ERROR:", ex);
|
}
|
}
|
#endregion
|
|
#region 方法标签文件更改事件
|
/// <summary>
|
/// 方法标签文件更改事件
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
private void tbxCommandLabel_TextChanged(object sender, TextChangedEventArgs e)
|
{
|
try
|
{
|
if (mark != 0)
|
{
|
MethodSubMethod.label = tbxCommandLabel.Text;
|
}
|
}
|
catch (Exception ex)
|
{
|
LoggerHelper.ErrorLog("ERROR:", ex);
|
}
|
}
|
|
public void SetTableName(string tableName, Labware lb)
|
{
|
}
|
#endregion
|
|
#region 文件路径
|
/// <summary>
|
/// 文件选择
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
private void btnSelectFile_Click(object sender, RoutedEventArgs e)
|
{
|
try
|
{
|
OpenFileDialog dlg = new OpenFileDialog();
|
dlg.Title = "请选择xmed文件";
|
dlg.FilterIndex = 1;
|
dlg.Filter = "xmed files(*.xmed)|*.xmed";
|
dlg.Multiselect = false;
|
|
string filePath = tboxFile.Text.Trim();
|
if (!string.IsNullOrEmpty(filePath))
|
{
|
if (Path.HasExtension(tboxFile.Text.Trim()))
|
{
|
dlg.InitialDirectory = Path.GetDirectoryName(filePath);
|
}
|
else
|
{
|
dlg.InitialDirectory = filePath;
|
}
|
}
|
|
if (dlg.ShowDialog() == true)
|
{
|
tboxFile.Text = dlg.FileName;
|
}
|
|
((MainWindow)Application.Current.MainWindow).testDesign.IsIgnore = true; //防止影响到主界面流程中已拖放的单命令顺序
|
}
|
catch (Exception ex)
|
{
|
LoggerHelper.ErrorLog("btnSelectFile_Click ERROR:", ex);
|
}
|
}
|
|
/// <summary>
|
/// 文件path变更事件
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
private void tboxFile_TextChanged(object sender, TextChangedEventArgs e)
|
{
|
try
|
{
|
if (MethodSubMethod != null)
|
{
|
MethodSubMethod.filePath = tboxFile.Text;
|
}
|
}
|
catch (Exception ex)
|
{
|
LoggerHelper.ErrorLog("tboxFile_TextChanged ERROR:", ex);
|
}
|
}
|
#endregion
|
|
private void cbxIsConcurrence_Click(object sender, RoutedEventArgs e)
|
{
|
try
|
{
|
if (MethodSubMethod != null)
|
{
|
MethodSubMethod.isConcurrence = (bool)cbxIsConcurrence.IsChecked;
|
}
|
}
|
catch (Exception ex)
|
{
|
LoggerHelper.ErrorLog("cbxIsConcurrence_Click ERROR:", ex);
|
}
|
}
|
|
private void tbxCommandComment_TextChanged(object sender, TextChangedEventArgs e)
|
{
|
try
|
{
|
if (MethodSubMethod != null)
|
{
|
if (this.method != null)
|
{
|
this.method.method_Tipcontent = tbxCommandComment.Text;
|
}
|
MethodSubMethod.comment = tbxCommandComment.Text;
|
}
|
}
|
catch (Exception ex)
|
{
|
LoggerHelper.ErrorLog("tbxCommandComment_TextChanged ERROR:", ex);
|
}
|
}
|
}
|
}
|