Esempio n. 1
0
        private void OnMenuItemMoveUp(object sender, EventArgs e)
        {
            Tab selTab = this.LastSelectedTool as Tab;

            if (selTab != null && selTab.Owner != null)
            {
                TabCollection tabCollection = selTab.Owner.Categories;
                int           index         = tabCollection.IndexOf(selTab);
                if (index > 0)
                {
                    bool allowDelete = selTab.AllowDelete;
                    try {
                        selTab.AllowDelete = true;
                        tabCollection.RemoveAt(index);
                        tabCollection.Insert(index - 1, selTab);
                    } finally {
                        selTab.AllowDelete = allowDelete;
                    }
                }
            }
            Item selItem = this.LastSelectedTool as Item;

            if (selItem != null && selItem.Owner != null)
            {
                ItemCollection itemCollection = selItem.Owner.Items;
                int            index          = itemCollection.IndexOf(selItem);
                if (index > 0)
                {
                    itemCollection.RemoveAt(index);
                    itemCollection.Insert(index - 1, selItem);
                }
            }
        }