protected FieldElementViewModel(int row, int column, Condition value, ITicTacToeService game) { Row = row; Column = column; _game = game; Value = value; }
public MainViewModel(ITicTacToeService game) { Winner = " "; Play = Visibility.Hidden; _game = game; Cells = new BindableCollection <MainFieldElementViewModel>(); for (var i = 0; i < 9; i++) { Cells.Add(new MainFieldElementViewModel(i / 3, i % 3, Condition.FREE, this, game)); } }
public void NewGame() { Play = Visibility.Visible; Winner = " "; _game = new TicTacToeGame(); Cells = new BindableCollection <MainFieldElementViewModel>(); for (var i = 0; i < 9; i++) { Cells.Add(new MainFieldElementViewModel(i / 3, i % 3, Condition.FREE, this, _game)); } NotifyOfPropertyChange(() => _game); NotifyOfPropertyChange(() => Cells); NotifyOfPropertyChange(() => Play); NotifyOfPropertyChange(() => Winner); }
static void Main(string[] args) { //Initialize Service Providers (Dependency Injection) var serviceProvider = new ServiceCollection() .AddSingleton <ITicTacToeService, TicTacToeService>() .AddSingleton <ITicTacToeRandomService, TicTacToeRandomService>() .BuildServiceProvider(); //Get instance of TicTacToeService to be used throughout (injectable) _ticTacToeService = serviceProvider.GetService <ITicTacToeService>(); _ticTacToeRandomService = serviceProvider.GetService <ITicTacToeRandomService>(); //Initialize Noughts and Crosses InitializeTicTacToe(3); //Indicate user the game has finished! Console.WriteLine(); Console.WriteLine("Thank you for using Noughts and Crosses!!"); Console.WriteLine(); }
public HomeController(ITicTacToeService ticTacToeService) { _ticTacToeService = ticTacToeService; }
public MainFieldElementViewModel(int row, int column, Condition value, MainViewModel mainFild, ITicTacToeService game) : base(row, column, value, game) { _mainFild = mainFild; Cells = new BindableCollection <SubFieldElementViewModel>(); for (var i = 0; i < 9; i++) { Cells.Add(new SubFieldElementViewModel(i / 3, i % 3, this, Condition.FREE, game)); } SizeText = 50; }
public void Setup() { _ticTacToeService = new TicTacToeService(); _ticTacToeRandomService = new TicTacToeRandomService(_ticTacToeService); }
public SubFieldElementViewModel(int row, int column, MainFieldElementViewModel mainField, Condition value, ITicTacToeService game) : base(row, column, value, game) { _mainFild = mainField; SizeText = 10; }
public TicTacToeRandomService(ITicTacToeService ticTacToeService) { _ticTacToeService = ticTacToeService; }
public TicTacToeAppService(ITicTacToeService ticTacToeService, IMapper mapper) { _ticTacToeService = ticTacToeService; _mapper = mapper; }