ComponentFactory.Krypton.Ribbon.KryptonRibbonGroupButtonDesigner.OnMoveNext C# (CSharp) Method

OnMoveNext() private method

private OnMoveNext ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        private void OnMoveNext(object sender, EventArgs e)
        {
            if ((_ribbonButton != null) && (_ribbonButton.Ribbon != null))
            {
                // Get access to the parent collection of items
                TypedRestrictCollection<KryptonRibbonGroupItem> items = ParentItems;

                // Use a transaction to support undo/redo actions
                DesignerTransaction transaction = _designerHost.CreateTransaction("KryptonRibbonGroupButton MoveNext");

                try
                {
                    // Get access to the Items property
                    MemberDescriptor propertyItems = TypeDescriptor.GetProperties(_ribbonButton.RibbonContainer)["Items"];

                    RaiseComponentChanging(propertyItems);

                    // Move position of the triple
                    int index = items.IndexOf(_ribbonButton) + 1;
                    index = Math.Min(index, items.Count - 1);
                    items.Remove(_ribbonButton);
                    items.Insert(index, _ribbonButton);
                    UpdateVerbStatus();

                    RaiseComponentChanged(propertyItems, null, null);
                }
                finally
                {
                    // If we managed to create the transaction, then do it
                    if (transaction != null)
                        transaction.Commit();
                }
            }
        }