public int GetSwapsLeft(string id)
        {
            QueueViewModel model = null;

            modelIDs.TryGetValue(id, out model);
            return((model == null) ? 0 : GetSwapsLeft(model));
        }
 public void RemoveQueueViewModel(QueueViewModel model)
 {
     Queues.Remove(model);
     modelIDs.Remove(model.ID);
     swapsLeft.Remove(model.ID);
     this.OnPropertyChanged("Queues");
 }
 public void AddQueueViewModel(QueueViewModel model)
 {
     Queues.Add(model);
     modelIDs.Add(model.ID, model);
     swapsLeft.Add(model.ID, maxSwaps);
     this.OnPropertyChanged("Queues");
 }
        public int GetSwapsLeft(QueueViewModel model)
        {
            string id    = model.ID;
            int    swaps = 0;

            swapsLeft.TryGetValue(id, out swaps);
            return(swaps);
        }
        public void RemoveQueueViewModel(string ID)
        {
            QueueViewModel model = null;

            modelIDs.TryGetValue(ID, out model);
            Queues.Remove(model);
            modelIDs.Remove(ID);
            swapsLeft.Remove(ID);
        }
        public void RemoveQueueViewModel(string id)
        {
            QueueViewModel model = null;

            modelIDs.TryGetValue(id, out model);
            if (model != null)
            {
                RemoveQueueViewModel(model);
            }
        }
        public void swap(string id)
        {
            int swaps = GetSwapsLeft(id);

            if (swaps > 0)
            {
                swapsLeft.Remove(id);
                swapsLeft.Add(id, swaps - 1);
            }

            QueueViewModel qm = null;

            modelIDs.TryGetValue(id, out qm);
            qm.ResetColour(swaps - 1);
        }
Example #8
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            QueueViewModel model = obj as QueueViewModel;

            if (model == null)
            {
                return(false);
            }

            return(this.ID.Equals(model.ID));
        }
 public void swap(QueueViewModel model)
 {
     swap(model.ID);
 }