private static void RemoveItem(CommonMultiItemsList list, MyListItem item)
                {
                    int index = list.GetItemIndex(item);

                    list.Controls.Remove(item);
                    list.Controls[index - 1].Focus();
                    list.SubKeyNames.RemoveAt(index - 1);
                    list.WriteRegistry();
                    item.Dispose();
                }
 public SubShellItem(CommonMultiItemsList list, string keyName) : base($@"{CommandStorePath}\{keyName}")
 {
     this.Owner             = list;
     BtnMoveDown            = new MoveButton(this, false);
     BtnMoveUp              = new MoveButton(this, true);
     BtnMoveUp.MouseDown   += (sender, e) => MoveItem(this, Owner, true);
     BtnMoveDown.MouseDown += (sender, e) => MoveItem(this, Owner, false);
     ContextMenuStrip.Items.Remove(TsiDeleteMe);
     ContextMenuStrip.Items.Add(TsiDeleteRef);
     TsiDeleteRef.Click += (sender, e) => DeleteReference();
 }
 public InvalidItem(CommonMultiItemsList list, string keyName)
 {
     this.Owner             = list;
     this.Text              = $"{AppString.Item.InvalidItem} {keyName}";
     this.Image             = AppImage.NotFound.ToTransparent();
     BtnDelete              = new DeleteButton(this);
     BtnMoveDown            = new MoveButton(this, false);
     BtnMoveUp              = new MoveButton(this, true);
     BtnMoveUp.MouseDown   += (sender, e) => MoveItem(this, Owner, true);
     BtnMoveDown.MouseDown += (sender, e) => MoveItem(this, Owner, false);
     MyToolTip.SetToolTip(BtnDelete, AppString.Tip.InvalidItem);
 }
 public SeparatorItem(CommonMultiItemsList list)
 {
     this.Owner             = list;
     this.Text              = AppString.Item.Separator;
     this.Image             = AppImage.Separator;
     BtnDelete              = new DeleteButton(this);
     BtnMoveDown            = new MoveButton(this, false);
     BtnMoveUp              = new MoveButton(this, true);
     BtnMoveUp.MouseDown   += (sender, e) => MoveItem(this, Owner, true);
     BtnMoveDown.MouseDown += (sender, e) => MoveItem(this, Owner, false);
     MyToolTip.SetToolTip(BtnDelete, AppString.Tip.Separator);
 }
                private static void MoveItem(MyListItem item, CommonMultiItemsList list, bool isUp)
                {
                    int index = list.GetItemIndex(item);

                    if (isUp)
                    {
                        if (index > 1)
                        {
                            list.SetItemIndex(item, index - 1);
                            list.SubKeyNames.Reverse(index - 2, 2);
                        }
                    }
                    else
                    {
                        if (index < list.Controls.Count - 1)
                        {
                            list.SetItemIndex(item, index + 1);
                            list.SubKeyNames.Reverse(index - 1, 2);
                        }
                    }
                    list.WriteRegistry();
                }