using MegaRobo.C00225155.Entities;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media.Animation;
using System.Xml.Serialization;

namespace Common
{
    public class StationProperty
    {
        private CancellationTokenSource cancellation = new CancellationTokenSource();
        /// <summary>
        /// 工站线程取消标志
        /// </summary>
        public CancellationTokenSource cancellationToken
        {
            get { return cancellation; }
            set { cancellation = value; }
        }

        /// <summary>
        /// 取消 暂停标志
        /// </summary>
        public ManualResetEvent ManualResetEvent { get; set; } = new ManualResetEvent(true);

        //private Task stationtask;
        //public Task stationTask
        //{
        //    get { return stationtask; }
        //    set { stationtask = value; }
        //}

        private int stationnum;
        /// <summary>
        /// 工站编号
        /// </summary>
        public int StationNum
        {
            get { return stationnum; }
            set { stationnum = value; }
        }

        private string stationname = string.Empty;
        public string StationName
        {
            get { return stationname; }
            set { stationname = value; }
        }

        /// <summary>
        /// 是否启动按钮触发
        /// </summary>
        public bool bStartButtonTrigger = false;

        /// <summary>
        /// 是否停止按钮触发
        /// </summary>
        public bool bStopButtonTrigger = false;

        /// <summary>
        /// 是否复位按钮触发
        /// </summary>
        public bool bResetButtonTrigger = false;

        /// <summary>
        /// 工站是否运行结束
        /// </summary>
        public bool bRunFinish = false;

        /// <summary>
        /// 工站是否已经复位，只有复位过才能启动
        /// </summary>
        public bool bHaveReset = false;

        /// <summary>
        /// 工站计时CT
        /// <summary>
        public Stopwatch CTWatch = new Stopwatch();

        public DeviceStatus deviceStatus = DeviceStatus.Idel;

        /// <summary>
        /// 阻塞信号集合
        /// </summary>
        public ConcurrentDictionary<string,ObstructFlag> ObstructFlagList { get; set; } = new ConcurrentDictionary<string, ObstructFlag>();

        //private CancellationTokenSource cancellationUpDn = new CancellationTokenSource();
        ///// <summary>
        ///// 上下工装线程取消标志(不控制工站线程)
        ///// </summary>
        //public CancellationTokenSource cancellationTokenUpDn
        //{
        //    get { return cancellationUpDn; }
        //    set { cancellationUpDn = value; }
        //}
    }
}
