//Removes items from the queue
        private void btnRemoveQueue_Click(object sender, EventArgs e)
        {
            UndoBranch.Add(queueList.Items.Cast <string>().ToList());
            List <string> ItemsToRemove = queueList.SelectedItems.Cast <string>().ToList();

            foreach (string ProgramName in ItemsToRemove)
            {
                queueList.Items.Remove(ProgramName);
            }
        }
 //On click, grab any selected items from the first list and move them to the other one.
 private void btnAddQueue_Click(object sender, EventArgs e)
 {
     UndoBranch.Add(queueList.Items.Cast <string>().ToList());
     foreach (string ProgramName in selectInstallList.SelectedItems)
     {
         if (!queueList.Items.Contains(ProgramName))
         {
             queueList.Items.Add(ProgramName);
         }
     }
 }
        /*
         * MoveDown:
         *  Move items down in the queue list
         */
        private void btnMoveDown_Click(object sender, EventArgs e)
        {
            //Make sure the user has at least one itme selected.
            //Make sure the item is not the last item in the list.
            //If all criteria are met, swap the item with the one below it
            if (queueList.SelectedIndices.Count < 1)
            {
                MessageBox.Show("WARNING:\nYou must select a queued\nitem to use this feature.");
            }

            // if the last item is selected you cannot move down
            else if (queueList.SelectedIndices.Contains(queueList.Items.Count - 1))
            {
                return;
            }

            else
            {
                // set undo poin
                UndoBranch.Add(queueList.Items.Cast <string>().ToList());
                List <int> SelectedIndecies = queueList.SelectedIndices.Cast <int>().ToList();

                // loop through the selected items backwards in order to move them all down by one
                SelectedIndecies.Reverse();
                foreach (int from in SelectedIndecies)
                {
                    int to = from + 1;

                    var temp = queueList.Items[to];

                    queueList.Items[to]   = queueList.Items[from];
                    queueList.Items[from] = temp;
                }

                // select only the moved items
                queueList.SetSelected(queueList.SelectedIndex, false);
                foreach (int i in SelectedIndecies)
                {
                    queueList.SetSelected(i + 1, true);
                }
            }
        }