void CreateThreadToCheckData() { async void Receive() { while (data.Live) { if (await mailBox.DOReceive()) { switch (data.messagetype) { case Messagetype.order: orderTODO(); break; //case Messagetype.update: updateTODO(); break; } } } } Receive(); while (data.Live) { if (!data.Live) { centerManager.iplist[UserID].ID = null; } Thread.Sleep(400); } }
void CreateThreadToCheckData() { int sum = 0; async void Receive() { while (data.Live) { if (await mailBox.DOReceive()) { //switch (data.messagetype) //{ // case Messagetype.carinfomessage: ChangeCarMessage(); break; // case Messagetype.volumepackage: ChangeCarMessage(); break; // case Messagetype.package: ChangeCarMessage(); break; //} } else { Thread.Sleep(100); sum++; } } } Receive(); while (data.Live) { if (!data.Live) { centerManager.iplist[DeviceID].ID = null; } if (sum == 100) { mailBox.Send(CenterNet.CreateOrderString("monitor")); sum = 0; } if (order.TryDequeue(out Order)) { Send(Order); } } }