ComponentFactory.Krypton.Ribbon.KryptonRibbonGroupDesigner.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 ((_ribbonGroup != null) &&
                (_ribbonGroup.Ribbon != null) &&
                 _ribbonGroup.RibbonTab.Groups.Contains(_ribbonGroup))
            {
                // Use a transaction to support undo/redo actions
                DesignerTransaction transaction = _designerHost.CreateTransaction("KryptonRibbonGroup MoveNext");

                try
                {
                    // Get access to the Group property
                    MemberDescriptor propertyGroups = TypeDescriptor.GetProperties(_ribbonGroup.RibbonTab)["Groups"];

                    RaiseComponentChanging(propertyGroups);

                    // Move position of the group
                    KryptonRibbonTab ribbonTab = _ribbonGroup.RibbonTab;
                    int index = ribbonTab.Groups.IndexOf(_ribbonGroup) + 1;
                    index = Math.Min(index, ribbonTab.Groups.Count - 1);
                    ribbonTab.Groups.Remove(_ribbonGroup);
                    ribbonTab.Groups.Insert(index, _ribbonGroup);
                    UpdateVerbStatus();

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