schangxiang@126.com
2025-11-04 f5ed29dc26c7cd952d56ec5721a2efc43cd25992
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
using DataEntity;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
 
namespace XImagingXhandler.XDAL
{
    /// <summary>
    /// 属性基础类
    /// </summary>
    public class MethodBase : IEntity
    {
        /// <summary>
        /// guid:保存的xml中Id(只能保证在当前方法文件中唯一)
        /// </summary>
        public string id { get; set; } = Guid.NewGuid().ToString();
 
        /// <summary>
        /// keyId:所有节点唯一key(即使同一个子方法被引用多次,keyId也唯一)
        /// </summary>
        public string keyId { get; set; }
 
        /// <summary>
        /// 是否从此命令开始
        /// </summary>
        public string isrun { get; set; } = "false";
        /// <summary>
        /// 命令是否可用
        /// </summary>
        public string status { get; set; } = "enable";
 
        /// <summary>
        /// 命令名称
        /// </summary>
        public string name { get; set; } = "";
 
        /// <summary>
        /// 序号
        /// </summary>
        public string strIndex { get; set; } = "";
 
        
        private string _label = "";
        /// <summary>
        /// 命令标签名
        /// </summary>
        public string label
        {
            get { return _label; }
            set
            {
                _label = value;
                OnPropertyChanged("label");
            }
        }
 
        #region 用以标注这个方法的开始和结束2个节点是同一组节点
        private string _groupID;
        /// <summary>
        /// 用以标注这个方法的开始和结束2个节点是同一组节点
        /// </summary>
        public string groupID
        {
            get { return _groupID; }
            set
            {
                _groupID = value;
                OnPropertyChanged("groupID");
            }
        }
        #endregion
 
 
        #region 深拷贝
        /// <summary>
        /// 深拷贝,利用默认构造函数创建新对象
        /// </summary>
        /// <returns></returns>
        public virtual object DeepCopy()
        {
            object retval = Activator.CreateInstance(this.GetType());
            return retval;
        }
        /// <summary>
        /// 利用序列化和反序列化进行深度拷贝,要求类对象支持序列化操作,UI对象不支持
        /// </summary>
        /// <typeparam name="S"></typeparam>
        /// <param name="s"></param>
        /// <returns></returns>
        public static S DeepCopyBase<S>(object s)
        {
            S d = JsonConvert.DeserializeObject<S>(JsonConvert.SerializeObject(s));
            return d;
        }
        #endregion
    }
}