ComponentFactory.Krypton.Ribbon.KryptonRibbonGroupLinesDesigner.OnDeleteLines C# (CSharp) Method

OnDeleteLines() private method

private OnDeleteLines ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        private void OnDeleteLines(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 DeleteLines");

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

                    // Remove the ribbon group from the ribbon tab
                    RaiseComponentChanging(null);
                    RaiseComponentChanging(propertyItems);

                    // Remove the page from the ribbon
                    _ribbonLines.RibbonGroup.Items.Remove(_ribbonLines);

                    // Get designer to destroy it
                    _designerHost.DestroyComponent(_ribbonLines);

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