Exemple #1
0
        private void OnRemove(object sender, EventArgs e)
        {
            if (treeViewSelected.SelectedNode != null)
            {
                CarrouselTreeNode selectedItem = (CarrouselTreeNode)treeViewSelected.SelectedNode;
                foreach (CarrouselTreeNode carrouselItem in _selectedItems.Values)
                {
                    if (carrouselItem.Sortix > selectedItem.Sortix)
                    {
                        carrouselItem.Sortix--;
                    }
                }

                _maxSortIx--;
                Item item = (Item)treeViewSelected.SelectedNode.Tag;
                if (item != null && _selectedItems[item.FQID] != null)
                {
                    _selectedItems.Remove(item.FQID);
                }
                treeViewSelected.Nodes.Remove(treeViewSelected.SelectedNode);
                //if (treeViewSelected.Nodes.Count == 0)
                buttonRemove.Enabled = false;
                treeViewSelected.Sort();
            }
            OnUserChange(null, null);
        }
Exemple #2
0
 private void OnSecondsChanged(object sender, EventArgs e)
 {
     if (treeViewSelected.SelectedNode != null)
     {
         CarrouselTreeNode item = (CarrouselTreeNode)treeViewSelected.SelectedNode;
         int newSeconds         = 10;
         if (Int32.TryParse(textBoxSeconds.Text, out newSeconds))
         {
             item.Seconds = newSeconds;
             treeViewSelected.SelectedNode = item;
             OnUserChange(sender, e);
         }
     }
 }
Exemple #3
0
 private void OnAdd(object sender, EventArgs e)
 {
     if (treeViewAvailable.SelectedNode != null && treeViewAvailable.SelectedNode.Tag is Item)
     {
         Item     toSelect = (Item)treeViewAvailable.SelectedNode.Tag;
         TreeNode tn       = new CarrouselTreeNode(toSelect, _defaultSeconds, _maxSortIx++);
         _selectedItems[toSelect.FQID] = tn;
         tn.Tag        = toSelect;
         tn.ImageIndex = tn.SelectedImageIndex = treeViewAvailable.SelectedNode.ImageIndex;
         treeViewSelected.Nodes.Add(tn);
     }
     buttonAdd.Enabled = false;
     OnUserChange(null, null);
 }
Exemple #4
0
 private void OnDown(object sender, EventArgs e)
 {
     if (treeViewSelected.SelectedNode != null)
     {
         CarrouselTreeNode item = (CarrouselTreeNode)treeViewSelected.SelectedNode;
         int nextSortIx         = item.Sortix + 1;
         foreach (CarrouselTreeNode checkItem in _selectedItems.Values)
         {
             if (checkItem.Sortix == nextSortIx)
             {
                 checkItem.Sortix--;
                 item.Sortix++;
                 break;
             }
         }
         treeViewSelected.Sort();
         treeViewSelected.SelectedNode = item;
         treeViewSelected.Focus();
         OnUserChange(sender, e);
     }
 }