chr
2024-03-07 303e6180d4f3d88e0feafc9515cae3be8117d2e7
Models/Program.cs
@@ -1,29 +1,76 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WPFProject.Models
{
    public class Program : NotifyBase
    {
        private string _Name;
        public string Name
        {
            get { return _Name; }
            set => RaiseAndSetIfChanged(ref _Name, value);
        }
        private ObservableCollection<Sequence> _Sequences;
        public ObservableCollection<Sequence> Sequences
        {
            get { return _Sequences; }
            set => RaiseAndSetIfChanged(ref _Sequences, value);
        }
    }
}
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
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, Variable> _TempVars;
        [XmlIgnore]
        public Dictionary<string, Variable> 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;
        }
    }
}