public void UpdateCollections() { //DataService get all var data = DataService.GetAllQueueRunnersAsync().Result.ToList(); //Reset AllQueueRunners.Clear(); QueueRunners.Clear(); if (data.Count > 0) { foreach (var item in data) { //Filter current runner if (item.Position != 0) { QueueRunners.Add(item); } if (item.Position == 0) { CurrentRunner = item; } AllQueueRunners.Add(item); } } }
//do not use Refresh or implement AllQueueRunners (use it like updatecollections) public void Refresh() { var helper = QueueRunners.ToList().OrderBy(x => x.Position); QueueRunners.Clear(); foreach (var item in helper) { QueueRunners.Add(item); } }