コード例 #1
0
        public static void SendResults(IPresentation pre, byte address, eTaskType taskType, int phoneNumberId = 0)
        {
            lock (_staticSyncObj)
            {
                var dbResults = NovaAlertCommon.GetResults(taskType, phoneNumberId);

                for (int i = 0; i < dbResults.Count; i++)
                {
                    var item = dbResults[i];
                    var msg  = new LP_ResultMessage()
                    {
                        TypeDest = eDevice.LedPanel,
                        Address  = address,
                        Id       = (byte)item.DisplayId,
                        Alert    = (byte)item.Task,
                        Level    = (byte)item.Level
                    };

                    if (item.TimeReceive.HasValue && item.TimeChange.HasValue)
                    {
                        msg.Result = 3;
                    }
                    else
                    {
                        if (item.TimeChange.HasValue)
                        {
                            msg.Result = 2;
                        }
                        else
                        {
                            if (item.TimeReceive.HasValue)
                            {
                                msg.Result = 1;
                            }
                        }
                    }

                    pre.SendData(msg);
                    System.Threading.Thread.Sleep(51);
                }
            }
        }