示例#1
0
        private void DoWork(IWorkThreadContext context)
        {
            IQuant quant;
              while (!context.ShouldStopThread)
              {
            while (!queue.IsEmpty && !context.ShouldStopThread)
            {
              if (queue.TryDequeue(out quant) && quant.DataType == 2)
              {
            if (NewValueReceived != null)
              NewValueReceived(this, BitConverter.ToInt32(quant.Data, 0), quant.ChannelId);
              }
            }

            Thread.Sleep(100);
              }
        }
示例#2
0
        private void ThreadWork(IWorkThreadContext context)
        {
            IQuantInfo quant = null;
              while (!context.ShouldStopThread)
              {
            while (deviceApi.GetQuant(Handle, ref quant))
            {
              if (modulesDictionary.ContainsKey(quant.ModuleId))
              {
            modulesDictionary[quant.ModuleId].AddQuant(
              new Quant { ChannelId = quant.ChannelId, DataType = quant.DataType, Data = quant.Data });
              }
            }

            Thread.Sleep(100);
              }
        }