using System;
|
using System.Windows;
|
using System.Windows.Controls;
|
using XCommon.Log;
|
using XHandler.Class.DataEx;
|
using XImagingXhandler.XDAL;
|
|
namespace XHandler.View.MethodProperty
|
{
|
/// <summary>
|
/// CommentProperty.xaml 的交互逻辑
|
/// </summary>
|
public partial class CommentProperty : UserControl
|
{
|
public MethodRemark methodRemark { get; set; }
|
public MethodRemark currmethodRemark = null;
|
public MethodEx method = null;
|
|
#region 全局属性变量
|
string isrun = "";
|
string status = "";
|
string name = "";
|
string label = "";
|
string title = "";
|
string remark = "";
|
int mark = 0;
|
#endregion
|
|
public CommentProperty()
|
{
|
InitializeComponent();
|
}
|
|
public CommentProperty(MethodEx method)
|
{
|
InitializeComponent();
|
mark = 0;
|
methodRemark = new MethodRemark();
|
methodRemark.name = method.method_name;
|
methodRemark.label = method.method_name;
|
tbxCommandLabel.Text = methodRemark.label;
|
tbxCommandName.Text = methodRemark.name;
|
methodRemark.status = (method.isEnabled == true ? "enable" : "disable");
|
DataContext = methodRemark;
|
this.method = method;
|
if (method.tag != null)
|
{
|
methodRemark = (MethodRemark)method.tag;
|
|
currmethodRemark = methodRemark;
|
isrun = methodRemark.isrun;
|
status = methodRemark.status;
|
name = methodRemark.name;
|
label = methodRemark.label;
|
title = methodRemark.title;
|
remark = methodRemark.remark;
|
}
|
}
|
|
private void tbxCommandName_TextChanged(object sender, TextChangedEventArgs e)
|
{
|
try
|
{
|
if (string.IsNullOrEmpty(tbxCommandName.Text))
|
{
|
xcError.Text = "命令名称不能为空";
|
return;
|
}
|
methodRemark.name = tbxCommandName.Text;
|
}
|
catch (Exception ex)
|
{
|
LoggerHelper.ErrorLog("ERROR:", ex);
|
}
|
}
|
|
private void tbxTitle_TextChanged(object sender, TextChangedEventArgs e)
|
{
|
try
|
{
|
if (string.IsNullOrEmpty(tbxTitle.Text))
|
{
|
xtError.Text = "标题不能为空";
|
return;
|
}
|
methodRemark.title = tbxTitle.Text;
|
|
if (this.method != null)
|
{
|
this.method.method_Tipcontent = string.Format("{0}", methodRemark.title.ToString());
|
}
|
}
|
catch (Exception ex)
|
{
|
LoggerHelper.ErrorLog("ERROR:", ex);
|
}
|
}
|
|
private void tbxDetail_TextChanged(object sender, TextChangedEventArgs e)
|
{
|
try
|
{
|
methodRemark.remark = tbxDetail.Text;
|
}
|
catch (Exception ex)
|
{
|
LoggerHelper.ErrorLog("ERROR:", ex);
|
}
|
}
|
|
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
{
|
mark += 1;
|
try
|
{
|
if (mark > 1)
|
{
|
return;
|
}
|
if (!string.IsNullOrEmpty(title))
|
{
|
tbxCommandName.Text = name;
|
tbxTitle.Text = title;
|
tbxDetail.Text = remark;
|
|
|
if (currmethodRemark != null)
|
{
|
methodRemark = currmethodRemark;
|
}
|
}
|
else
|
{
|
|
if (currmethodRemark != null)
|
{
|
methodRemark = currmethodRemark;
|
}
|
}
|
}
|
catch (Exception ex)
|
{
|
LoggerHelper.ErrorLog("ERROR:", ex);
|
}
|
}
|
}
|
}
|