private void OnMoveNext(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 MoveNext");
try
{
// Get access to the Items property
MemberDescriptor propertyItems = TypeDescriptor.GetProperties(_ribbonLines.RibbonGroup)["Items"];
RaiseComponentChanging(propertyItems);
// Move position of the triple
KryptonRibbonGroup ribbonGroup = _ribbonLines.RibbonGroup;
int index = ribbonGroup.Items.IndexOf(_ribbonLines) + 1;
index = Math.Min(index, ribbonGroup.Items.Count - 1);
ribbonGroup.Items.Remove(_ribbonLines);
ribbonGroup.Items.Insert(index, _ribbonLines);
UpdateVerbStatus();
RaiseComponentChanged(propertyItems, null, null);
}
finally
{
// If we managed to create the transaction, then do it
if (transaction != null)
transaction.Commit();
}
}
}