Exemple #1
0
        public void Remove(QueueRunner selectedItem)
        {
            //Placeholder
            var helper  = QueueRunners.ToList();
            var helper2 = new List <QueueRunner>();

            helper.Remove(selectedItem);

            //Clear and update plus update position
            QueueRunners.Clear();
            int i = 0;

            foreach (var item in helper)
            {
                item.Position = i + 1;
                helper2.Add(item);
                //QueueRunners.Add(item);
                i++;
            }

            //Update database
            DataService.UpdateQueueAsync(helper2);
            DataService.RemoveFromQueueAsync(selectedItem);

            UpdateCollections();
        }
Exemple #2
0
        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);
                }
            }
        }
Exemple #3
0
        //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);
            }
        }