public UIActionState TryDemoteActiveVariation(bool perform) { // Find the first move in this variation which has a 'less important' side line. Variation moveWithSideLine = game.ActiveTree.ParentVariation; while (moveWithSideLine != null && moveWithSideLine.VariationIndex + 1 == moveWithSideLine.ParentTree.Variations.Count) { moveWithSideLine = moveWithSideLine.ParentTree.ParentVariation; } if (moveWithSideLine == null) { // Already no sidelines below this one. return(UIActionVisibility.Disabled); } if (perform) { moveWithSideLine.RepositionAfter(moveWithSideLine.VariationIndex + 1); GameUpdated(); } return(UIActionVisibility.Enabled); }