chr
2024-03-12 25dd2203bb3b995d73c43733b3aaa049ec28b4a9
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
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
using VisionBuilder.Core.Entity;
 
namespace WPFProject.Models
{
    public class Program : NotifyBase
    {
        /// <summary>
        /// 程序名
        /// </summary>
        private string _Name;
        public string Name
        {
            get { return _Name; }
            set => RaiseAndSetIfChanged(ref _Name, value);
        }
 
        /// <summary>
        /// 序列集合
        /// </summary>
        private ObservableCollection<Sequence> _Sequences = new ObservableCollection<Sequence>();
        public ObservableCollection<Sequence> Sequences
        {
            get { return _Sequences; }
            set => RaiseAndSetIfChanged(ref _Sequences, value);
        }
 
        /// <summary>
        /// 程序所需参数
        /// </summary>
        private ObservableCollection<Variable> _Variables;
        public ObservableCollection<Variable> Variables
        {
            get { return _Variables; }
            set => RaiseAndSetIfChanged(ref _Variables, value);
        }
 
        /// <summary>
        /// 初始参数参数
        /// </summary>
        private Dictionary<string, Variable> _InitVars;
        [XmlIgnore]
        public Dictionary<string, Variable> InitVars
        {
            get { return _InitVars; }
            set { _InitVars = value; }
        }
 
        /// <summary>
        /// 计算临时参数
        /// </summary>
        private Dictionary<string, Param> _TempVars;
        [XmlIgnore]
        public Dictionary<string, Param> TempVars
        {
            get { return _TempVars; }
            set { _TempVars = value; }
        }
 
        public Program AddSequnce(params Sequence[] sequences)
        {
            foreach (Sequence sequence in sequences)
            {
                if (sequence == null) continue;
                sequence.Program = this;
                Sequences.Add(sequence);
            }
            return this;
        }
 
        public void Run()
        {
            foreach (Sequence sequence in Sequences)
            {
                sequence.Run();
            }
        }
    }
}