| File was renamed from Models/Program.cs |
| | |
| | | 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();
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Collections.ObjectModel; |
| | | using System.Xml.Serialization; |
| | | using VisionBuilder.Core.Api; |
| | | using VisionBuilder.Core.Entity; |
| | | |
| | | namespace WPFProject.Models |
| | | { |
| | | public class Program : NotifyBase, IProgram |
| | | { |
| | | /// <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 = new Dictionary<string, Param>(); |
| | | [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 RunProgram() |
| | | { |
| | | foreach (Sequence sequence in Sequences) |
| | | { |
| | | sequence.RunSequnce(); |
| | | } |
| | | } |
| | | } |
| | | } |