ComponentFactory.Krypton.Ribbon.KryptonRibbonGroupSeparatorDesigner.OnMoveFirst C# (CSharp) Method

OnMoveFirst() private method

private OnMoveFirst ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        private void OnMoveFirst(object sender, EventArgs e)
        {
            if ((_ribbonSeparator != null) &&
                (_ribbonSeparator.Ribbon != null) &&
                 _ribbonSeparator.RibbonGroup.Items.Contains(_ribbonSeparator))
            {
                // Use a transaction to support undo/redo actions
                DesignerTransaction transaction = _designerHost.CreateTransaction("KryptonRibbonGroupSeparator MoveFirst");

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

                    RaiseComponentChanging(propertyItems);

                    // Move position of the separator
                    KryptonRibbonGroup ribbonGroup = _ribbonSeparator.RibbonGroup;
                    ribbonGroup.Items.Remove(_ribbonSeparator);
                    ribbonGroup.Items.Insert(0, _ribbonSeparator);
                    UpdateVerbStatus();

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