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 MinesweeperMainViewModel(IEventAggregator aggregator, CommandContainer commandContainer, IGamePackageResolver resolver, LevelClass level ) { _aggregator = aggregator; LevelChosen = level.Level; //at this point, can't choose level because its already chosen. this.PopulateMinesNeeded(); CommandContainer = commandContainer; _mainGame = resolver.ReplaceObject <MinesweeperMainGameClass>(); //hopefully this works. means you have to really rethink. }
public GameboardXF(MinesweeperMainGameClass gameBoard) { _thisGrid = new Grid(); int x; for (x = 1; x <= 9; x++) { GridHelper.AddLeftOverColumn(_thisGrid, 1); GridHelper.AddLeftOverRow(_thisGrid, 1); // to make them even. } Content = _thisGrid; _gameBoard = gameBoard; }
public GameboardWPF(MinesweeperMainGameClass gameBoard) { _thisGrid = new Grid(); //_thisDraw = new SKElement(); //_thisDraw.PaintSurface += PaintSurface; //_thisGrid.Children.Add(_thisDraw); //Grid.SetColumnSpan(_thisDraw, 9); //Grid.SetRowSpan(_thisDraw, 9); // needs to be 9 by 9 int x; for (x = 1; x <= 9; x++) { GridHelper.AddLeftOverColumn(_thisGrid, 1); GridHelper.AddLeftOverRow(_thisGrid, 1); // to make them even. } Content = _thisGrid; _gameBoard = gameBoard; }
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; }