LEDModel.cs 794 Bytes
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HHWCSHost.Model
{
    public class LEDModel
    {
        public LEDhelp.LEDHelper LED { get; set; }
        public Queue<string> InfoQueue { get; set; }

        public void BeginSendInfo()
        {
            Task.Run(async () =>
            {
                if (LED != null && InfoQueue != null)
                {
                    while (true)
                    {
                        await Task.Delay(2000);
                        if (InfoQueue.Count > 0)
                        {
                            LED.SendLedInfo(InfoQueue.Dequeue());
                        }
                    }
                }
            });
        }
    }
}