public MinesweeperMainView(IEventAggregator aggregator, MinesweeperMainGameClass game) { _aggregator = aggregator; _aggregator.Subscribe(this); //parts needed: //grid //gameboard //column 1 is gameboard //column 2 is the following: //stack panel //first part is label grid with mines needed, mines left, level chosen //plus command button to toggle unflip mines and flag mines Grid grid = new Grid(); AddLeftOverColumn(grid, 1); //well see how this works (?) AddLeftOverColumn(grid, 1); GameboardWPF gameboard = new GameboardWPF(game); AddControlToGrid(grid, gameboard, 0, 0); _gameboard = gameboard; //TestControl test = new TestControl(aggregator, game); //AddControlToGrid(grid, test, 0, 0); StackPanel stack = new StackPanel(); SimpleLabelGrid thisLab = new SimpleLabelGrid(); thisLab.AddRow("Mines Needed", nameof(MinesweeperMainViewModel.HowManyMinesNeeded)); thisLab.AddRow("Mines Left", nameof(MinesweeperMainViewModel.NumberOfMinesLeft)); thisLab.AddRow("Level Chosen", nameof(MinesweeperMainViewModel.LevelChosen)); //hopefully this simple (?) //i do like the buttons first. Button button = GetGamingButton("", nameof(MinesweeperMainViewModel.ChangeFlag)); Binding binding = new Binding(nameof(MinesweeperMainViewModel.IsFlagging)); IValueConverter converter = new ToggleNameConverter(); binding.Converter = converter; button.SetBinding(ContentProperty, binding); binding = new Binding(nameof(MinesweeperMainViewModel.IsFlagging)); converter = new ToggleColorConverter(); binding.Converter = converter; button.SetBinding(BackgroundProperty, binding); stack.Children.Add(button); button.Margin = new Thickness(5); button.HorizontalAlignment = HorizontalAlignment.Left; button.VerticalAlignment = VerticalAlignment.Top; stack.Children.Add(thisLab.GetContent); AddControlToGrid(grid, stack, 0, 1); Content = grid; }
public MinesweeperMainView(IEventAggregator aggregator, MinesweeperMainGameClass game) { _aggregator = aggregator; _aggregator.Subscribe(this); Grid grid = new Grid(); AddLeftOverColumn(grid, 1); //well see how this works (?) AddLeftOverColumn(grid, 1); GameboardXF gameboard = new GameboardXF(game); AddControlToGrid(grid, gameboard, 0, 0); _gameboard = gameboard; StackLayout stack = new StackLayout(); SimpleLabelGridXF thisLab = new SimpleLabelGridXF(); thisLab.AddRow("Mines Needed", nameof(MinesweeperMainViewModel.HowManyMinesNeeded)); thisLab.AddRow("Mines Left", nameof(MinesweeperMainViewModel.NumberOfMinesLeft)); thisLab.AddRow("Level Chosen", nameof(MinesweeperMainViewModel.LevelChosen)); //hopefully this simple (?) //i do like the buttons first. Button button = GetGamingButton("", nameof(MinesweeperMainViewModel.ChangeFlag)); Binding binding = new Binding(nameof(MinesweeperMainViewModel.IsFlagging)); IValueConverter converter = new ToggleNameConverter(); binding.Converter = converter; button.SetBinding(Button.TextProperty, binding); binding = new Binding(nameof(MinesweeperMainViewModel.IsFlagging)); converter = new ToggleColorConverter(); binding.Converter = converter; button.SetBinding(BackgroundColorProperty, binding); stack.Children.Add(button); button.Margin = new Thickness(5); button.HorizontalOptions = LayoutOptions.Start; button.VerticalOptions = LayoutOptions.Start; stack.Children.Add(thisLab.GetContent); AddControlToGrid(grid, stack, 0, 1); Content = grid; }