private void Timer_Tick(object sender, EventArgs e) { Data.BeginUpdate(); foreach (var item in Data) { if (item.Detect6 == null) { UpdateRTD(item); } } if (Data.First().Detect6 != null) { Data.Insert(0, (RTDItem.CreateItem())); } Data.EndUpdate(); Stations.BeginUpdate(); if (CarIndex == 0) { Stations.First().CarNo = Data.First().CarNo; } else if (CarIndex == 4) { Stations[3].CarNo = string.Empty; CarIndex = 0; Stations.First().CarNo = Data.First().CarNo; } if (CarIndex != 0) { Stations[CarIndex].CarNo = Stations[CarIndex - 1].CarNo; Stations[CarIndex - 1].CarNo = string.Empty; } //if (CarIndex == 3) // CarIndex = 0; //else CarIndex++; Stations.EndUpdate(); //DispatcherService.BeginInvoke(() => //{ // // UpdataCP(CPS.First()); // // UpdataCP(CP); //}); //CP.Param2 = 123m; lala = new Random(Guid.NewGuid().GetHashCode()).Next(0, 100); }