public void monitor() { for (int i = 0; i < centerManager.Max; i++) { IPList ip = centerManager.iplist[i]; if (ip.IP == data.DeviceID) { Console.WriteLine(i); task = cc.taskManager.GetDeviceTask(i); if (task == null) { string TaskCategory = "BVTask"; string Taskname = "test"; task = cc.taskManager.SetDeviceTask(TaskCategory, Taskname, i); if (task == null) { Console.WriteLine("task is null"); } int a; string b; task.GetTaskConfig(out a, out b); Console.WriteLine(a + " " + b); } } } }
void CreateThreadToCheckData() { deviceList = new DeviceList[Max]; bool[] UserList = new bool[Max]; for (int i = 0; i < Max; i++) { deviceList[i].Live = false; UserList[i] = false; } while (true) { for (int i = 0; i < Max; i++) { IPList ip = centerManager.iplist[i]; if (ip.ID != null) { if (!deviceList[i].Live) { deviceList[i].Live = true; deviceList[i].ID = i; deviceList[i].Name = centerManager.Data.Devicedata[i].IP; DeviceC[i] = new DeviceConnectControl(ref centerManager.Data.Devicedata[i], ref centerManager, Max); } } else if (deviceList[i].Live) { deviceList[i].Live = false; Console.WriteLine(centerManager.Data.Devicedata[i].ID); } ip = centerManager.UserList[i]; if (ip.ID != null) { if (!UserList[i]) { UserList[i] = true; UserC[i] = new ClientConnectControl(ref centerManager.Data.Userdata[i], ref centerManager, ref cc, Max); } } else if (UserList[i]) { UserList[i] = false; } } Thread.Sleep(100); } }