Exemple #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            // Build
            var ui = new Dialog();
            var moves = new Moves();
            var game = new Game();
            var mapper = new Mapper();
            var interactions = new Interactions(moves, game, mapper);

            // Bind
            ui.ResetRequest += interactions.New_game;
            ui.MoveRequest += interactions.Move;
            interactions.OnGameChanged += gamestate => Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)(() => ui.Display(gamestate)));
            interactions.SetActive += ui.SetActive;

            // Run
            interactions.Start();
            ui.Show();
        }
Exemple #2
0
 public Interactions(Moves moves, Game game, Mapper mapper)
 {
     _moves = moves;
     _game = game;
     _mapper = mapper;
 }