ComponentFactory.Krypton.Ribbon.KryptonRibbonGroupLinesDesigner.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 ((_ribbonLines != null) &&
                (_ribbonLines.Ribbon != null) &&
                 _ribbonLines.RibbonGroup.Items.Contains(_ribbonLines))
            {
                // Use a transaction to support undo/redo actions
                DesignerTransaction transaction = _designerHost.CreateTransaction("KryptonRibbonGroupLines MoveFirst");

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

                    RaiseComponentChanging(propertyItems);

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

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