private HashSet <StageButtonView> CreateStageButtons(StageGroup stageGroup) { var buttons = new HashSet <StageButtonView>(); var noChildren = stageGroup.GroupedStages.Count == 0; var rowSpan = noChildren ? 2 : 1; var inverseScale = noChildren ? 1 : 1.5; var mainStageButton = new StageButtonView(stageGroup.MainStage, buttonView => stageSelectedCommand.Execute(buttonView.Stage)); Grid.SetRowSpan(mainStageButton, rowSpan); mainStageButton.InverseScaleText(inverseScale); ButtonGrid.Children.Add(mainStageButton); buttons.Add(mainStageButton); inverseScale += (stageGroup.GroupedStages.Count - 1) * 0.5; for (int i = 0; i < stageGroup.GroupedStages.Count; i++) { GroupedStages.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); var groupStageButton = new StageButtonView(stageGroup.GroupedStages[i], buttonView => stageSelectedCommand.Execute(buttonView.Stage)); groupStageButton.InverseScaleText(inverseScale); buttons.Add(groupStageButton); GroupedStages.Children.Add(groupStageButton, i, 0); } return(buttons); }
public StageGroupSingleView(StageGroup stageGroup, StrikingViewModel strikingViewModel) { this.stageGroup = stageGroup; this.strikingViewModel = strikingViewModel; stageSelectedCommand = new Command(OnStageSelected); strikingViewModel.StageStruckEvent += OnStageStruck; strikingViewModel.StageUnstruckEvent += OnStageUnstruck; InitializeComponent(); var button = new StageButtonView(stageGroup.MainStage, view => stageSelectedCommand.Execute(stageGroup.MainStage)); ButtonLayout.Children.Add(button); }