1234567891011121314151617181920212223242526272829303132 |
- using FreeRedis;
- using System;
- using WCS.Entity.Protocol;
- namespace WCS_Client
- {
- public static class eqpData
- {
- public static DeviceDataPack deviceDataPack { get; set; } = null;
- private static System.Timers.Timer _timer;
- public static RedisClient Redis = null;
- public static void init(RedisClient redis)
- {
- Redis = redis;
- _timer = new System.Timers.Timer(5000);
- _timer.Elapsed += new System.Timers.ElapsedEventHandler(GetData);//到达时间的时候执行事件;
- _timer.AutoReset = true;//设置是执行一次(false)还是一直执行(true);
- _timer.Enabled = true;//是否执行System.Timers.Timer.Elapsed事件;
- }
- public static void GetData(object sender, EventArgs e)
- {
- try
- {
- deviceDataPack = Redis.Get<DeviceDataPack>("DeviceDataPack");
- }
- catch (Exception ex) {
- }
- }
- }
- }
|