コード例 #1
0
        public PovController()
        {
            var device = PovDevice.GetList();

            foreach (var deviceItem in device)
            {
                if (!povDevices.ContainsKey(deviceItem.DeviceName.Trim()))
                {
                    povDevices.Add(deviceItem.DeviceName.Trim(), deviceItem);
                }
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: ezwyj/NightPlay
        static void Main(string[] args)
        {
            //取初始数据
            GlobalVariable.PovDevices = new Dictionary <string, PovDevice>();


            var devices = PovDevice.GetList();

            foreach (var device in devices)
            {
                string deviceName = device.DeviceName.Trim();
                GlobalVariable.PovDevices.Add(deviceName, device);
                var task = new Task(DeviceListen, deviceName);
                task.Start();
                var taskDeviceListen = new Task(DeviceListenFromClientDevice, deviceName);
                taskDeviceListen.Start();
            }

            Console.ReadLine();
            //while(1==1)
            //{
            //    try
            //    {

            //        var needTranMessage = Client.GetListByProperty(a=>a.IsPlay,false).FindAll(b=>b.IsPay==false);
            //        foreach(var itemMessage in needTranMessage){
            //            Console.WriteLine("Device:"+needTranMessage);
            //            if (!client.IsConnected)
            //            {
            //                string clientId = Guid.NewGuid().ToString();
            //                client.Connect(clientId, itemMessage.Device.BaiDuYunName, itemMessage.Device.BaiDuYunPwd);
            //            }
            //            ushort i = client.Publish(itemMessage.Device.DeviceName.Trim() + "_Content", Encoding.UTF8.GetBytes(itemMessage.Device.DeviceName.Trim() + "_" + DateTime.Now.ToString()), MqttMsgBase.QOS_LEVEL_AT_MOST_ONCE, false);
            //            itemMessage.IsPlay = true;
            //        }



            //    }

            //    catch{

            //    }
            //    finally
            //    {
            //        System.Threading.Thread.Sleep(100);
            //    }
            //}
        }